public ConvectionInSpeciesBulk_LLF(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId, int _component,
                                           double _rho, double _LFF, LevelSetTracker _lsTrk) :
            base(SpatDim, _bcmap, _component, false)
        {
            //
            rho          = _rho;
            m_spcId      = spcId;
            ValidSpecies = spcName;

            //varMode = _varMode;
            this.lsTrk = _lsTrk;
            this.LFF   = _LFF;

            this.m_bcmap = _bcmap;

            int dir = base.m_component;

            base.velFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim];
            for (int d = 0; d < SpatDim; d++)
            {
                base.velFunction.SetColumn(m_bcmap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName], d);
            }

            //SubGrdMask = lsTrk.Regions.GetSpeciesSubGrid(spcId).VolumeMask.GetBitMaskWithExternal();
        }
Ejemplo n.º 2
0
        public ViscosityInSpeciesBulk_GradUtranspTerm(double penalty, double sw, IncompressibleMultiphaseBoundaryCondMap bcMap, string spcName, SpeciesId spcId, int _d, int _D,
                                                      double _muA, double _muB, double _betaS = 0.0)
            : base(penalty, _d, _D, bcMap, NSECommon.ViscosityOption.ConstantViscosity, constantViscosityValue: double.NegativeInfinity)
        {
            base.m_alpha = sw;
            this.m_bcMap = bcMap;

            m_spcId = spcId;
            switch (spcName)
            {
            case "A": currentMu = _muA; complementMu = _muB; break;

            case "B": currentMu = _muB; complementMu = _muA; break;

            default: throw new ArgumentException("Unknown species.");
            }

            double muFactor = Math.Max(currentMu, complementMu) / currentMu;

            base.m_penalty_base = penalty * muFactor;

            int D = base.m_D;

            base.velFunction = D.ForLoop(d => this.m_bcMap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName]);

            betaS = _betaS;
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name = "XOp" ></ param >
 /// < param name="config"></param>
 /// <param name = "BcMap" ></ param >
 /// < param name="LsTrk"></param>
 public static void AddInterfaceConstitutive(XSpatialOperatorMk2 XOp, IXNSE_Configuration config, int D,
                                             IncompressibleMultiphaseBoundaryCondMap BcMap, LevelSetTracker LsTrk)
 {
     for (int d = 0; d < 3; d++)
     {
         AddInterfaceConstitutive_component(XOp, config, d, D, BcMap, LsTrk);
     }
 }
Ejemplo n.º 4
0
 public PressureInBulk(int _d, IncompressibleMultiphaseBoundaryCondMap bcMap, double rhoA, double rhoB)
     : base(_d, bcMap)
 {
     m_rhoA = rhoA;
     m_rhoB = rhoB;
     base.pressureFunction = null;
     this.m_bcMap          = bcMap;
 }
Ejemplo n.º 5
0
 public PressureInSpeciesBulk(int _d, IncompressibleMultiphaseBoundaryCondMap bcMap, string spcName, SpeciesId spcId)
     : base(_d, bcMap)
 {
     base.pressureFunction = bcMap.bndFunction[VariableNames.Pressure + "#" + spcName];
     this.m_bcMap          = bcMap;
     //this.m_spcName = spcName;
     this.m_spcId = spcId;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Initialize Convection
        /// </summary>
        public StressDivergenceInBulk(int _Component, IncompressibleMultiphaseBoundaryCondMap _BcMap, double _Reynolds, double[] _Penalty1, double _Penalty2, string spcName, SpeciesId spcId) : base(_Component, _BcMap, _Reynolds, _Penalty1, _Penalty2)
        {
            this.m_bcMap      = _BcMap;
            this.ValidSpecies = spcName;

            base.VelFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, 2];
            base.VelFunction.SetColumn(m_bcMap.bndFunction[VariableNames.VelocityX + "#" + spcName], 0);
            base.VelFunction.SetColumn(m_bcMap.bndFunction[VariableNames.VelocityY + "#" + spcName], 1);
        }
Ejemplo n.º 7
0
 public ViscosityInBulk_divTerm(double penalty, double sw, IncompressibleMultiphaseBoundaryCondMap bcMap, int d, int D, double _muA, double _muB)
     : base(penalty, d, D, bcMap, NSECommon.ViscosityOption.ConstantViscosity, constantViscosityValue: double.NegativeInfinity)
 {
     muA              = _muA;
     muB              = _muB;
     base.m_alpha     = sw;
     base.velFunction = null;
     this.m_bcMap     = bcMap;
     this.m_penalty   = penalty;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name = "XOp" ></ param >
        /// < param name="config"></param>
        /// <param name = "BcMap" ></ param >
        /// < param name="LsTrk"></param>
        /// <param name="U0meanrequired"></param>
        public static void AddInterfaceConstitutive(XSpatialOperatorMk2 XOp, IRheology_Configuration config, int D,
                                                    IncompressibleMultiphaseBoundaryCondMap BcMap, LevelSetTracker LsTrk, out bool U0meanrequired)
        {
            U0meanrequired = false;

            for (int d = 0; d < 3; d++)
            {
                AddInterfaceConstitutive_component(XOp, config, d, D, BcMap, LsTrk, out U0meanrequired);
            }
        }
Ejemplo n.º 9
0
        //protected Func<double[], double, double>[] ScalarFunction;


        public LinearizedConvection(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap)
        {
            m_SpatialDimension = SpatDim;
            m_bcMap            = _bcmap;

            VelFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim];
            for (int d = 0; d < m_SpatialDimension; d++)
            {
                VelFunction.SetColumn(m_bcMap.bndFunction[VariableNames.Velocity_d(d)], d);
            }

            //ScalarFunction = m_bcMap.bndFunction["KineticEnergy"];
        }
Ejemplo n.º 10
0
        public ConvectivePressureTermAtLevelSet_LLF(int _D, LevelSetTracker LsTrk, double _LFFA, double _LFFB,
                                                    bool _MaterialInterface, IncompressibleMultiphaseBoundaryCondMap _bcmap, bool _movingmesh)
        {
            m_D = _D;

            m_LsTrk = LsTrk;

            MaterialInterface = _MaterialInterface;
            movingmesh        = _movingmesh;

            NegFlux = new ConvectivePressureTerm_LLF(_D, _bcmap, "A", LsTrk.GetSpeciesId("A"), _LFFA, LsTrk);
            PosFlux = new ConvectivePressureTerm_LLF(_D, _bcmap, "B", LsTrk.GetSpeciesId("B"), _LFFB, LsTrk);
        }
Ejemplo n.º 11
0
 public ViscosityInBulk_GradUTerm(double penalty, double sw, IncompressibleMultiphaseBoundaryCondMap bcMap, int d, int D, double _muA, double _muB,
                                  ViscosityImplementation _ViscosityImplementation, double _betaA = 0.0, double _betaB = 0.0)
     : base(penalty, null, d, D, bcMap, _ViscosityImplementation, NSECommon.ViscosityOption.ConstantViscosity, constantViscosityValue: double.NegativeInfinity)
 {
     muA              = _muA;
     muB              = _muB;
     betaA            = _betaA;
     betaB            = _betaB;
     base.m_alpha     = sw;
     this.m_bcMap     = bcMap;
     base.velFunction = null;
     this.m_penalty   = penalty;
 }
Ejemplo n.º 12
0
 public ConvectionInBulk_LLF(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap, int _component, double _rhoA, double _rhoB, double _LFFA, double _LFFB, LevelSetTracker _lsTrk) :
     base(SpatDim, _bcmap, _component, false)
 {
     //
     rhoA = _rhoA;
     rhoB = _rhoB;
     //varMode = _varMode;
     this.lsTrk       = _lsTrk;
     this.LFFA        = _LFFA;
     this.LFFB        = _LFFB;
     this.m_bcmap     = _bcmap;
     base.velFunction = null;
 }
Ejemplo n.º 13
0
        public KineticEnergyConvectionInSpeciesBulk_Upwind(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId, double _rho)
        {
            this.m_SpatialDimension = SpatDim;

            this.rho          = _rho;
            this.m_spcId      = spcId;
            this.ValidSpecies = spcName;
            this.m_bcmap      = _bcmap;

            this.VelFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim];
            for (int d = 0; d < SpatDim; d++)
            {
                this.VelFunction.SetColumn(m_bcmap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName], d);
            }
        }
Ejemplo n.º 14
0
        public KineticEnergyConvectionAtLevelSet(int _D, LevelSetTracker LsTrk, double _rhoA, double _rhoB, double _LFFA, double _LFFB,
                                                 bool _MaterialInterface, IncompressibleMultiphaseBoundaryCondMap _bcmap, bool _movingmesh)
        {
            m_D = _D;

            m_LsTrk = LsTrk;

            MaterialInterface = _MaterialInterface;
            movingmesh        = _movingmesh;

            NegFlux = new KineticEnergyConvectionInSpeciesBulk(_D, _bcmap, "A", LsTrk.GetSpeciesId("A"), _rhoA, _LFFA, LsTrk);
            //NegFlux.SetParameter("A", LsTrk.GetSpeciesId("A"));
            PosFlux = new KineticEnergyConvectionInSpeciesBulk(_D, _bcmap, "B", LsTrk.GetSpeciesId("B"), _rhoB, _LFFB, LsTrk);
            //PosFlux.SetParameter("B", LsTrk.GetSpeciesId("B"));
        }
Ejemplo n.º 15
0
        public DivergencePressureEnergyInSpeciesBulk(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId)
        {
            m_D          = SpatDim;
            m_bcMap      = _bcmap;
            m_spcId      = spcId;
            ValidSpecies = spcName;

            VelocFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim];
            for (int d = 0; d < m_D; d++)
            {
                VelocFunction.SetColumn(m_bcMap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName], d);
            }

            PressFunction = m_bcMap.bndFunction[VariableNames.Pressure + "#" + spcName];
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="XOp"></param>
        /// <param name="config"></param>
        /// <param name="spcName"></param>
        /// <param name="spcId"></param>
        /// <param name="BcMap"></param>
        /// <param name="LsTrk"></param>
        /// <param name="U0meanrequired"></param>
        public static void AddSpeciesConstitutive(XSpatialOperatorMk2 XOp, IRheology_Configuration config, int D, int stressDegree, string spcName, SpeciesId spcId,
                                                  IncompressibleMultiphaseBoundaryCondMap BcMap, LevelSetTracker LsTrk, out bool U0meanrequired)
        {
            if (D > 2)
            {
                throw new NotSupportedException("Viscoelastic solver does not support 3D calculation. Only implemented for 2D cases!");
            }

            U0meanrequired = false;

            for (int d = 0; d < 3; d++)
            {
                AddSpeciesConstitutive_component(XOp, config, d, D, stressDegree, spcName, spcId, BcMap, LsTrk, out U0meanrequired);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Initialize objective term
        /// </summary>
        public ObjectiveInBulk(int _Component, IncompressibleMultiphaseBoundaryCondMap _BcMap, double WeissenbergA, double WeissenbergB, double ObjectiveParam, double Penalty, string spcName, SpeciesId spcId) : base(_Component, _BcMap, 0.0, ObjectiveParam, Penalty)
        {
            this.Component        = _Component;
            this.m_spcId          = spcId;
            this.m_bcMap          = _BcMap;
            base.m_ObjectiveParam = ObjectiveParam;

            switch (spcName)
            {
            case "A": base.m_Weissenberg = WeissenbergA; break;

            case "B": base.m_Weissenberg = WeissenbergB; break;

            default: throw new ArgumentException("Unknown species.");
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// ctor
        /// </summary>
        /// <param name="_component">
        /// component of the divergence
        /// </param>
        /// <param name="_bcmap"></param>
        public DivergenceInSpeciesBulk_Edge(int _component, IncompressibleMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId,
                                            double _rho, double _vorZeichen, bool _RescaleConti)
            : base(_component, _bcmap)
        {
            rho     = _rho;
            m_spcId = spcId;
            //vorZeichen = _vorZeichen;
            this.RescaleConti = _RescaleConti;
            scale             = _vorZeichen / ((RescaleConti) ? rho : 1.0);

            int d = base.component;

            base.bndFunction = _bcmap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName];

            this.m_bcmap = _bcmap;
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Initialize Viscosity
        /// </summary>
        public ViscosityInBulk(int _Component, IncompressibleMultiphaseBoundaryCondMap _BcMap, double _betaA, double _betaB, double[] _Penalty1, string spcName, SpeciesId spcId) : base(_Component, _BcMap, 0.0, _Penalty1)
        {
            this.Component = _Component;
            this.m_spcId   = spcId;
            this.m_bcMap   = _BcMap;
            base.pen1      = _Penalty1;

            switch (spcName)
            {
            case "A": base.m_ViscosityNonNewton = 1 - _betaA; break;

            case "B": base.m_ViscosityNonNewton = 1 - _betaB; break;

            default: throw new ArgumentException("Unknown species.");
            }
        }
Ejemplo n.º 20
0
        public ConvectivePressureTerm_Upwind(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId)
        {
            this.m_SpatialDimension = SpatDim;

            this.m_bcmap     = _bcmap;
            this.VelFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim];
            for (int d = 0; d < SpatDim; d++)
            {
                this.VelFunction.SetColumn(m_bcmap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName], d);
            }

            PressFunction = m_bcmap.bndFunction[VariableNames.Pressure + "#" + spcName];

            this.m_spcId      = spcId;
            this.ValidSpecies = spcName;
        }
Ejemplo n.º 21
0
        double m_alpha; // upwind-paramter

        /// <summary>
        /// Initialize Convection
        /// </summary>
        public ConvectiveInBulk(int _Component, IncompressibleMultiphaseBoundaryCondMap _BcMap, double WeissenbergA, double WeissenbergB, double alpha, string spcName, SpeciesId spcId) : base(_Component, _BcMap, 0.0, alpha = 1.0)
        {
            this.Component = _Component;
            this.m_spcId   = spcId;
            this.m_bcMap   = _BcMap;
            this.m_alpha   = alpha;

            switch (spcName)
            {
            case "A": base.m_Weissenberg = WeissenbergA; break;

            case "B": base.m_Weissenberg = WeissenbergB; break;

            default: throw new ArgumentException("Unknown species.");
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// ctor
        /// </summary>
        /// <param name="_component">
        /// component of the divergence
        /// </param>
        /// <param name="_bcmap"></param>
        public DivergenceInBulk_Edge(int _component, IncompressibleMultiphaseBoundaryCondMap _bcmap, double _rhoA, double _rhoB,
                                     //EquationAndVarMode _varmode,
                                     double _vorZeichen, bool _RescaleConti)
            : base(_component, _bcmap)
        {
            rhoA = _rhoA;
            rhoB = _rhoB;
            //varmode = _varmode;
            this.RescaleConti = _RescaleConti;

            //if (_vorZeichen != Math.Sign(_vorZeichen))
            //    throw new ArgumentOutOfRangeException();

            vorZeichen       = _vorZeichen;
            base.bndFunction = null;
            this.m_bcmap     = _bcmap;
        }
Ejemplo n.º 23
0
        public StressDivergenceInSpeciesBulk(int SpatDim, IncompressibleMultiphaseBoundaryCondMap bcMap,
                                             string spcName, SpeciesId spcId, double _mu, bool transposed = false)
        {
            m_D          = SpatDim;
            this.m_bcMap = bcMap;
            m_spcId      = spcId;
            mu           = _mu;
            ValidSpecies = spcName;

            transposedTerm = transposed;

            VelFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim];
            for (int d = 0; d < m_D; d++)
            {
                VelFunction.SetColumn(m_bcMap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName], d);
            }
        }
Ejemplo n.º 24
0
        public ConvectivePressureTerm_LLF(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId, double _LFF, LevelSetTracker _lsTrk)
        {
            this.m_SpatialDimension        = SpatDim;
            this.LaxFriedrichsSchemeSwitch = _LFF;

            this.lsTrk = _lsTrk;

            this.m_bcmap     = _bcmap;
            this.VelFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim];
            for (int d = 0; d < SpatDim; d++)
            {
                this.VelFunction.SetColumn(m_bcmap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName], d);
            }

            PressFunction = m_bcmap.bndFunction[VariableNames.Pressure + "#" + spcName];

            this.m_spcId      = spcId;
            this.ValidSpecies = spcName;
        }
Ejemplo n.º 25
0
        public KineticEnergyConvectionInSpeciesBulk(int SpatDim, IncompressibleMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId, double _rho, double _LFF, LevelSetTracker _lsTrk)
            : base(SpatDim, _bcmap)
        {
            this.rho = _rho;
            base.LaxFriedrichsSchemeSwitch = _LFF;

            this.m_bcMap = _bcmap;

            base.VelFunction = new Func <double[], double, double> [GridCommons.FIRST_PERIODIC_BC_TAG, SpatDim];
            for (int d = 0; d < SpatDim; d++)
            {
                base.VelFunction.SetColumn(m_bcMap.bndFunction[VariableNames.Velocity_d(d) + "#" + spcName], d);
            }

            this.lsTrk        = _lsTrk;
            this.ValidSpecies = spcName;
            m_spcId           = spcId;
            SubGrdMask        = lsTrk.Regions.GetSpeciesSubGrid(spcId).VolumeMask.GetBitMaskWithExternal();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Initialize Convection
        /// </summary>
        public StressDivergenceInBulk(int _Component, IncompressibleMultiphaseBoundaryCondMap _BcMap, double _ReynoldsA, double _ReynoldsB, double[] _Penalty1, double _Penalty2, string spcName, SpeciesId spcId) : base(_Component, _BcMap, 0.0, _Penalty1, _Penalty2)
        {
            this.Component = _Component;
            this.m_spcId   = spcId;
            this.m_bcMap   = _BcMap;
            //this.m_ReynoldsA = _ReynoldsA;
            //this.m_ReynoldsB = _ReynoldsB;
            base.pen1 = _Penalty1;
            base.pen2 = _Penalty2;

            switch (spcName)
            {
            case "A": base.InverseReynolds = -1 / _ReynoldsA; break;

            case "B": base.InverseReynolds = -1 / _ReynoldsB; break;

            default: throw new ArgumentException("Unknown species.");
            }
        }
Ejemplo n.º 27
0
        //========================
        // Kinetic energy equation
        //========================
        #region energy

        public static void AddSpeciesKineticEnergyEquation(XSpatialOperatorMk2 XOp, IEnergy_Configuration config, int D, string spcName, SpeciesId spcId,
                                                           IncompressibleMultiphaseBoundaryCondMap BcMap, LevelSetTracker LsTrk)
        {
            // check input
            if (XOp.IsCommited)
            {
                throw new InvalidOperationException("Spatial Operator is already comitted. Adding of new components is not allowed");
            }

            string CodName = EquationNames.KineticEnergyEquation;

            if (!XOp.CodomainVar.Contains(CodName))
            {
                throw new ArgumentException("CoDomain variable \"" + CodName + "\" is not defined in Spatial Operator");
            }

            PhysicalParameters   physParams = config.getPhysParams;
            DoNotTouchParameters dntParams  = config.getDntParams;

            bool laplaceKinE = (config.getKinEviscousDiscretization == KineticEnergyViscousSourceTerms.laplaceKinE);
            bool divergenceP = (config.getKinEpressureDiscretization == KineticEnergyPressureSourceTerms.divergence);

            // set species arguments
            double rhoSpc, LFFSpc, muSpc;

            switch (spcName)
            {
            case "A": { rhoSpc = physParams.rho_A; LFFSpc = dntParams.LFFA; muSpc = physParams.mu_A; break; }

            case "B": { rhoSpc = physParams.rho_B; LFFSpc = dntParams.LFFB; muSpc = physParams.mu_B; break; }

            default: throw new ArgumentException("Unknown species.");
            }

            // set components
            var comps = XOp.EquationComponents[CodName];

            // convective part
            // ================
            if (config.isTransport)
            {
                var convK = new KineticEnergyConvectionInSpeciesBulk(D, BcMap, spcName, spcId, rhoSpc, LFFSpc, LsTrk);
                //var convK = new KineticEnergyConvectionInSpeciesBulk_Upwind(D, BcMap, spcName, spcId, rhoSpc);
                comps.Add(convK);
            }

            // viscous terms
            // =============
            if (config.isViscous && !(muSpc == 0.0))
            {
                double penalty = dntParams.PenaltySafety;

                // Laplace of kinetic energy
                // =========================
                if (laplaceKinE)
                {
                    var kELap = new KineticEnergyLaplaceInSpeciesBulk(
                        dntParams.UseGhostPenalties ? 0.0 : penalty, 1.0,
                        BcMap, spcName, spcId, D, physParams.mu_A, physParams.mu_B);
                    comps.Add(kELap);

                    if (dntParams.UseGhostPenalties)
                    {
                        var kELapPenalty = new KineticEnergyLaplaceInSpeciesBulk(
                            penalty, 0.0,
                            BcMap, spcName, spcId, D, physParams.mu_A, physParams.mu_B);
                        XOp.GhostEdgesOperator.EquationComponents[CodName].Add(kELapPenalty);
                    }
                }

                // Divergence of stress tensor
                // ===========================
                {
                    if (config.getKinEviscousDiscretization == KineticEnergyViscousSourceTerms.fluxFormulation)
                    {
                        comps.Add(new StressDivergenceInSpeciesBulk(D, BcMap, spcName, spcId, muSpc, transposed: !laplaceKinE));
                    }

                    if (config.getKinEviscousDiscretization == KineticEnergyViscousSourceTerms.local)
                    {
                        comps.Add(new StressDivergence_Local(D, muSpc, spcName, spcId, transposed: !laplaceKinE));
                    }
                }

                // Dissipation
                // ===========
                {
                    comps.Add(new Dissipation(D, muSpc, spcName, spcId, _withPressure: config.withPressureDissipation));
                }
            }

            // pressure term
            // =============
            if (config.isPressureGradient)
            {
                if (divergenceP)
                {
                    comps.Add(new DivergencePressureEnergyInSpeciesBulk(D, BcMap, spcName, spcId));
                    //comps.Add(new ConvectivePressureTerm_LLF(D, BcMap, spcName, spcId, LFFSpc, LsTrk));
                }
                else
                {
                    comps.Add(new PressureGradientConvection(D, spcName, spcId));
                }
            }

            // gravity (volume forces)
            // =======================
            {
                comps.Add(new PowerofGravity(D, spcName, spcId, rhoSpc));
            }
        }
Ejemplo n.º 28
0
        public ConvectionAtLevelSet_LLF(int _d, int _D, LevelSetTracker LsTrk, double _rhoA, double _rhoB, double _LFFA, double _LFFB, bool _MaterialInterface, IncompressibleMultiphaseBoundaryCondMap _bcmap, bool _movingmesh)
        {
            m_D     = _D;
            m_d     = _d;
            rhoA    = _rhoA;
            rhoB    = _rhoB;
            m_LsTrk = LsTrk;
            //varMode = _varMode;
            MaterialInterface = _MaterialInterface;
            movingmesh        = _movingmesh;

            NegFlux = new ConvectionInBulk_LLF(_D, _bcmap, _d, _rhoA, _rhoB, _LFFA, double.NaN, LsTrk);
            NegFlux.SetParameter("A", LsTrk.GetSpeciesId("A"), null);
            PosFlux = new ConvectionInBulk_LLF(_D, _bcmap, _d, _rhoA, _rhoB, double.NaN, _LFFB, LsTrk);
            PosFlux.SetParameter("B", LsTrk.GetSpeciesId("B"), null);
        }
Ejemplo n.º 29
0
        public static void AddInterfaceKineticEnergyEquation(XSpatialOperatorMk2 XOp, IEnergy_Configuration config, int D,
                                                             IncompressibleMultiphaseBoundaryCondMap BcMap, LevelSetTracker LsTrk, int degU)
        {
            // check input
            if (XOp.IsCommited)
            {
                throw new InvalidOperationException("Spatial Operator is already comitted. Adding of new components is not allowed");
            }

            string CodName = EquationNames.KineticEnergyEquation;

            if (!XOp.CodomainVar.Contains(CodName))
            {
                throw new ArgumentException("CoDomain variable \"" + CodName + "\" is not defined in Spatial Operator");
            }

            PhysicalParameters   physParams = config.getPhysParams;
            DoNotTouchParameters dntParams  = config.getDntParams;

            bool laplaceKinE = (config.getKinEviscousDiscretization == KineticEnergyViscousSourceTerms.laplaceKinE);
            bool divergenceP = (config.getKinEpressureDiscretization == KineticEnergyPressureSourceTerms.divergence);

            // set species arguments
            double rhoA  = physParams.rho_A;
            double rhoB  = physParams.rho_B;
            double LFFA  = dntParams.LFFA;
            double LFFB  = dntParams.LFFB;
            double muA   = physParams.mu_A;
            double muB   = physParams.mu_B;
            double sigma = physParams.Sigma;

            double penalty_base = (degU + 1) * (degU + D) / D;
            double penalty      = penalty_base * dntParams.PenaltySafety;

            // set components
            var comps = XOp.EquationComponents[CodName];

            // convective part
            // ================
            if (config.isTransport)
            {
                comps.Add(new KineticEnergyConvectionAtLevelSet(D, LsTrk, rhoA, rhoB, LFFA, LFFB, physParams.Material, BcMap, config.isMovingMesh));
            }

            // viscous terms
            // =============
            if (config.isViscous && (!(muA == 0.0) && !(muB == 0.0)))
            {
                if (laplaceKinE)
                {
                    comps.Add(new KineticEnergyLaplaceAtInterface(LsTrk, muA, muB, penalty * 1.0));
                }

                if (config.getKinEviscousDiscretization == KineticEnergyViscousSourceTerms.fluxFormulation)
                {
                    comps.Add(new StressDivergenceAtLevelSet(LsTrk, muA, muB, transposed: !laplaceKinE));
                }
            }


            // pressure term
            // =============
            if (config.isPressureGradient)
            {
                if (divergenceP)
                {
                    comps.Add(new DivergencePressureEnergyAtLevelSet(LsTrk));
                    //comps.Add(new ConvectivePressureTermAtLevelSet_LLF(D, LsTrk, LFFA, LFFB, physParams.Material, BcMap, config.isMovingMesh));
                }
            }

            // surface energy
            // ==============
            {
                comps.Add(new SurfaceEnergy(D, LsTrk, sigma, rhoA, rhoB));
            }
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Initialize Convection
 /// </summary>
 public ConvectiveInBulk(int _Component, IncompressibleMultiphaseBoundaryCondMap _BcMap, double Weissenberg, double alpha, string spcName, SpeciesId spcId) : base(_Component, _BcMap, Weissenberg, true, alpha = 1.0)
 {
     this.ValidSpecies = spcName;
 }