/// <summary> /// /// </summary> /// <param name="XOp"></param> /// <param name="config"></param> /// <param name="D"></param> /// <param name="LsTrk"></param> public static void AddInterfaceContinuityEq_withEvaporation(XSpatialOperatorMk2 XOp, XNSFE_OperatorConfiguration config, int D, 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.ContinuityEquation; if (!XOp.CodomainVar.Contains(CodName)) { throw new ArgumentException("CoDomain variable \"" + CodName + "\" is not defined in Spatial Operator"); } ThermalParameters thermParams = config.getThermParams; DoNotTouchParameters dntParams = config.getDntParams; // set components var comps = XOp.EquationComponents[CodName]; var divEvap = new DivergenceAtLevelSet_withEvaporation(D, LsTrk, dntParams.ContiSign, dntParams.RescaleConti, thermParams, config.getPhysParams.Sigma); comps.Add(divEvap); }
/// <summary> /// /// </summary> /// <param name="XOp"></param> /// <param name="config"></param> /// <param name="D"></param> /// <param name="LsTrk"></param> public static void AddInterfaceContinuityEq_withEvaporation(XSpatialOperatorMk2 XOp, XNSFE_OperatorConfiguration config, int D, 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.ContinuityEquation; if (!XOp.CodomainVar.Contains(CodName)) { throw new ArgumentException("CoDomain variable \"" + CodName + "\" is not defined in Spatial Operator"); } PhysicalParameters physParams = config.getPhysParams; ThermalParameters thermParams = config.getThermParams; DoNotTouchParameters dntParams = config.getDntParams; // set species arguments double rhoA = physParams.rho_A; double rhoB = physParams.rho_B; double sigma = physParams.Sigma; // compute further arguments double hVapA = thermParams.hVap_A; double hVapB = thermParams.hVap_B; double Tsat = thermParams.T_sat; double f = config.thermParams.fc; double R = config.thermParams.Rc; double R_int = 0.0; if (config.thermParams.hVap_A > 0 && config.thermParams.hVap_B < 0) { R_int = ((2.0 - f) / (2 * f)) * Tsat * Math.Sqrt(2 * Math.PI * R * Tsat) / (rhoB * hVapA.Pow2()); //T_intMin = Tsat * (1 + (pc / (rhoA * hVapA.Pow2()))); } else if (config.thermParams.hVap_A < 0 && config.thermParams.hVap_B > 0) { R_int = ((2.0 - f) / (2 * f)) * Tsat * Math.Sqrt(2 * Math.PI * R * Tsat) / (rhoA * hVapB.Pow2()); //T_intMin = Tsat * (1 + (pc / (rhoB * hVapB.Pow2()))); } //double prescrbM = config.prescribedMassflux; // set components var comps = XOp.EquationComponents[CodName]; var divEvap = new DivergenceAtLevelSet_withEvaporation(D, LsTrk, rhoA, rhoB, dntParams.ContiSign, dntParams.RescaleConti, thermParams, R_int, sigma); comps.Add(divEvap); }
//============================================================== // additional interface components for NSFE interface components //============================================================== /// <summary> /// /// </summary> /// <param name="XOp"></param> /// <param name="config"></param> /// <param name="d"></param> /// <param name="D"></param> /// <param name="LsTrk"></param> public static void AddInterfaceNSE_withEvaporation_component(XSpatialOperatorMk2 XOp, XNSFE_OperatorConfiguration config, int d, int D, 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.MomentumEquationComponent(d); if (!XOp.CodomainVar.Contains(CodName)) { throw new ArgumentException("CoDomain variable \"" + CodName + "\" is not defined in Spatial Operator"); } PhysicalParameters physParams = config.getPhysParams; ThermalParameters thermParams = config.getThermParams; DoNotTouchParameters dntParams = config.getDntParams; double sigma = physParams.Sigma; // set components var comps = XOp.EquationComponents[CodName]; if (config.isTransport) { comps.Add(new ConvectionAtLevelSet_nonMaterialLLF(d, D, LsTrk, thermParams, sigma)); comps.Add(new ConvectionAtLevelSet_Consistency(d, D, LsTrk, dntParams.ContiSign, dntParams.RescaleConti, thermParams, sigma)); } if (config.isMovingMesh) { comps.Add(new ConvectionAtLevelSet_MovingMesh(d, D, LsTrk, thermParams, sigma)); } if (config.isViscous) { comps.Add(new ViscosityAtLevelSet_FullySymmetric_withEvap(LsTrk, physParams.mu_A, physParams.mu_B, dntParams.PenaltySafety, d, thermParams, sigma)); } comps.Add(new MassFluxAtInterface(d, D, LsTrk, thermParams, sigma)); }
//============================================================== // additional interface components for NSFE interface components //============================================================== /// <summary> /// /// </summary> /// <param name="XOp"></param> /// <param name="config"></param> /// <param name="d"></param> /// <param name="D"></param> /// <param name="LsTrk"></param> public static void AddInterfaceNSE_withEvaporation_component(XSpatialOperatorMk2 XOp, XNSFE_OperatorConfiguration config, int d, int D, 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.MomentumEquationComponent(d); if (!XOp.CodomainVar.Contains(CodName)) { throw new ArgumentException("CoDomain variable \"" + CodName + "\" is not defined in Spatial Operator"); } PhysicalParameters physParams = config.getPhysParams; ThermalParameters thermParams = config.getThermParams; DoNotTouchParameters dntParams = config.getDntParams; // set species arguments double rhoA = physParams.rho_A; double rhoB = physParams.rho_B; double muA = physParams.mu_A; double muB = physParams.mu_B; double sigma = physParams.Sigma; // compute further arguments double hVapA = thermParams.hVap_A; double hVapB = thermParams.hVap_B; double Tsat = thermParams.T_sat; double f = config.thermParams.fc; double R = config.thermParams.Rc; double R_int = 0.0; if (config.thermParams.hVap_A > 0 && config.thermParams.hVap_B < 0) { R_int = ((2.0 - f) / (2 * f)) * Tsat * Math.Sqrt(2 * Math.PI * R * Tsat) / (rhoB * hVapA.Pow2()); //T_intMin = Tsat * (1 + (pc / (rhoA * hVapA.Pow2()))); } else if (config.thermParams.hVap_A < 0 && config.thermParams.hVap_B > 0) { R_int = ((2.0 - f) / (2 * f)) * Tsat * Math.Sqrt(2 * Math.PI * R * Tsat) / (rhoA * hVapB.Pow2()); //T_intMin = Tsat * (1 + (pc / (rhoB * hVapB.Pow2()))); } //double prescrbM = config.prescribedMassflux; // set components var comps = XOp.EquationComponents[CodName]; if (config.isTransport) { comps.Add(new ConvectionAtLevelSet_nonMaterialLLF(d, D, LsTrk, rhoA, rhoB, thermParams, R_int, sigma)); comps.Add(new ConvectionAtLevelSet_Consistency(d, D, LsTrk, rhoA, rhoB, dntParams.ContiSign, dntParams.RescaleConti, thermParams, R_int, sigma)); } //if (config.isPInterfaceSet) { // comps.Add(new GeneralizedPressureFormAtLevelSet(d, LsTrk, thermParams.p_sat, thermParams.hVap_A)); //} if (config.isViscous) { comps.Add(new ViscosityAtLevelSet_FullySymmetric_withEvap(LsTrk, muA, muB, dntParams.PenaltySafety, d, rhoA, rhoB, thermParams, R_int, sigma)); } comps.Add(new MassFluxAtInterface(d, D, LsTrk, rhoA, rhoB, thermParams, R_int, sigma)); }
//======================== // 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)); } }
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)); } }
//============== // 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)); } } }
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)); } } }
/// <summary> /// ctor for the operator factory, where the equation compnents are set /// </summary> /// <param name="config"></param> /// <param name="_LsTrk"></param> /// <param name="_HMFdegree"></param> /// <param name="BcMap"></param> /// <param name="degU"></param> public XRheology_OperatorFactory(XRheology_OperatorConfiguration config, LevelSetTracker _LsTrk, int _HMFdegree, IncompressibleMultiphaseBoundaryCondMap BcMap, int _stressDegree, int degU) { this.LsTrk = _LsTrk; this.D = _LsTrk.GridDat.SpatialDimension; this.HMFDegree = _HMFdegree; this.physParams = config.getPhysParams; this.dntParams = config.getDntParams; this.useJacobianForOperatorMatrix = config.isUseJacobian; this.useArtificialDiffusion = config.isUseArtificialDiffusion; // test input // ========== { if (config.getDomBlocks.GetLength(0) != 3 || config.getCodBlocks.GetLength(0) != 3) { throw new ArgumentException(); } //if ((config.getPhysParams.Weissenberg_a <= 0) && (config.getPhysParams.Weissenberg_a <= 0)) { // config.isOldroydB = false; //} else { // if ((config.getPhysParams.mu_A <= 0) || (config.getPhysParams.mu_B <= 0)) // throw new ArgumentException(); //} //if ((config.getPhysParams.reynolds_A <= 0) && (config.getPhysParams.reynolds_B <= 0)) { // config.isViscous = false; //} else { // if ((config.getPhysParams.reynolds_A <= 0) || (config.getPhysParams.reynolds_B <= 0)) // throw new ArgumentException(); //if ((config.getPhysParams.rho_A <= 0) || (config.getPhysParams.rho_B <= 0)) // throw new ArgumentException(); if (_LsTrk.SpeciesNames.Count != 2) { throw new ArgumentException(); } if (!(_LsTrk.SpeciesNames.Contains("A") && _LsTrk.SpeciesNames.Contains("B"))) { throw new ArgumentException(); } } // full operator: // ============== CodName = ArrayTools.Cat(EquationNames.MomentumEquations(this.D), EquationNames.ContinuityEquation, EquationNames.Constitutive(this.D)); Params = ArrayTools.Cat( VariableNames.Velocity0Vector(this.D), VariableNames.Velocity0MeanVector(this.D), VariableNames.VelocityX_GradientVector(), VariableNames.VelocityY_GradientVector(), VariableNames.StressXXP, VariableNames.StressXYP, VariableNames.StressYYP, // "artificialViscosity", VariableNames.NormalVector(this.D), VariableNames.Curvature, VariableNames.SurfaceForceVector(this.D) ); DomName = ArrayTools.Cat(VariableNames.VelocityVector(this.D), VariableNames.Pressure, VariableNames.StressXX, VariableNames.StressXY, VariableNames.StressYY); // selected part: if (config.getCodBlocks[0]) { CodNameSelected = ArrayTools.Cat(CodNameSelected, CodName.GetSubVector(0, this.D)); } if (config.getCodBlocks[1]) { CodNameSelected = ArrayTools.Cat(CodNameSelected, CodName.GetSubVector(this.D, 1)); } if (config.getCodBlocks[2]) { CodNameSelected = ArrayTools.Cat(CodNameSelected, CodName.GetSubVector(this.D + 1, 3)); } if (config.getDomBlocks[0]) { DomNameSelected = ArrayTools.Cat(DomNameSelected, DomName.GetSubVector(0, this.D)); } if (config.getDomBlocks[1]) { DomNameSelected = ArrayTools.Cat(DomNameSelected, DomName.GetSubVector(this.D, 1)); } if (config.getDomBlocks[2]) { DomNameSelected = ArrayTools.Cat(DomNameSelected, DomName.GetSubVector(this.D + 1, 3)); } // create Operator // =============== m_XOp = new XSpatialOperatorMk2(DomNameSelected, Params, CodNameSelected, (A, B, C) => _HMFdegree, this.LsTrk.SpeciesIdS.ToArray()); // add components // ============================ // species bulk components for (int spc = 0; spc < LsTrk.TotalNoOfSpecies; spc++) { // Navier Stokes equations XOperatorComponentsFactory.AddSpeciesNSE(m_XOp, config, this.D, LsTrk.SpeciesNames[spc], LsTrk.SpeciesIdS[spc], BcMap, LsTrk, out U0meanrequired); // continuity equation if (config.isContinuity) { XOperatorComponentsFactory.AddSpeciesContinuityEq(m_XOp, config, this.D, LsTrk.SpeciesNames[spc], LsTrk.SpeciesIdS[spc], BcMap); } // constitutive equation XConstitutiveOperatorComponentsFactory.AddSpeciesConstitutive(m_XOp, config, this.D, stressDegree, LsTrk.SpeciesNames[spc], LsTrk.SpeciesIdS[spc], BcMap, LsTrk, out U0meanrequired); } // interface components XOperatorComponentsFactory.AddInterfaceNSE(m_XOp, config, this.D, BcMap, LsTrk); // surface stress tensor XOperatorComponentsFactory.AddSurfaceTensionForce(m_XOp, config, this.D, BcMap, LsTrk, degU, out NormalsRequired, out CurvatureRequired); // surface tension force XConstitutiveOperatorComponentsFactory.AddInterfaceConstitutive(m_XOp, config, this.D, BcMap, LsTrk); //viscosity of stresses at constitutive if (config.isContinuity) { XOperatorComponentsFactory.AddInterfaceContinuityEq(m_XOp, config, this.D, LsTrk); // continuity equation } m_XOp.Commit(); }
//======================= // Constitutive equations fo viscoelastic multiphase flow //======================= /// <summary> /// /// </summary> /// <param name="XOp"></param> /// <param name="d"></param> /// <param name="D"></param> /// <param name="spcName"></param> /// <param name="spcId"></param> /// <param name="BcMap"></param> /// <param name="config"></param> /// <param name="LsTrk"></param> /// <param name="U0meanrequired"></param> public static void AddSpeciesConstitutive_component(XSpatialOperatorMk2 XOp, IRheology_Configuration config, int d, int D, int stressDegree, string spcName, SpeciesId spcId, IncompressibleMultiphaseBoundaryCondMap BcMap, LevelSetTracker LsTrk, out bool U0meanrequired) { // check input if (XOp.IsCommited) { throw new InvalidOperationException("Spatial Operator is already comitted. Adding of new components is not allowed"); } string CodName; if (d == 0) { CodName = EquationNames.ConstitutiveXX; } else if (d == 1) { CodName = EquationNames.ConstitutiveXY; } else if (d == 2) { CodName = EquationNames.ConstitutiveYY; } else { throw new NotSupportedException("Invalid index (3D not supported), d is: " + d); } 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; // set species arguments double WiSpc, betaSpc, giesekusfactorSpc; switch (spcName) { case "A": { WiSpc = physParams.Weissenberg_a; betaSpc = physParams.beta_a; giesekusfactorSpc = physParams.giesekusfactor_a; break; } case "B": { WiSpc = physParams.Weissenberg_b; betaSpc = physParams.beta_b; giesekusfactorSpc = physParams.giesekusfactor_b; break; } default: throw new ArgumentException("Unknown species."); } // set components var comps = XOp.EquationComponents[CodName]; // identity part // =================== var identity = new IdentityInBulk(d, giesekusfactorSpc, WiSpc, betaSpc, spcName, spcId); //var identity = new IdentityInBulk(d, spcName, spcId); comps.Add(identity); U0meanrequired = false; if (config.isOldroydB) { // convective operator // =================== var convective = new ConvectiveInBulk(d, BcMap, WiSpc, dntParams.alpha, spcName, spcId); comps.Add(convective); U0meanrequired = true; // objective operator // =================== var objective = new ObjectiveInBulk(d, BcMap, WiSpc, dntParams.StressPenalty, spcName, spcId); comps.Add(objective); } // viscous operator // ================== var viscosity = new ViscosityInBulk(d, BcMap, betaSpc, dntParams.Penalty1, spcName, spcId); comps.Add(viscosity); // artificial diffusion // ===================== if (config.isUseArtificialDiffusion == true) { throw new NotImplementedException(); // if (d == 0) // var diffusion = new DiffusionInBulk(stressDegree, D, ((GridData)GridData).Cells.cj, VariableNames.StressXX); // comps.Add(diffusion); // if (d == 1) // var diffusion = new DiffusionInBulk(stressDegree, D, ((GridData)GridData).Cells.cj, VariableNames.StressXY); // comps.Add(diffusion); // if (d == 2) // var diffusion = new DiffusionInBulk(stressDegree, D, ((GridData)GridData).Cells.cj, VariableNames.StressYY); // comps.Add(diffusion); } }
/// <summary> /// /// </summary> /// <param name="XOp"></param> /// <param name="config"></param> /// <param name="d"></param> /// <param name="D"></param> /// <param name="BcMap"></param> /// <param name="LsTrk"></param> public static void AddInterfaceConstitutive_component(XSpatialOperatorMk2 XOp, IRheology_Configuration config, int d, int D, IncompressibleMultiphaseBoundaryCondMap BcMap, LevelSetTracker LsTrk, out bool U0meanrequired) { // check input if (XOp.IsCommited) { throw new InvalidOperationException("Spatial Operator is already comitted. Adding of new components is not allowed"); } string CodName; if (d == 0) { CodName = EquationNames.ConstitutiveXX; } else if (d == 1) { CodName = EquationNames.ConstitutiveXY; } else if (d == 2) { CodName = EquationNames.ConstitutiveYY; } else { throw new NotSupportedException("Invalid index (3D not supported), d is: " + d); } 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; // set components var comps = XOp.EquationComponents[CodName]; // identity part: local variable, therefore no contribution at interface! // =================== U0meanrequired = false; if (config.isOldroydB) { // convective operator // =================== var convective = new ConvectiveAtLevelSet(LsTrk, d, physParams.Weissenberg_a, physParams.Weissenberg_b, dntParams.alpha); comps.Add(convective); U0meanrequired = true; // objective operator // =================== var objective = new ObjectiveAtLevelSet(LsTrk, d, physParams.Weissenberg_a, physParams.Weissenberg_b); comps.Add(objective); } // viscous operator // ================== var viscosity = new ViscosityAtLevelSet(LsTrk, d, physParams.beta_a, physParams.beta_b, dntParams.Penalty1, dntParams.UseWeightedAverages); comps.Add(viscosity); }
/// <summary> /// /// </summary> /// <param name="XOp"></param> /// <param name="config"></param> /// <param name="d"></param> /// <param name="D"></param> /// <param name="BcMap"></param> /// <param name="LsTrk"></param> public static void AddInterfaceConstitutive_component(XSpatialOperatorMk2 XOp, IXNSE_Configuration config, int d, int D, 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; if (d == 0) { CodName = EquationNames.ConstitutiveXX; } else if (d == 1) { CodName = EquationNames.ConstitutiveXY; } else if (d == 2) { CodName = EquationNames.ConstitutiveYY; } else { throw new NotSupportedException("Invalid index (3D not supported), d is: " + d); } 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; // 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; // set components var comps = XOp.EquationComponents[CodName]; // identity part // =================== var identity = new IdentityAtLevelSet(LsTrk, d); comps.Add(identity); // viscous operator // ================== var viscosity = new ViscosityAtLevelSet(LsTrk, d, physParams.beta_a, physParams.beta_b, dntParams.Penalty1); comps.Add(viscosity); }