Esempio n. 1
0
        protected override double BorderEdgeFlux(ref BoSSS.Foundation.CommonParamsBnd inp, double[] Uin)
        {
            this.basecall = true;
            double flx = base.BorderEdgeFlux(ref inp, Uin);

            this.basecall = false;

            flx *= rho;

            return(flx);
        }
Esempio n. 2
0
        protected override bool IsDirichlet(ref BoSSS.Foundation.CommonParamsBnd inp)
        {
            IncompressibleBcType edgType = m_BcMap.EdgeTag2Type[inp.EdgeTag];

            switch (edgType)
            {
            case IncompressibleBcType.Pressure_Outlet:
            case IncompressibleBcType.Outflow:
                return(true);

            case IncompressibleBcType.Velocity_Inlet:
            case IncompressibleBcType.Wall:
            case IncompressibleBcType.NoSlipNeumann:
                return(false);

            default:
                throw new NotImplementedException("unsupported/unknown b.c. - missing implementation;");
            }
        }
        public override double BoundaryEdgeForm(ref BoSSS.Foundation.CommonParamsBnd inp, double[] _uA, double[,] _Grad_uA, double _vA, double[] _Grad_vA)
        {
            double Acc = 0.0;

            double pnlty = 2 * this.penalty(inp.GridDat, inp.jCellIn, -1, inp.iEdge);//, 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);
                //switch (base.m_implMode) {
                //    case ViscosityImplementation.H:
                //    case ViscosityImplementation.SWIP: {
                for (int d = 0; d < inp.D; d++)
                {
                    double nd = inp.Normal[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;
                //        }
                //    default:
                //        throw new NotImplementedException();

                //}
                break;
            }

            case IncompressibleBcType.FreeSlip: {
                //switch (base.m_implMode) {
                //    case ViscosityImplementation.H:
                //    case ViscosityImplementation.SWIP: {
                // consistency
                for (int d = 0; d < inp.D; d++)
                {
                    Acc += (inp.Normal[m_iComp] * muA * _Grad_uA[0, d] * inp.Normal[d]) * (_vA * inp.Normal[m_iComp]) * base.m_alpha;
                }

                // penalty
                Acc -= muA * (_uA[0] - 0) * inp.Normal[m_iComp] * inp.Normal[m_iComp] * (_vA - 0) * pnlty;

                break;
                //    }
                //    default:
                //        throw new NotImplementedException();
                //}
                //break;
            }

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

                double g_D = base.g_Diri(inp.X, inp.time, inp.EdgeTag, m_iComp);
                //switch (base.m_implMode) {
                //    case ViscosityImplementation.H:
                //    case ViscosityImplementation.SWIP: {
                for (int d = 0; d < inp.D; d++)
                {
                    // consistency
                    Acc += muA * (inp.Normal[m_iComp] * _Grad_uA[0, d] * inp.Normal[d]) * (_vA * inp.Normal[m_iComp]);
                    // symmetry
                    Acc += muA * (inp.Normal[m_iComp] * _Grad_vA[d] * inp.Normal[d]) * (_uA[0] - g_D) * inp.Normal[m_iComp];
                }
                Acc *= base.m_alpha;
                // penalty
                Acc -= muA * ((_uA[0] - g_D) * inp.Normal[m_iComp]) * ((_vA - 0) * inp.Normal[m_iComp]) * pnlty;

                // tangential dissipation force term
                Acc -= (m_beta * P[0, m_iComp] * (_uA[0] - g_D)) * (P[0, m_iComp] * _vA) * base.m_alpha;

                //for (int d = 0; d < inp.D; d++) {
                //    // no-penetration term
                //    Acc += (inp.Normale[m_iComp] * muA * _Grad_uA[0, d] * inp.Normale[d]) * (_vA * inp.Normale[m_iComp]) * base.m_alpha;
                //    // tangential dissipation force term
                //    Acc -= (m_beta * P[0, d] * (_uA[0] - g_D)) * (P[0, d] * _vA) * base.m_alpha;
                //}
                //        break;
                //    }
                //default:
                //    throw new NotImplementedException();
                //}
                break;
            }

            case IncompressibleBcType.Outflow:
            case IncompressibleBcType.Pressure_Outlet: {
                // Atmospheric outlet/pressure outflow: hom. Neumann
                // +++++++++++++++++++++++++++++++++++++++++++++++++
                double g_N = g_Neu(inp.X, inp.Normal, inp.EdgeTag);
                //switch (base.m_implMode) {
                //    case ViscosityImplementation.H:
                //    case ViscosityImplementation.SWIP: {
                Acc += muA * g_N * _vA * base.m_alpha;
                break;
                //        }

                //    default:
                //        throw new NotImplementedException();

                //}

                //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.
                //switch (base.m_implMode) {
                //    case ViscosityImplementation.H:
                //    case ViscosityImplementation.SWIP: {
                for (int d = 0; d < inp.D; d++)
                {
                    Acc += (muA * _Grad_uA[0, d]) * (_vA) * inp.Normal[d];
                    //Acc += (muA * _Grad_uA[m_iComp, d]) * (_vA) * inp.Normale[d];
                }
                Acc *= base.m_alpha;
                //          break;
                //        }
                //    default:
                //        throw new NotImplementedException();
                //}
                break;
            }

            default:
                throw new NotImplementedException();
            }

            return(-Acc);
        }
Esempio n. 4
0
 protected override void BorderEdgeFlux_(ref BoSSS.Foundation.CommonParamsBnd inp, double[] Uin, out double FluxInCell)
 {
     FluxInCell = 0.0;
 }