public override double LevelSetForm(ref Foundation.XDG.CommonParamsLs cp,
                                            double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB,
                                            double vA, double vB, double[] Grad_vA, double[] Grad_vB)
        {
            double M = ComputeEvaporationMass(cp.ParamsNeg.GetSubVector(2 * D, D + 3), cp.ParamsPos.GetSubVector(2 * D, D + 3), cp.n, cp.jCell);

            if (M == 0.0)
            {
                return(0.0);
            }


            double[] VelocityMeanIn  = new double[D];
            double[] VelocityMeanOut = new double[D];
            for (int d = 0; d < D; d++)
            {
                VelocityMeanIn[d]  = cp.ParamsNeg[D + d];
                VelocityMeanOut[d] = cp.ParamsPos[D + d];
            }

            double LambdaIn;
            double LambdaOut;

            LambdaIn  = LambdaConvection.GetLambda(VelocityMeanIn, cp.n, false);
            LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, cp.n, false);

            double Lambda = Math.Max(LambdaIn, LambdaOut);

            double uJump = -M * ((1 / rhoA) - (1 / rhoB)) * cp.n[m_d];

            double flx = Lambda * uJump * 0.8;

            return(-flx * (rhoA * vA - rhoB * vB));
        }
Пример #2
0
        public override double InnerEdgeForm(ref CommonParams cp,
                                             double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB,
                                             double vA, double vB, double[] Grad_vA, double[] Grad_vB)
        {
            double M = ComputeEvaporationMass(cp.Parameters_IN.GetSubVector(2 * m_D, m_D + 3), cp.Parameters_OUT.GetSubVector(2 * m_D, m_D + 3), cp.Normal, cp.jCellIn);

            if (M == 0.0)
            {
                return(0.0);
            }

            double[] VelocityMeanIn  = new double[m_D];
            double[] VelocityMeanOut = new double[m_D];
            for (int d = 0; d < m_D; d++)
            {
                VelocityMeanIn[d]  = cp.Parameters_IN[m_D + d];
                VelocityMeanOut[d] = cp.Parameters_OUT[m_D + d];
            }

            double LambdaIn;
            double LambdaOut;

            LambdaIn  = LambdaConvection.GetLambda(VelocityMeanIn, cp.Normal, false);
            LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, cp.Normal, false);

            double Lambda = Math.Max(LambdaIn, LambdaOut);


            double uJump = -M * ((1 / m_rhoA) - (1 / m_rhoB)) * cp.Normal[m_d];


            double flx = Lambda * uJump * 0.8;

            return(-flx * (m_rhoA * vA - m_rhoB * vB));
        }
Пример #3
0
        protected override double InnerEdgeFlux(ref CommonParams inp, double[] Uin, double[] Uout)
        {
            double r = 0.0;

            // Calculate central part
            // ======================

            double rhoIn  = 1.0;
            double rhoOut = 1.0;

            // 2 * {u_i * u_j} * n_j,
            // resp. 2 * {rho * u_i * u_j} * n_j for variable density
            r += rhoIn * Uin[0] * (inp.Parameters_IN[0] * inp.Normale[0] + inp.Parameters_IN[1] * inp.Normale[1]);
            r += rhoOut * Uout[0] * (inp.Parameters_OUT[0] * inp.Normale[0] + inp.Parameters_OUT[1] * inp.Normale[1]);
            if (m_SpatialDimension == 3)
            {
                r += rhoIn * Uin[0] * inp.Parameters_IN[2] * inp.Normale[2] + rhoOut * Uout[0] * inp.Parameters_OUT[2] * inp.Normale[2];
            }

            // Calculate dissipative part
            // ==========================

            double[] VelocityMeanIn  = new double[m_SpatialDimension];
            double[] VelocityMeanOut = new double[m_SpatialDimension];
            for (int d = 0; d < m_SpatialDimension; d++)
            {
                VelocityMeanIn[d]  = inp.Parameters_IN[m_SpatialDimension + d];
                VelocityMeanOut[d] = inp.Parameters_OUT[m_SpatialDimension + d];
            }

            double LambdaIn;
            double LambdaOut;

            LambdaIn  = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normale, true);
            LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normale, true);

            double Lambda = Math.Max(LambdaIn, LambdaOut);
            double uJump  = Uin[0] - Uout[0];

            r += Lambda * uJump * LaxFriedrichsSchemeSwitch;

            r *= 0.5;
            return(r);
        }
Пример #4
0
        protected double InnerEdgeFlux_BaseCall(ref CommonParams inp, double[] Uin, double[] Uout)
        {
            double r = 0.0;

            // Calculate central part
            // ======================

            r += inp.Parameters_IN[2 * m_SpatialDimension] * (inp.Parameters_IN[0] * inp.Normal[0] + inp.Parameters_IN[1] * inp.Normal[1]);
            r += inp.Parameters_OUT[2 * m_SpatialDimension] * (inp.Parameters_OUT[0] * inp.Normal[0] + inp.Parameters_OUT[1] * inp.Normal[1]);
            if (m_SpatialDimension == 3)
            {
                r += inp.Parameters_IN[2 * m_SpatialDimension] * inp.Parameters_IN[2] * inp.Normal[2] + inp.Parameters_OUT[2 * m_SpatialDimension] * inp.Parameters_OUT[2] * inp.Normal[2];
            }

            // Calculate dissipative part
            // ==========================

            double[] VelocityMeanIn  = new double[m_SpatialDimension];
            double[] VelocityMeanOut = new double[m_SpatialDimension];
            for (int d = 0; d < m_SpatialDimension; d++)
            {
                VelocityMeanIn[d]  = inp.Parameters_IN[m_SpatialDimension + d];
                VelocityMeanOut[d] = inp.Parameters_OUT[m_SpatialDimension + d];
            }

            double LambdaIn;
            double LambdaOut;

            LambdaIn  = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normal, true);
            LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normal, true);

            double Lambda = Math.Max(LambdaIn, LambdaOut);
            double uJump  = inp.Parameters_IN[2 * m_SpatialDimension] - inp.Parameters_OUT[2 * m_SpatialDimension];

            r += Lambda * uJump * LaxFriedrichsSchemeSwitch;

            r *= 0.5;
            return(r);
        }
Пример #5
0
        protected override double InnerEdgeFlux(ref CommonParams inp, double[] Uin, double[] Uout)
        {
            double flux = 0;

            //Central Part
            flux += Uin[0] * (inp.Parameters_IN[0] * inp.Normale[0] + inp.Parameters_IN[1] * inp.Normale[1]);
            flux += Uout[0] * (inp.Parameters_OUT[0] * inp.Normale[0] + inp.Parameters_OUT[1] * inp.Normale[1]);
            if (D == 3)
            {
                flux += Uin[0] * inp.Parameters_IN[2] * inp.Normale[2] + Uout[0] * inp.Parameters_OUT[2] * inp.Normale[2];
            }

            //Dissipative Part
            double[] VelocityMeanIn  = new double[D];
            double[] VelocityMeanOut = new double[D];

            for (int d = 0; d < D; d++)
            {
                VelocityMeanIn[d]  = inp.Parameters_IN[D + d];
                VelocityMeanOut[d] = inp.Parameters_OUT[D + d];
            }


            double LambdaIn;
            double LambdaOut;

            LambdaIn  = LambdaConvection.GetLambda(VelocityMeanIn, inp.Normale, false);
            LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, inp.Normale, false);

            double Lambda      = Math.Max(LambdaIn, LambdaOut);
            double Scalar_Jump = Uin[0] - Uout[0];

            flux += Lambda * Scalar_Jump;

            flux *= 0.5;
            return(flux);
        }
Пример #6
0
        public double LevelSetForm(ref CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double v_Neg, double v_Pos, double[] Grad_vA, double[] Grad_vB)
        {
            double[] U_NegFict, U_PosFict;


            this.TransformU(ref U_Neg, ref U_Pos, out U_NegFict, out U_PosFict);

            double[] ParamsNeg = cp.ParamsNeg;
            double[] ParamsPos = cp.ParamsPos;
            double[] ParamsPosFict, ParamsNegFict;
            this.TransformU(ref ParamsNeg, ref ParamsPos, out ParamsNegFict, out ParamsPosFict);

            //Flux for negativ side
            double FlxNeg;

            if (DirichletCond)
            {
                double r = 0.0;

                // Calculate central part
                // ======================
                r += Tsat * (ParamsNeg[0] * cp.n[0] + ParamsNeg[1] * cp.n[1]);
                if (m_D == 3)
                {
                    r += Tsat * ParamsNeg[2] * cp.n[2];
                }

                // Calculate dissipative part
                // ==========================

                double[] VelocityMeanIn = new double[m_D];
                for (int d = 0; d < m_D; d++)
                {
                    VelocityMeanIn[d] = ParamsNeg[m_D + d];
                }

                double LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, cp.n, true);

                double uJump = U_Neg[0] - Tsat;

                r += LambdaIn * uJump * LFFA;

                FlxNeg = capA * r;
            }
            else
            {
                BoSSS.Foundation.CommonParams inp; // = default(BoSSS.Foundation.InParams);
                inp.Parameters_IN  = ParamsNeg;
                inp.Parameters_OUT = ParamsNegFict;
                inp.Normale        = cp.n;
                inp.iEdge          = int.MinValue;
                inp.GridDat        = this.m_LsTrk.GridDat;
                inp.X    = cp.x;
                inp.time = cp.time;

                FlxNeg = this.NegFlux.IEF(ref inp, U_Neg, U_NegFict);
                //Console.WriteLine("FlxNeg = {0}", FlxNeg);
            }

            // Flux for positive side
            double FlxPos;

            if (DirichletCond)
            {
                double r = 0.0;

                // Calculate central part
                // ======================
                r += Tsat * (ParamsPos[0] * cp.n[0] + ParamsPos[1] * cp.n[1]);
                if (m_D == 3)
                {
                    r += Tsat * ParamsPos[2] * cp.n[2];
                }

                // Calculate dissipative part
                // ==========================

                double[] VelocityMeanOut = new double[m_D];
                for (int d = 0; d < m_D; d++)
                {
                    VelocityMeanOut[d] = ParamsPos[m_D + d];
                }

                double LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, cp.n, true);

                double uJump = Tsat - U_Pos[0];

                r += LambdaOut * uJump * LFFB;

                FlxPos = capB * r;
            }
            else
            {
                BoSSS.Foundation.CommonParams inp; // = default(BoSSS.Foundation.InParams);
                inp.Parameters_IN  = ParamsPosFict;
                inp.Parameters_OUT = ParamsPos;
                inp.Normale        = cp.n;
                inp.iEdge          = int.MinValue;
                inp.GridDat        = this.m_LsTrk.GridDat;
                inp.X    = cp.x;
                inp.time = cp.time;

                FlxPos = this.PosFlux.IEF(ref inp, U_PosFict, U_Pos);
                //Console.WriteLine("FlxPos = {0}", FlxPos);
            }

            if (movingmesh)
            {
                return(0.0);
            }
            else
            {
                return(FlxNeg * v_Neg - FlxPos * v_Pos);
            }
        }
Пример #7
0
        // Use Fluxes as in Bulk Convection
        //ConvectionInBulk_weightedLLF NegFlux;
        //ConvectionInBulk_weightedLLF PosFlux;


        //void TransformU(ref double[] U_Neg, ref double[] U_Pos, out double[] U_NegFict, out double[] U_PosFict) {
        //    U_NegFict = U_Pos;
        //    U_PosFict = U_Neg;
        //}

        public Double LevelSetForm(ref CommonParamsLs cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double v_Neg, double v_Pos, double[] Grad_vA, double[] Grad_vB)
        {
            double UinBkUp  = U_Neg[0];
            double UoutBkUp = U_Pos[0];

            double[] InParamsBkup  = cp.ParamsNeg;
            double[] OutParamsBkup = cp.ParamsPos;


            // evaluate flux function
            // ----------------------

            double flx = 0.0;

            double[] Uint = new double[] { 0.0, 0.0 };

            // Calculate central part
            // ======================

            //// 2 * {u_i * u_j} * n_j,
            //// resp. 2 * {rho * u_i * u_j} * n_j for variable density
            flx += rhoA * U_Neg[0] * ((cp.ParamsNeg[0] - Uint[0]) * cp.n[0] + (cp.ParamsNeg[1] - Uint[1]) * cp.n[1]);
            flx += rhoB * U_Pos[0] * ((cp.ParamsPos[0] - Uint[0]) * cp.n[0] + (cp.ParamsPos[1] - Uint[1]) * cp.n[1]);
            //if (m_D == 3) {
            //    flx += rhoA * U_Neg[0] * cp.ParamsNeg[2] * cp.n[2] + rhoB * U_Pos[0] * cp.ParamsPos[2] * cp.n[2];
            //}

            // Calculate dissipative part
            // ==========================

            double[] VelocityMeanIn  = new double[m_D];
            double[] VelocityMeanOut = new double[m_D];
            for (int d = 0; d < m_D; d++)
            {
                VelocityMeanIn[d]  = cp.ParamsNeg[m_D + d] - Uint[d];
                VelocityMeanOut[d] = cp.ParamsPos[m_D + d] - Uint[d];
            }

            double LambdaIn;
            double LambdaOut;

            LambdaIn  = LambdaConvection.GetLambda(VelocityMeanIn, cp.n, true);
            LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, cp.n, true);

            LambdaIn  *= rhoA;
            LambdaOut *= rhoB;

            double Lambda = Math.Max(LambdaIn, LambdaOut);

            double uJump = U_Neg[0] - U_Pos[0];

            flx += Lambda * uJump * LFF;

            flx *= 0.5;

            //flx *= rho_in;

            // cleanup mess and return
            // -----------------------

            U_Pos[0]     = UoutBkUp;
            U_Neg[0]     = UinBkUp;
            cp.ParamsNeg = InParamsBkup;
            cp.ParamsPos = OutParamsBkup;

            // ====================================

            double Flx = flx * v_Neg - flx * v_Pos;

            return(Flx);
        }
Пример #8
0
        public double InnerEdgeForm(ref CommonParams cp, double[] U_Neg, double[] U_Pos, double[,] Grad_uA, double[,] Grad_uB, double v_Neg, double v_Pos, double[] Grad_vA, double[] Grad_vB)
        {
            double[] U_NegFict, U_PosFict;


            this.TransformU(ref U_Neg, ref U_Pos, out U_NegFict, out U_PosFict);

            double[] ParamsNeg = cp.Parameters_IN;
            double[] ParamsPos = cp.Parameters_OUT;
            double[] ParamsPosFict, ParamsNegFict;
            this.TransformU(ref ParamsNeg, ref ParamsPos, out ParamsNegFict, out ParamsPosFict);

            //Flux for negativ side
            double FlxNeg;

            if (!evapMicroRegion[cp.jCellIn])
            {
                double r = 0.0;

                // Calculate central part
                // ======================

                double Tavg = Tsat; // 0.5 * (U_Neg[0] + Tsat);
                r += Tavg * (ParamsNeg[0] * cp.Normal[0] + ParamsNeg[1] * cp.Normal[1]);
                if (m_D == 3)
                {
                    r += Tavg * ParamsNeg[2] * cp.Normal[2];
                }

                // Calculate dissipative part
                // ==========================

                double[] VelocityMeanIn = new double[m_D];
                for (int d = 0; d < m_D; d++)
                {
                    VelocityMeanIn[d] = ParamsNeg[m_D + d];
                }

                double LambdaIn = LambdaConvection.GetLambda(VelocityMeanIn, cp.Normal, false);

                double uJump = U_Neg[0] - Tsat;

                r += LambdaIn * uJump * LFFA;

                FlxNeg = capA * r;
            }
            else
            {
                BoSSS.Foundation.CommonParams inp = cp;
                inp.Parameters_OUT = ParamsNegFict;

                FlxNeg = this.NegFlux.IEF(ref inp, U_Neg, U_NegFict);
                //Console.WriteLine("FlxNeg = {0}", FlxNeg);
            }

            // Flux for positive side
            double FlxPos;

            if (!evapMicroRegion[cp.jCellIn])
            {
                double r = 0.0;

                // Calculate central part
                // ======================

                double Tavg = Tsat; // 0.5 * (Tsat +  U_Pos[0]);
                r += Tavg * (ParamsPos[0] * cp.Normal[0] + ParamsPos[1] * cp.Normal[1]);
                if (m_D == 3)
                {
                    r += Tavg * ParamsPos[2] * cp.Normal[2];
                }

                // Calculate dissipative part
                // ==========================

                double[] VelocityMeanOut = new double[m_D];
                for (int d = 0; d < m_D; d++)
                {
                    VelocityMeanOut[d] = ParamsPos[m_D + d];
                }


                double LambdaOut = LambdaConvection.GetLambda(VelocityMeanOut, cp.Normal, false);

                double uJump = Tsat - U_Pos[0];

                r += LambdaOut * uJump * LFFB;

                FlxPos = capB * r;
            }
            else
            {
                BoSSS.Foundation.CommonParams inp = cp;
                inp.Parameters_IN = ParamsPosFict;

                FlxPos = this.PosFlux.IEF(ref inp, U_PosFict, U_Pos);
                //Console.WriteLine("FlxPos = {0}", FlxPos);
            }

            if (movingmesh)
            {
                return(0.0);
            }
            else
            {
                return(FlxNeg * v_Neg - FlxPos * v_Pos);
            }
        }