Esempio n. 1
0
        protected override void InnerEdgeFlux(ref BoSSS.Foundation.CommonParams inp, double[] Uin, double[] Uout, out double FluxInCell, out double FluxOutCell)
        {
            double h_max   = this.h_max_Edge[inp.iEdge];
            double penalty = PressureStabilizationFactor * Reynolds * h_max;

            FluxInCell  = penalty * (Uin[0] - Uout[0]);
            FluxOutCell = -FluxInCell;
        }
Esempio n. 2
0
        protected override double InnerEdgeFlux(ref BoSSS.Foundation.CommonParams inp, double[] Uin, double[] Uout)
        {
            if (basecall)
            {
                return(base.InnerEdgeFlux(ref inp, Uin, Uout));
            }
            else
            {
                double   UinBkUp       = Uin[0];
                double   UoutBkUp      = Uout[0];
                double[] InParamsBkup  = inp.Parameters_IN;
                double[] OutParamsBkup = inp.Parameters_OUT;


                // subgrid boundary handling
                // -------------------------

                if (inp.iEdge >= 0 && inp.jCellOut >= 0)
                {
                    bool CellIn  = SubGrdMask[inp.jCellIn];
                    bool CellOut = SubGrdMask[inp.jCellOut];
                    Debug.Assert(CellIn || CellOut, "at least one cell must be in the subgrid!");

                    if (CellOut == true && CellIn == false)
                    {
                        // IN-cell is outside of subgrid: extrapolate from OUT-cell!
                        Uin[0]            = Uout[0];
                        inp.Parameters_IN = inp.Parameters_OUT.CloneAs();
                    }
                    if (CellIn == true && CellOut == false)
                    {
                        // ... and vice-versa
                        Uout[0]            = Uin[0];
                        inp.Parameters_OUT = inp.Parameters_IN.CloneAs();
                    }
                }

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

                var flx = base.InnerEdgeFlux(ref inp, Uin, Uout);
                flx *= cap;

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

                Uout[0]            = UoutBkUp;
                Uin[0]             = UinBkUp;
                inp.Parameters_IN  = InParamsBkup;
                inp.Parameters_OUT = OutParamsBkup;

                return(flx);
            }
        }
Esempio n. 3
0
        /*
         *
         * // Flux over interface
         * public override void DerivativVar_LevelSetFlux(out double FlxNeg, out double FlxPos,
         *  ref CommonParams cp,
         *  double[] U_Neg, double[] U_Pos, double[,] GradU_Neg, double[,] GradU_Pos) {
         *
         *  double[] _uLevSet = new double[2];
         *
         *  //_uLevSet[0] = (uLevSet[m_d])(cp.time, cp.x);
         *
         *  for (int d = 0; d < m_D; d++) {
         *      _uLevSet[d] = (uLevSet[d])(cp.time);
         *  }
         *
         *  double[] uLevSet_temp = new double[1];
         *  uLevSet_temp[0] = (uLevSet[m_d])(cp.time);
         *
         *  BoSSS.Foundation.CommonParams inp; // = default(BoSSS.Foundation.InParams);
         *  inp.Parameters_IN = cp.ParamsNeg;
         *  inp.Normale = cp.n;
         *  inp.iEdge = int.MinValue;
         *  inp.GridDat = this.m_LsTrk.GridDat;
         *  inp.X = cp.x;
         *  inp.time = cp.time;
         *  //inp.jCellIn = cp.jCell;
         *  //inp.jCellOut = cp.jCell;
         *
         *  inp.Parameters_OUT = new double[inp.Parameters_IN.Length];
         *
         *  //Outer values for Velocity and VelocityMean
         *  for (int j = 0; j < m_D; j++) {
         *      inp.Parameters_OUT[j] = (uLevSet[j])(cp.time);
         *      // Velocity0MeanVectorOut is set to zero, i.e. always LambdaIn is used.
         *      inp.Parameters_OUT[m_D + j] = 0;
         *  }
         *
         *  //FlxNeg = -this.NegFlux.IEF(ref inp, U_Neg, uLevSet_temp);
         *
         *  FlxNeg = 0;
         *
         *  FlxPos = 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)
        {
            BoSSS.Foundation.CommonParams inp = cp; // = default(BoSSS.Foundation.InParams);
            //inp.Parameters_IN = cp.ParamsNeg;
            //inp.Normal = cp.Normal;
            //inp.iEdge = int.MinValue;
            //inp.GridDat = this.m_LsTrk.GridDat;
            //inp.X = cp.X;
            //inp.time = cp.time;
            //inp.Parameters_OUT = new double[inp.Parameters_IN.Length];

            var parameters_P = m_getParticleParams(inp.X, inp.time);

            double[] uLevSet = new double[] { parameters_P[0], parameters_P[1] };
            double   wLevSet = parameters_P[2];

            pRadius = parameters_P[3];

            double[] uLevSet_temp = new double[1];
            if (m_d == 0)
            {
                uLevSet_temp[0] = uLevSet[0] + pRadius * wLevSet * -cp.Normal[1];
            }
            else
            {
                uLevSet_temp[0] = uLevSet[1] + pRadius * wLevSet * cp.Normal[0];
            }

            //Outer values for Velocity and VelocityMean
            inp.Parameters_OUT[0] = uLevSet[0] + pRadius * wLevSet * -cp.Normal[1];
            inp.Parameters_OUT[1] = uLevSet[1] + pRadius * wLevSet * cp.Normal[0];
            // Velocity0MeanVectorOut is set to zero, i.e. always LambdaIn is used.
            inp.Parameters_OUT[2] = 0;
            inp.Parameters_OUT[3] = 0;


            double FlxNeg;

            if (m_UseMovingMesh == true)
            {
                FlxNeg = 0;

                return(FlxNeg);
            }

            FlxNeg = this.NegFlux.InnerEdgeForm(ref inp, U_Neg, uLevSet_temp, null, null, v_Neg, 0, null, null);

            //FlxNeg = this.NegFlux.InnerEdgeForm(ref inp, U_Neg, uLevSet_temp, Grad_uA, Grad_uB, v_Neg, v_Pos, Grad_vA, Grad_vB);

            return(FlxNeg);
        }
        /*
         * public override void PrimalVar_LevelSetFlux(out double FlxNeg, out double FlxPos,
         *  ref CommonParams cp,
         *  double[] U_Neg, double[] U_Pos) {
         *  FlxNeg = 0;
         *  FlxPos = 0;
         * }
         *
         * public override void FluxPotential(out double G, double[] U) {
         *  G = 0;
         * }
         *
         * public override void Nu(out double NuNeg, out double NuPos,
         *  ref CommonParams cp) {
         *  NuPos = 1.0;
         *  NuNeg = 1.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;
            {
                //double flx = 0.0;
                //for (int d = m_D - 1; d >= 0; d--)
                //    flx += cp.ParamsNeg[d] * cp.n[d];
                //flx *= U_Neg[0];
                //FlxNeg = flx;

                BoSSS.Foundation.CommonParams inp = cp;
                inp.Parameters_OUT = ParamsNegFict;

                FlxNeg = this.NegFlux.IEF(ref inp, U_Neg, U_NegFict);
            }
            // Flux for positive side
            double FlxPos;

            {
                //double flx = 0.0;
                //for (int d = m_D - 1; d >= 0; d--)
                //    flx += cp.ParamsPos[d] * cp.n[d];
                //flx *= U_Pos[0];
                //FlxPos = flx;

                BoSSS.Foundation.CommonParams inp = cp;
                inp.Parameters_IN = ParamsPosFict;

                FlxPos = this.PosFlux.IEF(ref inp, U_PosFict, U_Pos);
            }

            if (movingmesh)
            {
                return(0.0);
            }
            else
            {
                return(FlxNeg * v_Neg - FlxPos * v_Pos);
            }
        }
Esempio n. 5
0
 internal double IEF(ref BoSSS.Foundation.CommonParams inp, double[] Uin, double[] Uout)
 {
     return(this.InnerEdgeFlux(ref inp, Uin, Uout));
 }
Esempio n. 6
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);
            }
        }