Пример #1
0
        /// <summary>
        /// Integrand on boundary mesh edges of the SIP
        /// </summary>
        virtual public double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double pnlty = 2 * this.GetPenalty(inp.jCellIn, -1);//, inp.GridDat.Cells.cj);
            double nuA   = this.Nu(inp.X, inp.Parameters_IN, inp.jCellIn);

            if (this.IsDirichlet(ref inp))
            {
                // inhom. Dirichlet b.c.
                // +++++++++++++++++++++

                double g_D = this.g_Diri(ref inp);

                for (int d = 0; d < inp.D; d++)
                {
                    double nd = inp.Normal[d];
                    Acc += (nuA * _Grad_uA[0, d]) * (_vA) * nd;        // consistency
                    Acc += (nuA * _Grad_vA[d]) * (_uA[0] - g_D) * nd;  // symmetry
                }
                Acc *= this.m_alpha;

                Acc -= nuA * (_uA[0] - g_D) * (_vA - 0) * pnlty; // penalty
            }
            else
            {
                double g_N = this.g_Neum(ref inp);

                Acc += nuA * g_N * _vA * this.m_alpha;
            }
            return(Acc);
        }
Пример #2
0
        public double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double pnlty = 2 * this.mu(inp.jCellIn, -1);
            double muA   = this.Nu(inp.X, inp.Parameters_IN);

            {
                // inhom. Dirichlet b.c.
                // +++++++++++++++++++++

                double g_D = _uA[0];

                for (int d = 0; d < inp.D; d++)
                {
                    double nd = inp.Normale[d];
                    Acc += (muA * _Grad_uA[0, d]) * (_vA) * nd;
                    Acc += (muA * _Grad_vA[d]) * (_uA[0] - g_D) * nd;
                }
                Acc *= this.m_alpha;

                Acc -= muA * (_uA[0] - g_D) * (_vA - 0) * pnlty;
            }
            return(Acc);
        }
Пример #3
0
        public double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double pnlty = 2 * this.penalty(inp.jCellIn, -1);
            double muA   = Viscosity;

            if (IsDiri(inp.X, inp.Normale, inp.EdgeTag))
            {
                // inhom. Dirichlet b.c.
                // +++++++++++++++++++++

                double g_D = g_Diri(inp.X, inp.time, inp.EdgeTag);

                for (int d = 0; d < inp.D; d++)
                {
                    double nd = inp.Normale[d];
                    Acc += (muA * _Grad_uA[0, d]) * (_vA) * nd;
                    Acc += (muA * _Grad_vA[d]) * (_uA[0] - g_D) * nd;
                }

                Acc -= muA * (_uA[0] - g_D) * (_vA - 0) * pnlty;
            }
            else
            {
                // inhom. Neumann
                // ++++++++++++
                double g_N = g_Neu(inp.X, inp.Normale, inp.EdgeTag);
                Acc += muA * g_N * _vA;
            }


            return(-Acc);
        }
Пример #4
0
        protected override double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
        {
            IncompressibleBcType edgeType = bcmap.EdgeTag2Type[inp.EdgeTag];

            switch (edgeType)
            {
            case IncompressibleBcType.Wall:
            case IncompressibleBcType.Velocity_Inlet: {
                Foundation.CommonParams inp2;
                inp2.GridDat       = inp.GridDat;
                inp2.Normale       = inp.Normale;
                inp2.iEdge         = inp.iEdge;
                inp2.Parameters_IN = inp.Parameters_IN;
                inp2.X             = inp.X;
                inp2.time          = inp.time;

                // Boundary conditions scalar
                // ==========================

                inp2.Parameters_OUT = new double[2 * SpatDimension + 2];

                double ScalarOut = scalarFunction[inp.EdgeTag](inp.X, 0.0);
                inp2.Parameters_OUT[2 * SpatDimension] = scalarFunction[inp.EdgeTag](inp.X, inp.time);
                // ScalarMeanOut = ScalarMeanIn
                inp2.Parameters_OUT[2 * SpatDimension + 1] = inp.Parameters_IN[2 * SpatDimension + 1];

                // Boundary conditions velocity
                // ============================

                for (int j = 0; j < SpatDimension; j++)
                {
                    inp2.Parameters_OUT[j] = velFunction[inp.EdgeTag, j](inp.X, inp.time);
                    // VelocityMeanOut = VelocityMeanIn
                    inp2.Parameters_OUT[SpatDimension + j] = inp.Parameters_IN[SpatDimension + j];
                }

                return(InnerEdgeFlux(ref inp2, Uin, new double[] { ScalarOut }));
            }

            case IncompressibleBcType.Pressure_Outlet: {
                double r = 0.0;

                double Scalar0 = inp.Parameters_IN[2 * SpatDimension];
                double rho     = EoS.GetDensity(Scalar0);
                double Scalar  = Uin[0];

                for (int j = 0; j < SpatDimension; j++)
                {
                    double u_j = inp.Parameters_IN[j];
                    r += rho * Scalar * u_j * inp.Normale[j];
                }

                return(r);
            }

            default:
                throw new NotImplementedException("Boundary condition not implemented!");
            }
        }
Пример #5
0
        /// <summary>
        /// Integrand on boundary mesh edges of the SIP
        /// </summary>
        public override double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double pnlty = 2 * this.GetPenalty(inp.jCellIn, -1);//, inp.GridDat.Cells.cj);
            double nuA   = this.Nu(inp.X, inp.Parameters_IN, inp.jCellIn);

            if (this.IsDirichlet(ref inp))
            {
                // inhom. Dirichlet b.c.
                // +++++++++++++++++++++

                double g_D = this.g_Diri(ref inp);

                // inflow / outflow
                if (g_D != 0)
                {
                    for (int d = 0; d < inp.D; d++)
                    {
                        double nd = inp.Normal[d];
                        Acc += (nuA * _Grad_uA[0, d]) * (_vA) * nd;        // consistency
                        Acc += (nuA * _Grad_vA[d]) * (_uA[0] - g_D) * nd;  // symmetry
                    }
                    Acc *= this.m_alpha;

                    Acc -= nuA * (_uA[0] - g_D) * (_vA - 0) * pnlty; // penalty
                }
                else
                {
                    for (int d = 0; d < inp.D; d++)
                    {
                        double nd = inp.Normal[d];
                        //Acc += (nuA * _Grad_uA[0, d]) * (_vA) * nd;        // consistency
                        //Acc += (nuA * 0.0) * (_vA) * nd;        // consistency Neumann
                    }

                    //double D0 = 1.0;
                    //Acc -= (nuA * _vA) * D0 * (_uA[0]-inp.Parameters_IN[inp.D])/ 0.01;        // Outflow boundary condition see S. Dong

                    Acc *= this.m_alpha;
                }
            }
            else
            {
                double g_N = this.g_Neum(ref inp);

                Acc += nuA * g_N * _vA * this.m_alpha;
            }
            return(Acc);
        }
Пример #6
0
        public double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double        pnlty   = 2 * this.penalty(inp.jCellIn, -1);//, inp.GridDat.Cells.cj);
            double        muA     = this.Conductivity(inp.Parameters_IN);
            ThermalBcType edgType = this.EdgeTag2Type[inp.EdgeTag];

            switch (edgType)
            {
            case ThermalBcType.Dirichlet: {
                // inhom. Dirichlet b.c.
                // +++++++++++++++++++++

                double g_D = this.g_Diri(inp.X, inp.time, inp.EdgeTag, 0);

                for (int d = 0; d < inp.D; d++)
                {
                    double nd = inp.Normale[d];
                    Acc += (muA * _Grad_uA[0, d]) * (_vA) * nd;
                    Acc += (muA * _Grad_vA[d]) * (_uA[0] - g_D) * nd;
                }
                Acc *= this.m_alpha;

                Acc -= muA * (_uA[0] - g_D) * (_vA - 0) * pnlty;
                break;
            }

            case ThermalBcType.ZeroGradient: {
                for (int d = 0; d < inp.D; d++)
                {
                    double nd = inp.Normale[d];
                    Acc += (muA * _Grad_uA[0, d]) * (_vA) * nd;
                    //Acc += (muA * _Grad_vA[d]) * (_uA[0] - g_D) * nd;
                }
                Acc *= this.m_alpha;

                //Acc -= muA * (_uA[0] - g_D) * (_vA - 0) * pnlty;
                break;
            }

            default:
                throw new NotImplementedException();
            }

            return(-Acc);
        }
Пример #7
0
        protected override double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
        {
            //switch (m_varMode) {
            //    case EquationAndVarMode.u_p_2:
            //    case EquationAndVarMode.mom_p:
            return(base.BorderEdgeFlux(ref inp, Uin));

            //    case EquationAndVarMode.u_p:
            //    return base.BorderEdgeFlux(ref inp, Uin)*oneOverRho;

            //    case EquationAndVarMode.u_Psi:
            //    Uin[0] /= oneOverRho;
            //    return base.BorderEdgeFlux(ref inp, Uin)*oneOverRho;

            //    default:
            //    throw new NotImplementedException();
            //}
        }
Пример #8
0
 protected override double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
 {
     return(Uin[0] * inp.Normal[0] * m_factor);
 }
Пример #9
0
 /// <summary>
 /// true if the actual node (<paramref name="inp"/>, see <see cref="BoSSS.Foundation.InParams.X"/>),
 /// at which the flux is evaluated
 /// is in the Dirichlet domain
 /// </summary>
 /// <returns>
 /// if true, the actual node is assumed to be a Dirichlet boundary: <see cref="g_Diri"/>; <br/>
 /// if false, the actual node is assumed to be a Neumann boundary: <see cref="g_Neum"/>; <br/>
 /// </returns>
 protected abstract bool IsDirichlet(ref Foundation.CommonParamsBnd inp);
Пример #10
0
        protected override double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
        {
            double res = 0.0;

            IncompressibleBcType edgeType = Bcmap.EdgeTag2Type[inp.EdgeTag];

            switch (edgeType)
            {
            case IncompressibleBcType.Wall:
            case IncompressibleBcType.NoSlipNeumann: {
                res = 0.0;
                break;
            }

            case IncompressibleBcType.Velocity_Inlet: {
                double TemperatureOut = 0.0;
                double Uout           = VelFunction[inp.EdgeTag](inp.X, inp.time);
                switch (Bcmap.PhysMode)
                {
                case PhysicsMode.LowMach:
                case PhysicsMode.Multiphase: {
                    // opt1:
                    TemperatureOut = Bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    res            = EoS.GetDensity(TemperatureOut) * Uout * inp.Normal[Component];
                    // opt2:
                    //double TemperatureIN = inp.Parameters_IN[0];
                    //double rhoIn = EoS.GetDensity(TemperatureIN);
                    //res = rhoIn * Uout * inp.Normale[Component];
                    break;
                }

                case PhysicsMode.Combustion:
                    // opt1:
                    TemperatureOut = Bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    double[] args = new double[NumberOfReactants + 1];
                    args[0] = TemperatureOut;
                    for (int n = 1; n < NumberOfReactants + 1; n++)
                    {
                        args[n] = Bcmap.bndFunction[VariableNames.MassFraction_n(n - 1)][inp.EdgeTag](inp.X, inp.time);
                    }
                    res = EoS.GetDensity(args) * Uout * inp.Normal[Component];
                    break;

                case PhysicsMode.Incompressible:
                    res = Uout * inp.Normal[Component];
                    break;

                default:
                    throw new ApplicationException("PhysicsMode not implemented");
                }
            }
            break;

            case IncompressibleBcType.Pressure_Outlet: {
                switch (Bcmap.PhysMode)
                {
                case PhysicsMode.Incompressible:
                    res = Uin[0] * inp.Normal[Component];
                    break;

                case PhysicsMode.LowMach:
                case PhysicsMode.Multiphase:
                    res = EoS.GetDensity(inp.Parameters_IN[0]) * Uin[0] * inp.Normal[Component];
                    break;

                case PhysicsMode.Combustion:
                    res = EoS.GetDensity(inp.Parameters_IN) * Uin[0] * inp.Normal[Component];
                    break;

                default:
                    throw new ApplicationException("PhysicsMode not implemented");
                }
            }
            break;

            default:
                throw new NotImplementedException("Boundary condition not implemented!");
            }

            return(res);
        }
Пример #11
0
        double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
        {
            double res = 0.0;

            IncompressibleBcType edgeType = Bcmap.EdgeTag2Type[inp.EdgeTag];

            double[] DensityArgumentsIn;
            switch (edgeType)
            {
            case IncompressibleBcType.Wall:
            case IncompressibleBcType.NoSlipNeumann:
                res = 0.0;
                break;

            case IncompressibleBcType.Velocity_Inlet: {
                double TemperatureOut = 0.0;
                double Uout           = VelFunction[inp.EdgeTag](inp.X, inp.time);
                switch (Bcmap.PhysMode)
                {
                case PhysicsMode.Incompressible:
                    res = Uout * inp.Normal[Component];
                    break;

                case PhysicsMode.MixtureFraction:
                    // opt1:
                    double Zout = Bcmap.bndFunction[VariableNames.MixtureFraction][inp.EdgeTag](inp.X, inp.time);
                    res = EoS.getDensityFromZ(Zout) * Uout * inp.Normal[Component];
                    break;

                case PhysicsMode.LowMach:
                case PhysicsMode.Multiphase: {
                    // opt1:
                    TemperatureOut = Bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    res            = EoS.GetDensity(TemperatureOut) * Uout * inp.Normal[Component];
                    // opt2:
                    //double TemperatureIN = inp.Parameters_IN[0];
                    //double rhoIn = EoS.GetDensity(TemperatureIN);
                    //res = rhoIn * Uout * inp.Normale[Component];
                    break;
                }

                case PhysicsMode.Combustion: {
                    // opt1:
                    TemperatureOut = Bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    double[] argsa = new double[NumberOfSpecies - 1 + 1];
                    argsa[0] = TemperatureOut;
                    for (int n = 1; n < NumberOfSpecies; n++)
                    {
                        argsa[n] = Bcmap.bndFunction[VariableNames.MassFraction_n(n - 1)][inp.EdgeTag](inp.X, inp.time);
                    }
                    res = EoS.GetDensity(argsa) * Uout * inp.Normal[Component];
                    break;
                }

                default:
                    throw new ApplicationException("PhysicsMode not implemented");
                }
            }
            break;

            case IncompressibleBcType.Pressure_Dirichlet:
            case IncompressibleBcType.Pressure_Outlet: {
                switch (Bcmap.PhysMode)
                {
                case PhysicsMode.Incompressible:
                    res = Uin[Component] * inp.Normal[Component];
                    break;

                case PhysicsMode.MixtureFraction:
                    double Zin = Uin[inp.D];
                    res = EoS.getDensityFromZ(Zin) * Uin[Component] * inp.Normal[Component];
                    break;

                case PhysicsMode.LowMach:
                case PhysicsMode.Multiphase:
                    DensityArgumentsIn = Uin.GetSubVector(m_SpatialDimension, 1);             // Only TemperatureIn
                    res = EoS.GetDensity(DensityArgumentsIn) * Uin[Component] * inp.Normal[Component];
                    break;

                case PhysicsMode.Combustion:
                    DensityArgumentsIn = Uin.GetSubVector(m_SpatialDimension, NumberOfSpecies);
                    res = EoS.GetDensity(DensityArgumentsIn) * Uin[Component] * inp.Normal[Component];
                    break;

                default:
                    throw new ApplicationException("PhysicsMode not implemented");
                }
            }
            break;

            default:
                throw new NotImplementedException("Boundary condition not implemented!");
            }

            return(res);
        }
Пример #12
0
        public override double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double pnlty = 2 * this.penalty(inp.jCellIn, -1);//, inp.GridDat.Cells.cj);
            double muA   = this.Viscosity(inp.Parameters_IN);
            IncompressibleBcType edgType = base.EdgeTag2Type[inp.EdgeTag];

            switch (edgType)
            {
            case IncompressibleBcType.Velocity_Inlet:
            case IncompressibleBcType.Wall:
            case IncompressibleBcType.NoSlipNeumann: {
                // inhom. Dirichlet b.c.
                // +++++++++++++++++++++
                double g_D = this.g_Diri(inp.X, inp.time, inp.EdgeTag, base.m_iComp);

                for (int i = 0; i < inp.D; i++)
                {
                    // consistency
                    Acc += (muA * _Grad_uA[i, m_iComp]) * (_vA) * inp.Normale[i];
                    // symmetry
                    switch (ViscSolverMode)
                    {
                    case ViscositySolverMode.FullyCoupled:
                        Acc += (muA * _Grad_vA[i]) * (_uA[i] - this.g_Diri(inp.X, inp.time, inp.EdgeTag, i)) * inp.Normale[m_iComp];
                        break;

                    case ViscositySolverMode.Segregated:
                        if (i == m_iComp)
                        {
                            Acc += (muA * _Grad_vA[i]) * (_uA[i] - this.g_Diri(inp.X, inp.time, inp.EdgeTag, i)) * inp.Normale[m_iComp];
                        }
                        break;

                    default:
                        throw new NotImplementedException();
                    }
                }
                Acc *= base.m_alpha;

                // penalty
                Acc -= muA * (_uA[m_iComp] - this.g_Diri(inp.X, inp.time, inp.EdgeTag, base.m_iComp)) * (_vA - 0) * pnlty;

                break;
            }

            case IncompressibleBcType.FreeSlip:
            case IncompressibleBcType.SlipSymmetry: {
                int    D = inp.D;
                double g_D;

                for (int dN = 0; dN < D; dN++)
                {
                    for (int dD = 0; dD < D; dD++)
                    {
                        // consistency
                        Acc += muA * (inp.Normale[dN] * _Grad_uA[dD, dN] * inp.Normale[dD]) * (_vA * inp.Normale[m_iComp]) * base.m_alpha;
                        // symmetry
                        switch (ViscSolverMode)
                        {
                        case ViscositySolverMode.FullyCoupled:
                            g_D  = this.g_Diri(inp.X, inp.time, inp.EdgeTag, dD);
                            Acc += muA * (inp.Normale[dN] * _Grad_vA[dN] * inp.Normale[m_iComp]) * (_uA[dD] - g_D) * inp.Normale[dD] * base.m_alpha;
                            break;

                        case ViscositySolverMode.Segregated:
                        default:
                            throw new NotImplementedException();
                        }
                    }
                    g_D = this.g_Diri(inp.X, inp.time, inp.EdgeTag, dN);
                    // penalty
                    Acc -= muA * ((_uA[dN] - g_D) * inp.Normale[dN]) * ((_vA - 0) * inp.Normale[m_iComp]) * pnlty;
                }

                break;
            }

            case IncompressibleBcType.NavierSlip_Linear: {
                double ls = Lslip[inp.jCellIn];
                if (ls == 0.0)
                {
                    goto case IncompressibleBcType.Velocity_Inlet;
                }
                else
                {
                    goto case IncompressibleBcType.FreeSlip;
                }
            }
            //case IncompressibleBcType.NavierSlip_localized: {

            //        double ls = Lslip[inp.jCellIn];
            //        if(ls > 0.0) {
            //            m_beta = muA / ls;
            //            goto case IncompressibleBcType.NavierSlip_Linear;
            //        } else {
            //            goto case IncompressibleBcType.Velocity_Inlet;
            //        }
            //    }
            case IncompressibleBcType.Pressure_Dirichlet:
            case IncompressibleBcType.Outflow:
            case IncompressibleBcType.Pressure_Outlet: {
                if (base.g_Neu_Override == null)
                {
                    // Inner values of velocity gradient are taken, i.e.
                    // no boundary condition for the velocity (resp. velocity gradient) is imposed.
                    for (int i = 0; i < inp.D; i++)
                    {
                        Acc += (muA * _Grad_uA[i, m_iComp]) * (_vA) * inp.Normale[i];
                    }
                }
                else
                {
                    double g_N = g_Neu(inp.X, inp.Normale, inp.EdgeTag);
                    Acc += muA * g_N * _vA;
                }
                Acc *= base.m_alpha;

                break;
            }

            default:
                throw new NotSupportedException();
            }

            return(-Acc);
        }
Пример #13
0
        public override double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double pnlty = 2 * this.penalty(inp.jCellIn, -1);//, inp.GridDat.Cells.cj);
            double muA   = this.Viscosity(inp.Parameters_IN);
            IncompressibleBcType edgType = base.EdgeTag2Type[inp.EdgeTag];

            switch (edgType)
            {
            case IncompressibleBcType.Velocity_Inlet:
            case IncompressibleBcType.Wall:
            case IncompressibleBcType.NoSlipNeumann: {
                // inhom. Dirichlet b.c.
                // +++++++++++++++++++++

                double g_D = base.g_Diri(inp.X, inp.time, inp.EdgeTag, m_iComp);

                for (int d = 0; d < inp.D; d++)
                {
                    double nd = inp.Normale[d];
                    //Acc += (muA * _Grad_uA[0, d]) * (_vA) * nd;
                    //Acc += (muA * _Grad_vA[d]) * (_uA[0] - g_D) * nd;
                    Acc += (muA * _Grad_uA[m_iComp, d]) * (_vA) * nd;
                    Acc += (muA * _Grad_vA[d]) * (_uA[m_iComp] - g_D) * nd;
                }
                Acc *= base.m_alpha;

                //Acc -= muA * (_uA[0] - g_D) * (_vA - 0) * pnlty;
                Acc -= muA * (_uA[m_iComp] - g_D) * (_vA - 0) * pnlty;
                break;
            }

            case IncompressibleBcType.FreeSlip:
            case IncompressibleBcType.SlipSymmetry: {
                int    D = inp.D;
                double g_D;

                for (int dN = 0; dN < D; dN++)
                {
                    g_D = base.g_Diri(inp.X, inp.time, inp.EdgeTag, dN);

                    for (int dD = 0; dD < D; dD++)
                    {
                        // consistency
                        Acc += muA * (inp.Normale[dN] * _Grad_uA[dN, dD] * inp.Normale[dD]) * (_vA * inp.Normale[m_iComp]) * base.m_alpha;
                        // symmetry
                        Acc += muA * (inp.Normale[m_iComp] * _Grad_vA[dD] * inp.Normale[dD]) * (_uA[dN] - g_D) * inp.Normale[dN] * base.m_alpha;
                    }

                    // penalty
                    Acc -= muA * ((_uA[dN] - g_D) * inp.Normale[dN]) * ((_vA - 0) * inp.Normale[m_iComp]) * pnlty;
                }
                break;
            }

            case IncompressibleBcType.NavierSlip_Linear: {
                double ls = Lslip[inp.jCellIn];
                if (ls == 0.0)
                {
                    goto case IncompressibleBcType.Velocity_Inlet;
                }

                if (ls > 0)
                {
                    m_beta = muA / ls;
                }

                int    D = inp.D;
                double g_D;

                for (int dN = 0; dN < D; dN++)
                {
                    g_D = base.g_Diri(inp.X, inp.time, inp.EdgeTag, dN);

                    for (int dD = 0; dD < D; dD++)
                    {
                        // consistency
                        Acc += muA * (inp.Normale[dN] * _Grad_uA[dN, dD] * inp.Normale[dD]) * (_vA * inp.Normale[m_iComp]) * base.m_alpha;
                        // symmetry
                        Acc += muA * (inp.Normale[m_iComp] * _Grad_vA[dD] * inp.Normale[dD]) * (_uA[dN] - g_D) * inp.Normale[dN] * base.m_alpha;
                    }

                    // penalty
                    Acc -= muA * ((_uA[dN] - g_D) * inp.Normale[dN]) * ((_vA - 0) * inp.Normale[m_iComp]) * pnlty;
                }


                double[,] P = new double[D, D];
                for (int d1 = 0; d1 < D; d1++)
                {
                    for (int d2 = 0; d2 < D; d2++)
                    {
                        double nn = inp.Normale[d1] * inp.Normale[d2];
                        if (d1 == d2)
                        {
                            P[d1, d2] = 1 - nn;
                        }
                        else
                        {
                            P[d1, d2] = -nn;
                        }
                    }
                }

                // tangential dissipation force term
                for (int d1 = 0; d1 < D; d1++)
                {
                    for (int d2 = 0; d2 < D; d2++)
                    {
                        g_D  = base.g_Diri(inp.X, inp.time, inp.EdgeTag, d2);
                        Acc -= (m_beta * P[d1, d2] * (_uA[d2] - g_D)) * (P[d1, m_iComp] * _vA) * base.m_alpha;
                    }
                }

                break;
            }
            //case IncompressibleBcType.NavierSlip_localized: {

            //    double ls = Lslip[inp.jCellIn];
            //    if(ls > 0.0) {
            //        m_beta = muA / ls;
            //        goto case IncompressibleBcType.NavierSlip_Linear;
            //    } else {
            //        goto case IncompressibleBcType.Velocity_Inlet;
            //    }
            //}
            case IncompressibleBcType.Outflow:
            case IncompressibleBcType.Pressure_Outlet: {
                // Atmospheric outlet/pressure outflow: hom. Neumann
                // +++++++++++++++++++++++++++++++++++++++++++++++++
                double g_N = g_Neu(inp.X, inp.Normale, inp.EdgeTag);

                Acc += muA * g_N * _vA * base.m_alpha;

                break;
            }

            case IncompressibleBcType.Pressure_Dirichlet: {
                // Dirichlet boundary condition for pressure.
                // Inner values of velocity gradient are taken, i.e.
                // no boundary condition for the velocity (resp. velocity gradient) is imposed.

                for (int d = 0; d < inp.D; d++)
                {
                    //Acc += (muA * _Grad_uA[0, d]) * (_vA) * inp.Normale[d];
                    Acc += (muA * _Grad_uA[m_iComp, d]) * (_vA) * inp.Normale[d];
                }
                Acc *= base.m_alpha;

                break;
            }

            default:
                throw new NotImplementedException();
            }

            return(-Acc);
        }
Пример #14
0
        /// <summary>
        /// flux at the boundary
        /// </summary>
        double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
        {
            IncompressibleBcType edgeType = m_bcmap.EdgeTag2Type[inp.EdgeTag];

            switch (edgeType)
            {
            case IncompressibleBcType.Wall: {
                if ((edgeType == IncompressibleBcType.Wall) && (m_bcmap.PhysMode == PhysicsMode.Multiphase))
                {
                    throw new ApplicationException("Use NoSlipNeumann boundary condition for multiphase flows instead of Wall.");
                }

                double r = 0.0;
                // Setup params
                // ============
                Foundation.CommonParams inp2;
                inp2.GridDat       = inp.GridDat;
                inp2.Normal        = inp.Normal;
                inp2.iEdge         = inp.iEdge;
                inp2.Parameters_IN = inp.Parameters_IN;
                inp2.X             = inp.X;
                inp2.time          = inp.time;
                inp2.jCellIn       = inp.jCellIn;
                inp2.jCellOut      = int.MinValue;

                // Boundary values for Parameters
                // ==============================
                inp2.Parameters_OUT = new double[inp.Parameters_IN.Length];

                // Dirichlet values for scalars and Velocities
                // ==========================
                double[] Uout = new double[Uin.Length];
                //Velocity
                for (int i = 0; i < m_SpatialDimension; i++)
                {
                    Uout[i] = m_bcmap.bndFunction[VariableNames.Velocity_d(i)][inp.EdgeTag](inp.X, inp.time);
                }

                switch (m_bcmap.PhysMode)
                {
                case PhysicsMode.MixtureFraction:
                    // opt1:
                    //inp2.Parameters_OUT = inp.Parameters_IN;
                    Uout[m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.MixtureFraction][inp.EdgeTag](inp.X, inp.time);
                    break;

                case PhysicsMode.LowMach: {
                    Uout[m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    break;
                }

                case PhysicsMode.Combustion: {
                    // opt1: (using Dirichlet values)
                    Uout[m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    for (int n = 1; n < NumberOfReactants - 1 + 1; n++)
                    {
                        //Using inner values for species
                        Uout[m_SpatialDimension + n] = Uin[m_SpatialDimension + n];
                    }
                    break;
                }

                case PhysicsMode.Multiphase:
                    break;

                default:
                    throw new NotImplementedException();
                }
                // Calculate BorderEdgeFlux as InnerEdgeFlux
                // =========================================

                r = InnerEdgeFlux(ref inp2, Uin, Uout);
                if (double.IsNaN(r))
                {
                    throw new NotFiniteNumberException();
                }
                return(r);
            }

            case IncompressibleBcType.Velocity_Inlet: {
                if ((edgeType == IncompressibleBcType.Wall) && (m_bcmap.PhysMode == PhysicsMode.Multiphase))
                {
                    throw new ApplicationException("Use NoSlipNeumann boundary condition for multiphase flows instead of Wall.");
                }

                double r = 0.0;

                // Setup params
                // ============
                Foundation.CommonParams inp2;
                inp2.GridDat       = inp.GridDat;
                inp2.Normal        = inp.Normal;
                inp2.iEdge         = inp.iEdge;
                inp2.Parameters_IN = inp.Parameters_IN;
                inp2.X             = inp.X;
                inp2.time          = inp.time;
                inp2.jCellIn       = inp.jCellIn;
                inp2.jCellOut      = int.MinValue;

                // Boundary values for Parameters
                // ==============================
                inp2.Parameters_OUT = new double[inp.Parameters_IN.Length];
                double[] Uout = new double[Uin.Length];

                // Velocity
                for (int j = 0; j < m_SpatialDimension; j++)
                {
                    // opt1:
                    Uout[j] = m_bcmap.bndFunction[VariableNames.Velocity_d(j)][inp.EdgeTag](inp.X, inp.time);
                }

                // Skalar (e.g. temperature or MassFraction)
                switch (m_bcmap.PhysMode)
                {
                case PhysicsMode.MixtureFraction: {
                    // opt1:
                    Uout[m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.MixtureFraction][inp.EdgeTag](inp.X, inp.time);
                    break;
                }

                case PhysicsMode.LowMach: {
                    // opt1:
                    Uout[m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    // opt2: inner values
                    //inp2.Parameters_OUT[2 * m_SpatialDimension] = inp2.Parameters_IN[2 * m_SpatialDimension];
                    break;
                }

                case PhysicsMode.Combustion: {
                    // opt1: (using Dirichlet values)
                    Uout[m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    for (int n = 1; n < NumberOfReactants; n++)
                    {
                        // opt1: (using Dirichlet values)
                        Uout[m_SpatialDimension + n] = m_bcmap.bndFunction[VariableNames.MassFraction_n(n - 1)][inp.EdgeTag](inp.X, inp.time);
                    }
                    break;
                }

                case PhysicsMode.Multiphase:
                    break;

                default:
                    throw new NotImplementedException();
                }


                // Calculate BorderEdgeFlux as InnerEdgeFlux
                // =========================================
                r = InnerEdgeFlux(ref inp2, Uin, Uout);
                if (double.IsNaN(r))
                {
                    throw new NotFiniteNumberException();
                }
                return(r);
            }

            case IncompressibleBcType.Pressure_Dirichlet:
            case IncompressibleBcType.Outflow:
            case IncompressibleBcType.Pressure_Outlet:
            case IncompressibleBcType.NoSlipNeumann: {
                double r = 0.0;
                double u1, u2, u3 = 0;

                u1 = Uin[0];
                u2 = Uin[1];

                r += Uin[argumentIndex] * (u1 * inp.Normal[0] + u2 * inp.Normal[1]);
                if (m_SpatialDimension == 3)
                {
                    u3 = Uin[2];
                    r += Uin[argumentIndex] * u3 * inp.Normal[2];
                }
                double rho = 1.0;
                switch (m_bcmap.PhysMode)
                {
                case PhysicsMode.Incompressible:
                    break;

                case PhysicsMode.MixtureFraction:
                    rho = EoS.getDensityFromZ(Uin[inp.D]);
                    break;

                case PhysicsMode.LowMach:
                    rho = EoS.GetDensity(Uin[argumentIndex]);
                    break;

                case PhysicsMode.Combustion:
                    double[] args = ArrayTools.GetSubVector(Uin, m_SpatialDimension, NumberOfReactants - 1 + 1);
                    rho = EoS.GetDensity(args);
                    break;

                default:
                    throw new NotImplementedException("not implemented physmode");
                }
                r *= rho;

                if (double.IsNaN(r))
                {
                    throw new NotFiniteNumberException();
                }
                return(r);
            }

            default:
                throw new NotImplementedException("Boundary condition not implemented!");
            }
        }
Пример #15
0
        public override double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double pnlty = 2 * this.penalty(inp.jCellIn, -1);//, inp.GridDat.Cells.cj);
            double muA   = this.Viscosity(inp.Parameters_IN);
            IncompressibleBcType edgType = base.EdgeTag2Type[inp.EdgeTag];

            switch (edgType)
            {
            case IncompressibleBcType.Velocity_Inlet:
            case IncompressibleBcType.Wall:
            case IncompressibleBcType.NoSlipNeumann: {
                // inhom. Dirichlet b.c.
                // +++++++++++++++++++++
                double g_D = this.g_Diri(inp.X, inp.time, inp.EdgeTag, base.m_iComp);

                for (int i = 0; i < inp.D; i++)
                {
                    // consistency
                    Acc += (muA * _Grad_uA[i, i]) * (_vA) * inp.Normale[m_iComp];
                    // symmetry
                    switch (ViscSolverMode)
                    {
                    case ViscositySolverMode.FullyCoupled:
                        Acc += (muA * _Grad_vA[m_iComp]) * (_uA[i] - this.g_Diri(inp.X, inp.time, inp.EdgeTag, i)) * inp.Normale[i];
                        break;

                    case ViscositySolverMode.Segregated:
                        if (i == m_iComp)
                        {
                            Acc += (muA * _Grad_vA[m_iComp]) * (_uA[i] - this.g_Diri(inp.X, inp.time, inp.EdgeTag, i)) * inp.Normale[i];
                        }
                        break;

                    default:
                        throw new NotImplementedException();
                    }
                }
                Acc *= base.m_alpha;

                // penalty
                Acc -= muA * (_uA[m_iComp] - this.g_Diri(inp.X, inp.time, inp.EdgeTag, base.m_iComp)) * (_vA - 0) * pnlty;

                break;
            }

            case IncompressibleBcType.Pressure_Dirichlet:
            case IncompressibleBcType.Outflow:
            case IncompressibleBcType.Pressure_Outlet: {
                if (base.g_Neu_Override == null)
                {
                    // Inner values of velocity gradient are taken, i.e.
                    // no boundary condition for the velocity (resp. velocity gradient) is imposed.
                    for (int i = 0; i < inp.D; i++)
                    {
                        Acc += (muA * _Grad_uA[i, i]) * (_vA) * inp.Normale[m_iComp];
                    }
                }
                else
                {
                    double g_N = g_Neu(inp.X, inp.Normale, inp.EdgeTag);
                    Acc += muA * g_N * _vA;
                }
                Acc *= base.m_alpha;

                break;
            }

            default:
                throw new NotSupportedException();
            }

            return(Acc * (2.0 / 3.0));
        }
Пример #16
0
 public double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
 {
     return(0.0);
 }
 /// <summary>
 /// flux at the boundary
 /// </summary>
 protected abstract double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin);
Пример #18
0
 protected override double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
 {
     return(base.BorderEdgeFlux(ref inp, Uin));
 }
Пример #19
0
        /// <summary>
        /// flux at the boundary
        /// </summary>
        protected override double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
        {
            IncompressibleBcType edgeType = m_bcmap.EdgeTag2Type[inp.EdgeTag];

            switch (edgeType)
            {
            case IncompressibleBcType.Wall:
            case IncompressibleBcType.Velocity_Inlet: {
                if ((edgeType == IncompressibleBcType.Wall) && (m_bcmap.PhysMode == PhysicsMode.Multiphase))
                {
                    throw new ApplicationException("Use NoSlipNeumann boundary condition for multiphase flows instead of Wall.");
                }

                double r = 0.0;

                // Setup params
                // ============
                Foundation.CommonParams inp2;
                inp2.GridDat       = inp.GridDat;
                inp2.Normal        = inp.Normal;
                inp2.iEdge         = inp.iEdge;
                inp2.Parameters_IN = inp.Parameters_IN;
                inp2.X             = inp.X;
                inp2.time          = inp.time;
                inp2.jCellIn       = inp.jCellIn;
                inp2.jCellOut      = int.MinValue;

                // Dirichlet value for scalar
                // ==========================
                double Uout = scalarFunction[inp.EdgeTag](inp.X, inp.time);

                // Boundary values for Parameters
                // ==============================
                inp2.Parameters_OUT = new double[inp.Parameters_IN.Length];

                // Velocity
                for (int j = 0; j < m_SpatialDimension; j++)
                {
                    // opt1:
                    inp2.Parameters_OUT[j] = velFunction[j][inp.EdgeTag](inp.X, inp.time);
                    // opt2: inner values
                    //inp2.Parameters_OUT[j] = inp2.Parameters_IN[j];
                    // Velocity0MeanVectorOut is set to zero, i.e. always LambdaIn is used.
                    inp2.Parameters_OUT[m_SpatialDimension + j] = 0.0;
                }

                // Temperature
                switch (m_bcmap.PhysMode)
                {
                case PhysicsMode.LowMach: {
                    // opt1:
                    inp2.Parameters_OUT[2 * m_SpatialDimension] = scalarFunction[inp.EdgeTag](inp.X, inp.time);
                    // opt2: inner values
                    //inp2.Parameters_OUT[2 * m_SpatialDimension] = inp2.Parameters_IN[2 * m_SpatialDimension];
                    // Use inner value for TemperatureMean, i.e. LambdaIn is used.
                    inp2.Parameters_OUT[2 * m_SpatialDimension + 1] = inp.Parameters_IN[2 * m_SpatialDimension + 1];
                    break;
                }

                case PhysicsMode.Multiphase:
                case PhysicsMode.RANS:
                    break;

                default:
                    throw new NotImplementedException();
                }

                // Calculate BorderEdgeFlux as InnerEdgeFlux
                // =========================================
                r = InnerEdgeFlux(ref inp2, Uin, new double[] { Uout });

                return(r);
            }

            case IncompressibleBcType.Pressure_Dirichlet:
            case IncompressibleBcType.Outflow:
            case IncompressibleBcType.Pressure_Outlet:
            case IncompressibleBcType.NoSlipNeumann: {
                double r = 0.0;
                double u1, u2, u3 = 0, phi;

                phi = Uin[0];
                u1  = inp.Parameters_IN[0];
                u2  = inp.Parameters_IN[1];

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

                if (m_bcmap.PhysMode == PhysicsMode.LowMach)
                {
                    double rho = EoS.GetDensity(inp.Parameters_IN[2 * m_SpatialDimension]);
                    r *= rho;
                }

                return(r);
            }

            default:
                throw new NotImplementedException("Boundary condition not implemented!");
            }
        }
Пример #20
0
 /// <summary>
 /// Neumann boundary value
 /// </summary>
 virtual protected double g_Neum(ref Foundation.CommonParamsBnd inp)
 {
     return(0);
 }
Пример #21
0
 abstract public double BoundaryEdgeForm(ref Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA);
Пример #22
0
 protected override double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
 {
     return(-alpha * Uin[0] * inp.Normale[0]);
 }
Пример #23
0
        /// <summary>
        /// flux at the boundary
        /// </summary>
        protected override double BorderEdgeFlux(ref Foundation.CommonParamsBnd inp, double[] Uin)
        {
            IncompressibleBcType edgeType = m_bcmap.EdgeTag2Type[inp.EdgeTag];

            switch (edgeType)
            {
            case IncompressibleBcType.Wall: {
                if ((edgeType == IncompressibleBcType.Wall) && (m_bcmap.PhysMode == PhysicsMode.Multiphase))
                {
                    throw new ApplicationException("Use NoSlipNeumann boundary condition for multiphase flows instead of Wall.");
                }

                double r = 0.0;

                // Setup params
                // ============
                Foundation.CommonParams inp2;
                inp2.GridDat       = inp.GridDat;
                inp2.Normal        = inp.Normal;
                inp2.iEdge         = inp.iEdge;
                inp2.Parameters_IN = inp.Parameters_IN;
                inp2.X             = inp.X;
                inp2.time          = inp.time;
                inp2.jCellIn       = inp.jCellIn;
                inp2.jCellOut      = int.MinValue;

                // Boundary values for Parameters
                // ==============================
                inp2.Parameters_OUT = new double[inp.Parameters_IN.Length];

                // Velocity
                for (int j = 0; j < m_SpatialDimension; j++)
                {
                    // opt1:
                    inp2.Parameters_OUT[j] = m_bcmap.bndFunction[VariableNames.Velocity_d(j)][inp.EdgeTag](inp.X, inp.time);
                    // opt2: inner values
                    //inp2.Parameters_OUT[j] = inp2.Parameters_IN[j];
                    // Velocity0MeanVectorOut is set to zero, i.e. always LambdaIn is used.
                    inp2.Parameters_OUT[m_SpatialDimension + j] = 0.0;
                }

                // Skalar (e.g. temperature or MassFraction)
                switch (m_bcmap.PhysMode)
                {
                case PhysicsMode.LowMach: {
                    // opt1:
                    inp2.Parameters_OUT[2 * m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    // opt2: inner values
                    //inp2.Parameters_OUT[2 * m_SpatialDimension] = inp2.Parameters_IN[2 * m_SpatialDimension];
                    // Use inner value for TemperatureMean, i.e. LambdaIn is used.
                    inp2.Parameters_OUT[2 * m_SpatialDimension + 1] = inp.Parameters_IN[2 * m_SpatialDimension + 1];
                    break;
                }

                case PhysicsMode.Combustion: {
                    // opt1: (using Dirichlet values)
                    inp2.Parameters_OUT[2 * m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    for (int n = 1; n < NumberOfReactants + 1; n++)
                    {
                        //Using inner values
                        inp2.Parameters_OUT[2 * m_SpatialDimension + n] = inp.Parameters_IN[2 * m_SpatialDimension + n];
                    }
                    for (int n = 0; n < NumberOfReactants + 1; n++)
                    {
                        // Use inner value for mean scalar input parameters, i.e. LambdaIn is used.
                        inp2.Parameters_OUT[2 * m_SpatialDimension + NumberOfReactants + 1 + n] = inp.Parameters_IN[2 * m_SpatialDimension + NumberOfReactants + 1 + n];
                    }
                    break;
                }

                case PhysicsMode.Multiphase:
                    break;

                default:
                    throw new NotImplementedException();
                }

                // Dirichlet value for scalar
                // ==========================
                double[] Uout = new double[] { m_bcmap.bndFunction[Argument][inp.EdgeTag](inp.X, inp.time) };

                // Calculate BorderEdgeFlux as InnerEdgeFlux
                // =========================================
                r = InnerEdgeFlux(ref inp2, Uin, Uout);
                if (double.IsNaN(r))
                {
                    throw new NotFiniteNumberException();
                }
                return(r);
            }

            case IncompressibleBcType.Velocity_Inlet: {
                if ((edgeType == IncompressibleBcType.Wall) && (m_bcmap.PhysMode == PhysicsMode.Multiphase))
                {
                    throw new ApplicationException("Use NoSlipNeumann boundary condition for multiphase flows instead of Wall.");
                }

                double r = 0.0;

                // Setup params
                // ============
                Foundation.CommonParams inp2;
                inp2.GridDat       = inp.GridDat;
                inp2.Normal        = inp.Normal;
                inp2.iEdge         = inp.iEdge;
                inp2.Parameters_IN = inp.Parameters_IN;
                inp2.X             = inp.X;
                inp2.time          = inp.time;
                inp2.jCellIn       = inp.jCellIn;
                inp2.jCellOut      = int.MinValue;

                // Boundary values for Parameters
                // ==============================
                inp2.Parameters_OUT = new double[inp.Parameters_IN.Length];

                // Velocity
                for (int j = 0; j < m_SpatialDimension; j++)
                {
                    // opt1:
                    inp2.Parameters_OUT[j] = m_bcmap.bndFunction[VariableNames.Velocity_d(j)][inp.EdgeTag](inp.X, inp.time);
                    // opt2: inner values
                    //inp2.Parameters_OUT[j] = inp2.Parameters_IN[j];
                    // Velocity0MeanVectorOut is set to zero, i.e. always LambdaIn is used.
                    inp2.Parameters_OUT[m_SpatialDimension + j] = 0.0;
                }

                // Skalar (e.g. temperature or MassFraction)
                switch (m_bcmap.PhysMode)
                {
                case PhysicsMode.LowMach: {
                    // opt1:
                    inp2.Parameters_OUT[2 * m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    // opt2: inner values
                    //inp2.Parameters_OUT[2 * m_SpatialDimension] = inp2.Parameters_IN[2 * m_SpatialDimension];
                    // Use inner value for TemperatureMean, i.e. LambdaIn is used.
                    inp2.Parameters_OUT[2 * m_SpatialDimension + 1] = inp.Parameters_IN[2 * m_SpatialDimension + 1];
                    break;
                }

                case PhysicsMode.Combustion: {
                    // opt1: (using Dirichlet values)
                    inp2.Parameters_OUT[2 * m_SpatialDimension] = m_bcmap.bndFunction[VariableNames.Temperature][inp.EdgeTag](inp.X, inp.time);
                    for (int n = 1; n < NumberOfReactants + 1; n++)
                    {
                        // opt1: (using Dirichlet values)
                        inp2.Parameters_OUT[2 * m_SpatialDimension + n] = m_bcmap.bndFunction[VariableNames.MassFraction_n(n - 1)][inp.EdgeTag](inp.X, inp.time);
                    }
                    for (int n = 0; n < NumberOfReactants + 1; n++)
                    {
                        // Use inner value for mean scalar input parameters, i.e. LambdaIn is used.
                        inp2.Parameters_OUT[2 * m_SpatialDimension + NumberOfReactants + 1 + n] = inp.Parameters_IN[2 * m_SpatialDimension + NumberOfReactants + 1 + n];
                    }
                    break;
                }

                case PhysicsMode.Multiphase:
                    break;

                default:
                    throw new NotImplementedException();
                }

                // Dirichlet value for scalar
                // ==========================
                double[] Uout = new double[] { m_bcmap.bndFunction[Argument][inp.EdgeTag](inp.X, inp.time) };

                // Calculate BorderEdgeFlux as InnerEdgeFlux
                // =========================================
                r = InnerEdgeFlux(ref inp2, Uin, Uout);
                if (double.IsNaN(r))
                {
                    throw new NotFiniteNumberException();
                }
                return(r);
            }

            case IncompressibleBcType.Pressure_Dirichlet:
            case IncompressibleBcType.Outflow:
            case IncompressibleBcType.Pressure_Outlet:
            case IncompressibleBcType.NoSlipNeumann: {
                double r = 0.0;
                double u1, u2, u3 = 0;

                u1 = inp.Parameters_IN[0];
                u2 = inp.Parameters_IN[1];

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

                if (m_bcmap.PhysMode == PhysicsMode.LowMach)
                {
                    double rho = EoS.GetDensity(inp.Parameters_IN[2 * m_SpatialDimension]);
                    r *= rho;
                }

                if (m_bcmap.PhysMode == PhysicsMode.Combustion)
                {
                    double[] args = new double[NumberOfReactants + 1];
                    for (int n = 0; n < NumberOfReactants + 1; n++)
                    {
                        args[n] = inp.Parameters_IN[2 * m_SpatialDimension + n];
                    }
                    double rho = EoS.GetDensity(args);
                    r *= rho;
                }
                if (double.IsNaN(r))
                {
                    throw new NotFiniteNumberException();
                }
                return(r);
            }

            default:
                throw new NotImplementedException("Boundary condition not implemented!");
            }
        }