Пример #1
0
        public ConductivityInSpeciesBulk(double penalty, double sw, ThermalMultiphaseBoundaryCondMap bcMap, int D,
                                         string spcName, SpeciesId spcId, double _kA, double _kB)
            : base(penalty, D, bcMap)
        {
            base.m_alpha = sw;
            this.m_bcMap = bcMap;

            this.m_spcId = spcId;
            ValidSpecies = spcName;

            switch (spcName)
            {
            case "A": currentk = _kA; complementk = _kB; break;

            case "B": currentk = _kB; complementk = _kA; break;

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

            double muFactor = Math.Max(currentk, complementk) / currentk;

            base.m_penalty_base = penalty * muFactor;

            base.tempFunction = this.m_bcMap.bndFunction[VariableNames.Temperature + "#" + spcName];
            base.fluxFunction = D.ForLoop(d => bcMap.bndFunction[VariableNames.HeatFluxVectorComponent(d) + "#" + spcName]);
        }
Пример #2
0
 public ConductivityInBulk(double penalty, double sw, ThermalMultiphaseBoundaryCondMap bcMap, int D, double _kA, double _kB)
     : base(penalty, D, bcMap)
 {
     kA                = _kA;
     kB                = _kB;
     base.m_alpha      = sw;
     this.m_bcMap      = bcMap;
     base.tempFunction = null;
     this.m_penalty    = penalty;
 }
Пример #3
0
        public TemperatureStabilizationForm(int _d, ThermalMultiphaseBoundaryCondMap bcMap, string spcName, SpeciesId spcId)
        {
            this.m_d = _d;

            EdgeTag2Type = bcMap.EdgeTag2Type;
            tempFunction = bcMap.bndFunction[VariableNames.Temperature + "#" + spcName];

            this.m_spcId = spcId;
            //this.ksqrt = Math.Sqrt(_k);
        }
Пример #4
0
        public TemperatureGradientInSpeciesBulk(int _d, ThermalMultiphaseBoundaryCondMap bcMap, string spcName, SpeciesId spcId, double _k)
        {
            this.m_d = _d;

            this.m_spcId = spcId;
            this.k       = _k;

            tempFunction = bcMap.bndFunction[VariableNames.Temperature + "#" + spcName];
            EdgeTag2Type = bcMap.EdgeTag2Type;
        }
Пример #5
0
        public AuxiliaryStabilizationForm(int _D, ThermalMultiphaseBoundaryCondMap bcMap, string spcName, SpeciesId spcId)
        {
            this.m_D = _D;

            EdgeTag2Type = bcMap.EdgeTag2Type;
            fluxFunction = m_D.ForLoop(d => bcMap.bndFunction[VariableNames.HeatFluxVectorComponent(d) + "#" + spcName]);

            this.m_spcId = spcId;
            //this.ksqrt = Math.Sqrt(_k);
        }
Пример #6
0
        public HeatFluxDivergenceInSpeciesBulk(int D, ThermalMultiphaseBoundaryCondMap bcMap, string spcName, SpeciesId spcId)
        {
            this.m_D = D;

            this.m_spcId = spcId;
            //this.ksqrt = Math.Sqrt(_k);

            fluxFunction = D.ForLoop(d => bcMap.bndFunction[VariableNames.HeatFluxVectorComponent(d) + "#" + spcName]);
            EdgeTag2Type = bcMap.EdgeTag2Type;
        }
Пример #7
0
 public HeatConvectionInBulk(int SpatDim, ThermalMultiphaseBoundaryCondMap _bcmap, double _capA, double _capB, double _LFFA, double _LFFB, LevelSetTracker _lsTrk)
     : base(SpatDim, _bcmap)
 {
     capA = _capA;
     capB = _capB;
     //varMode = _varMode;
     this.lsTrk        = _lsTrk;
     this.LFFA         = _LFFA;
     this.LFFB         = _LFFB;
     this.m_bcmap      = _bcmap;
     base.tempFunction = null;
 }
Пример #8
0
        public TemperatureGradientInSpeciesBulk(int _D, int _d, ThermalMultiphaseBoundaryCondMap bcMap, string spcName, SpeciesId spcId, double _k)
        {
            this.m_D = _D;
            this.m_d = _d;

            this.m_spcId      = spcId;
            this.k            = _k;
            this.ValidSpecies = spcName;

            //fluxFunction = m_D.ForLoop(d => bcMap.bndFunction[VariableNames.HeatFluxVectorComponent(d) + "#" + spcName]);
            tempFunction = bcMap.bndFunction[VariableNames.Temperature + "#" + spcName];
            EdgeTag2Type = bcMap.EdgeTag2Type;
        }
        public HeatConvectionInSpeciesBulk_Upwind(int SpatDim, ThermalMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId, double _cap)
        {
            this.m_SpatialDimension = SpatDim;

            this.cap = _cap;
            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);

            this.TempFunction = m_bcmap.bndFunction[VariableNames.Temperature + "#" + spcName];
        }
        public HeatConvectionInSpeciesBulk_LLF(int SpatDim, ThermalMultiphaseBoundaryCondMap _bcmap, string spcName, SpeciesId spcId, 
            double _cap, double _LFF, LevelSetTracker _lsTrk)
            : base(SpatDim, _bcmap)
        {
            this.cap = _cap;
            this.m_spcId = spcId;
            ValidSpecies = spcName;

            this.lsTrk = _lsTrk;
            this.LFF = _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);

            base.TempFunction = m_bcmap.bndFunction[VariableNames.Temperature + "#" + spcName];

            //SubGrdMask = lsTrk.Regions.GetSpeciesSubGrid(spcId).VolumeMask.GetBitMaskWithExternal();
        }
Пример #11
0
        public HeatConvectionAtLevelSet(int _D, LevelSetTracker LsTrk, double _capA, double _capB, double _LFFA, double _LFFB,
                                        ThermalMultiphaseBoundaryCondMap _bcmap, bool _movingmesh, bool _DiriCond, double _Tsat)
        {
            m_D = _D;

            m_LsTrk = LsTrk;

            //MaterialInterface = _MaterialInterface;
            movingmesh = _movingmesh;

            NegFlux = new HeatConvectionInBulk(_D, _bcmap, _capA, _capB, _LFFA, double.NaN, LsTrk);
            NegFlux.SetParameter("A", LsTrk.GetSpeciesId("A"));
            PosFlux = new HeatConvectionInBulk(_D, _bcmap, _capA, _capB, double.NaN, _LFFB, LsTrk);
            PosFlux.SetParameter("B", LsTrk.GetSpeciesId("B"));


            DirichletCond = _DiriCond;
            Tsat          = _Tsat;

            capA = _capA;
            capB = _capB;
            LFFA = _LFFA;
            LFFB = _LFFB;
        }
Пример #12
0
        public HeatConvectionAtEvapLevelSet(int _D, LevelSetTracker LsTrk, double _capA, double _capB, double _LFFA, double _LFFB, ThermalMultiphaseBoundaryCondMap _bcmap,
                                            double _hVapA, double _Rint, double _Tsat, double _rho, double _sigma, double _pc, double _kA, double _kB, bool _movingmesh)
        {
            m_D = _D;

            capA    = _capA;
            capB    = _capB;
            m_LsTrk = LsTrk;

            //MaterialInterface = _MaterialInterface;
            movingmesh = _movingmesh;

            NegFlux = new HeatConvectionInBulk(_D, _bcmap, _capA, _capB, _LFFA, double.NaN, LsTrk);
            NegFlux.SetParameter("A", LsTrk.GetSpeciesId("A"));
            PosFlux = new HeatConvectionInBulk(_D, _bcmap, _capA, _capB, double.NaN, _LFFB, LsTrk);
            PosFlux.SetParameter("B", LsTrk.GetSpeciesId("B"));


            this.hVapA = _hVapA;
            this.Rint  = _Rint;
            this.Tsat  = _Tsat;
            this.rho   = _rho;
            this.sigma = _sigma;
            this.pc    = _pc;

            this.kA = _kA;
            this.kB = _kB;
        }
Пример #13
0
        //==============
        // Heat equation
        //==============

        public static void AddSpeciesHeatEq(XSpatialOperatorMk2 XOp, IHeat_Configuration config, int D,
                                            string spcName, SpeciesId spcId, ThermalMultiphaseBoundaryCondMap 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.HeatEquation;

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

            if (config.getConductMode != ConductivityInSpeciesBulk.ConductivityMode.SIP)
            {
                foreach (string cn in EquationNames.AuxHeatFlux(D))
                {
                    if (!XOp.CodomainVar.Contains(cn))
                    {
                        throw new ArgumentException("CoDomain variable \"" + cn + "\" is not defined in Spatial Operator");
                    }
                }
            }

            ThermalParameters    thermParams = config.getThermParams;
            DoNotTouchParameters dntParams   = config.getDntParams;

            // set species arguments
            double capSpc, LFFSpc, kSpc;

            switch (spcName)
            {
            case "A": { capSpc = thermParams.rho_A * thermParams.c_A; LFFSpc = dntParams.LFFA; kSpc = thermParams.k_A; break; }

            case "B": { capSpc = thermParams.rho_B * thermParams.c_B; LFFSpc = dntParams.LFFB; kSpc = thermParams.k_B; break; }

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

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


            // convective part
            // ================
            if (thermParams.IncludeConvection)
            {
                IEquationComponent conv;
                if (config.useUpwind)
                {
                    conv = new HeatConvectionInSpeciesBulk_Upwind(D, BcMap, spcName, spcId, capSpc);
                }
                else
                {
                    conv = new HeatConvectionInSpeciesBulk_LLF(D, BcMap, spcName, spcId, capSpc, LFFSpc, LsTrk);
                }

                comps.Add(conv);
            }


            // viscous operator (laplace)
            // ==========================
            if (config.getConductMode == ConductivityInSpeciesBulk.ConductivityMode.SIP)
            {
                double penalty = dntParams.PenaltySafety;

                var Visc = new ConductivityInSpeciesBulk(
                    dntParams.UseGhostPenalties ? 0.0 : penalty, 1.0,
                    BcMap, D, spcName, spcId, thermParams.k_A, thermParams.k_B);

                comps.Add(Visc);

                if (dntParams.UseGhostPenalties)
                {
                    var ViscPenalty = new ConductivityInSpeciesBulk(penalty * 1.0, 0.0, BcMap, D,
                                                                    spcName, spcId, thermParams.k_A, thermParams.k_B);
                    XOp.GhostEdgesOperator.EquationComponents[CodName].Add(ViscPenalty);
                }
            }
            else
            {
                comps.Add(new HeatFluxDivergenceInSpeciesBulk(D, BcMap, spcName, spcId));
                //if (config.getConductMode == ConductivityInSpeciesBulk.ConductivityMode.LDGstabi)
                //    comps.Add(new AuxiliaryStabilizationForm(D, BcMap, spcName, spcId));

                for (int d = 0; d < D; d++)
                {
                    comps = XOp.EquationComponents[EquationNames.AuxHeatFluxComponent(d)];

                    comps.Add(new AuxiliaryHeatFlux_Identity(d, spcName, spcId));   // cell local
                    comps.Add(new TemperatureGradientInSpeciesBulk(D, d, BcMap, spcName, spcId, kSpc));
                    //if (config.getConductMode == ConductivityInSpeciesBulk.ConductivityMode.LDGstabi)
                    //    comps.Add(new TemperatureStabilizationForm(d, BcMap, spcName, spcId));
                }
            }
        }
Пример #14
0
        public static void AddInterfaceHeatEq(XSpatialOperatorMk2 XOp, IXHeat_Configuration config, int D,
                                              ThermalMultiphaseBoundaryCondMap 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.HeatEquation;

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

            if (config.getConductMode != ConductivityInSpeciesBulk.ConductivityMode.SIP)
            {
                foreach (string cn in EquationNames.AuxHeatFlux(D))
                {
                    if (!XOp.CodomainVar.Contains(cn))
                    {
                        throw new ArgumentException("CoDomain variable \"" + cn + "\" is not defined in Spatial Operator");
                    }
                }
            }

            ThermalParameters    thermParams = config.getThermParams;
            DoNotTouchParameters dntParams   = config.getDntParams;

            // set species arguments
            double capA = thermParams.rho_A * thermParams.c_A;
            double LFFA = dntParams.LFFA;
            double kA   = thermParams.k_A;

            double capB = thermParams.rho_B * thermParams.c_B;
            double LFFB = dntParams.LFFB;
            double kB   = thermParams.k_B;

            double Tsat = thermParams.T_sat;

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


            // convective part
            // ================
            if (thermParams.IncludeConvection)
            {
                ILevelSetForm conv;
                conv = new HeatConvectionAtLevelSet_LLF(D, LsTrk, capA, capB, LFFA, LFFB, BcMap, config.isMovingMesh, Tsat);
                //conv = new HeatConvectionAtLevelSet_WithEvaporation(D, LsTrk, LFFA, LFFB, thermParams, config.getPhysParams.Sigma);
                //conv = new HeatConvectionAtLevelSet_Upwind(D, LsTrk, capA, capB, thermParams, config.isMovingMesh, config.isEvaporation, Tsat);

                comps.Add(conv);
            }


            // viscous operator (laplace)
            // ==========================
            if (config.getConductMode == ConductivityInSpeciesBulk.ConductivityMode.SIP)
            {
                double penalty = dntParams.PenaltySafety;

                var Visc = new ConductivityAtLevelSet(LsTrk, kA, kB, penalty * 1.0, Tsat);
                comps.Add(Visc);

                var qJump = new HeatFluxAtLevelSet(D, LsTrk, thermParams, config.getPhysParams.Sigma);
                comps.Add(qJump);
            }
            else
            {
                comps.Add(new HeatFluxDivergencetAtLevelSet(LsTrk));
                //if(config.getConductMode == ConductivityInSpeciesBulk.ConductivityMode.LDGstabi)
                //    comps.Add(new AuxiliaryStabilizationFormAtLevelSet(LsTrk, config.isEvaporation));

                for (int d = 0; d < D; d++)
                {
                    comps = XOp.EquationComponents[EquationNames.AuxHeatFluxComponent(d)];

                    comps.Add(new TemperatureGradientAtLevelSet(d, LsTrk, kA, kB, Tsat));
                    //if (config.getConductMode == ConductivityInSpeciesBulk.ConductivityMode.LDGstabi)
                    //    comps.Add(new TemperatureStabilizationFormAtLevelSet(d, LsTrk, kA, kB, config.isEvaporation, Tsat));
                }
            }
        }