/// <summary> /// Ctor. /// </summary> /// <param name="SolverConf"></param> /// <param name="WorkingSet"></param> /// <param name="WorkingSetMatrices"></param> public BaseSIMPLEStepVariableDensity(SolverConfiguration SolverConf, VariableSet WorkingSet, VariableMatrices WorkingSetMatrices) { this.SolverConf = SolverConf; this.WorkingSet = WorkingSet; this.WorkingSetMatrices = WorkingSetMatrices; // Construct BDF scheme for unsteady solver if (SolverConf.Control.Algorithm == SolutionAlgorithms.Unsteady_SIMPLE) { BDF = new BDFScheme(); } // Construct SIMPLEOperators UnsetteledCoordinateMapping VelocityMapping = new UnsetteledCoordinateMapping(WorkingSet.VelBasis); UnsetteledCoordinateMapping PressureMapping = new UnsetteledCoordinateMapping(WorkingSet.PressureBasis); Basis[] VelBasisS = new Basis[SolverConf.SpatialDimension]; for (int d = 0; d < SolverConf.SpatialDimension; d++) { VelBasisS[d] = WorkingSet.VelBasis; } UnsetteledCoordinateMapping VelocityVectorMapping = new UnsetteledCoordinateMapping(VelBasisS); OperatorsFlowField = GetOperatorsFlowField(VelocityMapping, VelocityVectorMapping, PressureMapping); // Construct matrix assemblies MatrixAssembliesFlowField = new MatrixFactoryVariableDensityFlowField( SolverConf, OperatorsFlowField, WorkingSetMatrices.Rho.Matrix, BDF, VelocityMapping, VelocityVectorMapping); }
/// <summary> /// Ctor for incompressible flows. /// </summary> /// <param name="VelocityMapping"></param> /// <param name="Velocity"></param> /// <param name="VelocityMean"></param> /// <param name="SolverConf"></param> /// <param name="SpatialComponent"> /// Spatial component index of velocity (i.e. u_i) for affine part of operator. /// The operator matrix is the same for all spatial directions. /// Therefore, if SpatialComponent!=0, only the affine part of the operator is calculated. /// </param> public MomentumConvectionOperator(UnsetteledCoordinateMapping VelocityMapping, VectorField <SinglePhaseField> Velocity, VectorField <SinglePhaseField> VelocityMean, SolverConfiguration SolverConf, int SpatialComponent) : base(VelocityMapping, VelocityMapping, ArrayTools.Cat <SinglePhaseField>(Velocity.ToArray(), VelocityMean.ToArray()), SolverConf, false, SpatialComponent, OnlyAffine: (SpatialComponent != 0)) { }
/// <summary> /// Ctor. /// </summary> /// <param name="TemperatureMapping"></param> /// <param name="Velocity0"></param> /// <param name="Velocity0Mean"></param> /// <param name="Temperature0"></param> /// <param name="Temperature0Mean"></param> /// <param name="SolverConf"></param> public OperatorFactoryTemperature(UnsetteledCoordinateMapping TemperatureMapping, UnsetteledCoordinateMapping PressureMapping, VectorField <SinglePhaseField> Velocity0, VectorField <SinglePhaseField> Velocity0Mean, SinglePhaseField Temperature0, SinglePhaseField Temperature0Mean, SolverConfiguration SolverConf) { this.TemperatureConvection = new TemperatureConvectionOperator(TemperatureMapping, Velocity0, Velocity0Mean, Temperature0, Temperature0Mean, SolverConf); this.HeatConduction = new HeatConductionOperator(TemperatureMapping, Temperature0, SolverConf); }
/// <summary> /// [VariableDensity] Ctor. /// </summary> /// <param name="SolverConf"></param> /// <param name="Src"></param> /// <param name="BDF"></param> /// <param name="Rho"></param> /// <param name="MaxUseMatrix"></param> public MatrixAssemblyApprox(SolverConfiguration SolverConf, int NoOfCells, SIMPLEMatrixAssembly Src, BDFScheme BDF, BlockDiagonalMatrix Rho, int MaxUseMatrix = 1) : base(SolverConf.Control.PredictorApproximationIsConstant, false, MaxUsePerIterMatrix: MaxUseMatrix) { m_SolverConf = SolverConf; m_Src = Src; m_BDF = BDF; m_NoOfCells = NoOfCells; if (Rho != null) { // VariableDensity m_Rho = Rho; if (m_Src.i0 != m_Rho.RowPartitioning.i0) { throw new NotImplementedException("Different row partitions, which should be equal."); } } else { // Incompressible m_Rho = new BlockDiagonalMatrix(m_Src.LocalLength, 1); m_Rho.AccEyeSp(); } base.Initialize(); }
/// <summary> /// Ctor. /// </summary> /// <param name="SolverConf"></param> /// <param name="WorkingSet"></param> public SIMPLEStepIncompressible(SolverConfiguration SolverConf, VariableSet WorkingSet) { m_SolverConf = SolverConf; m_WorkingSet = WorkingSet; // Construct BDF scheme for unsteady solver if (SolverConf.Control.Algorithm == SolutionAlgorithms.Unsteady_SIMPLE) { m_BDF = new BDFScheme(); } // Construct all SIMPLEOperators, which are needed for incompressible flows UnsetteledCoordinateMapping VelocityMapping = new UnsetteledCoordinateMapping(WorkingSet.VelBasis); UnsetteledCoordinateMapping PressureMapping = new UnsetteledCoordinateMapping(WorkingSet.PressureBasis); m_IncompressibleOperators = new OperatorFactoryFlowFieldIncompressible(VelocityMapping, PressureMapping, SolverConf, WorkingSet.Velocity.Current, WorkingSet.VelocityMean); // Construct matrix assemblies m_IncompressibleMatrixAssemblies = new MatrixFactoryIncompressibleFlows( SolverConf, m_IncompressibleOperators, PressureMapping, WorkingSet.Pressure, m_BDF); }
/// <summary> /// Ctor /// </summary> /// <param name="RowMapping"></param> /// <param name="ColMapping"></param> /// <param name="ParameterFields"> /// Paramter fields for SpatialOperator - can be null. /// </param> /// <param name="SolverConf"> /// Solver configuration. /// </param> /// <param name="IsConstant"> /// If true, the operator is constant over time and SIMPLE iterations. /// That is the case for most operatores. /// Only operators like e.g. the <see cref="LinearizedConvection"/> are not constant. /// </param> /// <param name="ArgumentIndex"> /// Argument index of dependent variable, e.g. spatial component u_i, for SpatialOperator /// - this parameter is optional. /// </param> /// <param name="SpatialDirection"> /// Spatial direction index of independent variable, e.g. diff(p, x_i), for SpatialOperator /// - this parameter is optional. /// </param> /// <param name="OnlyAffine"> /// If true, only the affine part of the operator is calculated. /// </param> /// <param name="OnlyBoundaryEdges"> /// If true, the integration for calculating the affine part is carried out /// only on the boundary edges. Can be set to true for most operators. /// </param> /// <param name="MaxUsePerIterMatrix"> /// For operators which are not constant the maximum number /// the matrix can be called via <see cref="OperatorMatrix"/> in one SIMPLE iteration. /// </param> /// <param name="MaxUsePerIterAffine"> /// For operators which are not constant the maximum number /// the affine part can be called via <see cref="OperatorAffine"/> in one SIMPLE iteration. /// </param> protected SIMPLEOperator(UnsetteledCoordinateMapping RowMapping, UnsetteledCoordinateMapping ColMapping, SinglePhaseField[] ParameterFields, SolverConfiguration SolverConf, bool IsConstant, int ArgumentIndex = -1, int SpatialDirection = -1, bool OnlyAffine = false, bool OnlyBoundaryEdges = true, int MaxUsePerIterMatrix = 1, int MaxUsePerIterAffine = 1) { m_RowMapping = RowMapping; m_ColMapping = ColMapping; m_ParameterFields = ParameterFields; m_IsConstant = IsConstant; m_OnlyAffine = OnlyAffine; m_OnlyBoundaryEdges = OnlyBoundaryEdges; m_MaxUsePerIterMatrix = MaxUsePerIterMatrix; m_MaxUsePerIterAffine = MaxUsePerIterAffine; // Get SpatialOperator m_SpatialOperator = GetSpatialOperator(SolverConf, ArgumentIndex, SpatialDirection); // Initialize and compute matrix of this operator if (!m_OnlyAffine) { m_OperatorMatrix = new MsrMatrix(m_RowMapping, m_ColMapping); ComputeMatrix(); } // Initialize and compute affine part of this operator m_OperatorAffine = new double[m_RowMapping.LocalLength]; ComputeAffine(); }
protected override SpatialOperator GetSpatialOperator(SolverConfiguration SolverConf, int SpatialComponent, int SpatialDirection) { return((new PressureStabilization( SolverConf.Control.PressureStabilizationScaling, base.GridData.Edges.h_max_Edge, SolverConf.Control.Reynolds)).Operator()); }
/// <summary> /// Ctor. /// </summary> /// <param name="SolverConf"></param> /// <param name="WorkingSet"></param> /// <param name="WorkingSetMatrices"></param> public SIMPLEStepLowMach(SolverConfiguration SolverConf, VariableSet WorkingSet, VariableMatrices WorkingSetMatrices) : base(SolverConf, WorkingSet, WorkingSetMatrices) { this.LowMachControl = SolverConf.Control as LowMachSIMPLEControl; if (this.LowMachControl == null) { throw new ArgumentException("Invalid config", nameof(SolverConf)); } // Construct SIMPLEOperators UnsetteledCoordinateMapping TemperatureMapping = new UnsetteledCoordinateMapping(WorkingSet.TemperatureBasis); UnsetteledCoordinateMapping PressureMapping = new UnsetteledCoordinateMapping(WorkingSet.PressureBasis); OperatorsTemperature = new OperatorFactoryTemperature( TemperatureMapping, PressureMapping, base.WorkingSet.Velocity.Current, base.WorkingSet.VelocityMean, base.WorkingSet.Temperature.Current, base.WorkingSet.TemperatureMean, SolverConf); // Construct matrix assemblies MatrixAssembliesTemperature = new MatrixFactoryTemperature( OperatorsTemperature, TemperatureMapping.GridDat.iLogicalCells.NoOfLocalUpdatedCells, WorkingSetMatrices.Rho.Matrix, SolverConf, base.BDF); }
/// <summary> /// Ctor. /// </summary> /// <param name="VelocityMapping"></param> /// <param name="VelocityVectorMapping"></param> /// <param name="PressureMapping"></param> /// <param name="SolverConf"></param> /// <param name="Velocity0"></param> /// <param name="Velocity0Mean"></param> /// <param name="Phi0"></param> /// <param name="Phi0Mean"></param> /// <param name="eta"></param> public OperatorFactoryFlowFieldMultiphase(UnsetteledCoordinateMapping VelocityMapping, UnsetteledCoordinateMapping VelocityVectorMapping, UnsetteledCoordinateMapping PressureMapping, SolverConfiguration SolverConf, VectorField <SinglePhaseField> Velocity0, VectorField <SinglePhaseField> Velocity0Mean, SinglePhaseField Phi0, SinglePhaseField Phi0Mean, SinglePhaseField eta) : base(VelocityMapping, VelocityVectorMapping, PressureMapping, SolverConf, Velocity0, Velocity0Mean, Phi0, Phi0Mean, eta) { }
protected override SpatialOperator GetSpatialOperator(SolverConfiguration SolverConf, int SpatialComponent, int SpatialDirection) { LowMachSIMPLEControl lowMachControl = SolverConf.Control as LowMachSIMPLEControl; return((new swipHeatConduction(lowMachControl.Reynolds, lowMachControl.Prandtl, lowMachControl.EoS, SolverConf.PenaltyHeatConduction, base.GridData.Cells.cj, SolverConf.BcMap)).Operator()); }
/// <summary> /// Ctor. /// </summary> /// <param name="TemperatureMapping"></param> /// <param name="Velocity0"></param> /// <param name="Velocity0Mean"></param> /// <param name="Temperature0"></param> /// <param name="Temperature0Mean"></param> /// <param name="SolverConf"></param> public TemperatureConvectionOperator(UnsetteledCoordinateMapping TemperatureMapping, VectorField <SinglePhaseField> Velocity0, VectorField <SinglePhaseField> Velocity0Mean, SinglePhaseField Temperature0, SinglePhaseField Temperature0Mean, SolverConfiguration SolverConf) : base(TemperatureMapping, TemperatureMapping, ArrayTools.Cat <SinglePhaseField>(Velocity0.ToArray(), Velocity0Mean.ToArray(), Temperature0, Temperature0Mean), SolverConf, false) { }
/// <summary> /// Ctor. /// </summary> /// <param name="VelocityMapping"></param> /// <param name="VelocityVectorMapping"></param> /// <param name="PressureMapping"></param> /// <param name="SolverConf"></param> /// <param name="Velocity0"></param> /// <param name="Velocity0Mean"></param> /// <param name="Temperature0"></param> /// <param name="Temperature0Mean"></param> /// <param name="eta"></param> public OperatorFactoryFlowFieldLowMach(UnsetteledCoordinateMapping VelocityMapping, UnsetteledCoordinateMapping VelocityVectorMapping, UnsetteledCoordinateMapping PressureMapping, SolverConfiguration SolverConf, VectorField <SinglePhaseField> Velocity0, VectorField <SinglePhaseField> Velocity0Mean, SinglePhaseField Temperature0, SinglePhaseField Temperature0Mean, SinglePhaseField eta) : base(VelocityMapping, VelocityVectorMapping, PressureMapping, SolverConf, Velocity0, Velocity0Mean, Temperature0, Temperature0Mean, eta) { }
protected override SpatialOperator GetSpatialOperator(SolverConfiguration SolverConf, int SpatialComponent, int SpatialDirection) { VariableDensitySIMPLEControl varDensConf = SolverConf.Control as VariableDensitySIMPLEControl; //To be used with OnlyBoundaryEdges: false //return (new CoupledLaxFriedrichsVelocity(SpatialComponent, SolverConf.SpatialDimension, SolverConf.EoS, SolverConf.BcMap)).Operator(); //To be used with OnlyBoundaryEdges: true return((new LinearizedConvection(SolverConf.SpatialDimension, SolverConf.BcMap, SpatialComponent, varDensConf.EoS)).Operator(2)); }
protected override SpatialOperator GetSpatialOperator(SolverConfiguration SolverConf, int SpatialComponent, int SpatialDirection) { SpatialOperator DivergenceOp = new SpatialOperator(new string[] { VariableNames.Velocity_d(SpatialComponent) }, new string[] { "div_d" }, QuadOrderFunc.Linear()); DivergenceOp.EquationComponents["div_d"].Add(new Divergence_DerivativeSource(SpatialComponent, SolverConf.SpatialDimension)); DivergenceOp.EquationComponents["div_d"].Add(new Divergence_DerivativeSource_Flux(SpatialComponent, SolverConf.BcMap)); DivergenceOp.Commit(); return(DivergenceOp); }
protected override SpatialOperator GetSpatialOperator(SolverConfiguration SolverConf, int SpatialComponent, int SpatialDirection) { //return (new Viscosity(SolverConf.PenaltyViscMomentum, SolverConf.reynolds, SolverConf.BcMap, SpatialComponent, false)).Operator(); return((new swipViscosity_Term1_variante( SolverConf.PenaltyViscMomentum, SpatialComponent, SolverConf.SpatialDimension, SolverConf.BcMap, ViscosityOption.ConstantViscosityDimensionless, reynolds: SolverConf.Control.Reynolds)).Operator()); }
/// <summary> /// Ctor. /// </summary> /// <param name="IPOperator"></param> /// <param name="PressureStabilization"></param> /// <param name="SolverConf"></param> /// <param name="BDF"></param> public MatrixAssemblyCorrectorIP1(SIMPLEOperator IPOperator, SIMPLEOperator PressureStabilization, SolverConfiguration SolverConf, BDFScheme BDF) : base((SolverConf.Control.Algorithm == SolutionAlgorithms.Steady_SIMPLE), false) { m_IPOperator = IPOperator; m_PressureStabilization = PressureStabilization; m_SolverConf = SolverConf; m_BDF = BDF; base.Initialize(); }
/// <summary> /// Ctor. /// </summary> /// <param name="solverConf">Configuration SIMPLE</param> /// <param name="_sparseSolver">Configuration sparse solver</param> protected SIMPLESolver(SolverConfiguration solverConf, ISparseSolver _sparseSolver) { m_solverConf = solverConf; //Create sparse solver m_Solver = _sparseSolver; if (m_Solver == null) { throw new ApplicationException("Sorry - unknown error creating solver."); } }
/// <summary> /// Ctor. /// </summary> public MatrixFactoryTemperature(OperatorFactoryTemperature TemperatureOperators, int LocalNoOfCells, BlockDiagonalMatrix Rho, SolverConfiguration solverConf, BDFScheme BDF) { Temperature = new MatrixAssemblyTemperature(TemperatureOperators.TemperatureConvection, TemperatureOperators.HeatConduction); LowMachSIMPLEControl lowMachControl = solverConf.Control as LowMachSIMPLEControl; if (lowMachControl.RelaxationModeTemperature == RelaxationTypes.Implicit) { TemperatureApprox = new MatrixAssemblyApprox( solverConf, LocalNoOfCells, Temperature, BDF, Rho, 2 * lowMachControl.PredictorApproximationUpdateCycle); } }
protected override SpatialOperator GetSpatialOperator(SolverConfiguration SolverConf, int SpatialComponent, int SpatialDirection) { VariableDensitySIMPLEControl varDensConf = SolverConf.Control as VariableDensitySIMPLEControl; //return (new Viscosity(SolverConf.PenaltyViscMomentum, SolverConf.reynolds, SolverConf.BcMap, SpatialComponent, SolverConf.ConfigVariableDensity.EoS)).Operator(); return((new swipViscosity_Term1_variante(SolverConf.PenaltyViscMomentum, SpatialComponent, SolverConf.SpatialDimension, SolverConf.BcMap, ViscosityOption.VariableViscosityDimensionless, reynolds: varDensConf.Reynolds, EoS: varDensConf.EoS)).Operator(2)); }
protected override SpatialOperator GetSpatialOperator(SolverConfiguration SolverConf, int SpatialComponent, int SpatialDirection) { VariableDensitySIMPLEControl varDensConf = SolverConf.Control as VariableDensitySIMPLEControl; return((new swipViscosity_Term3(SolverConf.PenaltyViscMomentum, SpatialDirection, SolverConf.SpatialDimension, SolverConf.BcMap, ViscosityOption.VariableViscosityDimensionless, ViscositySolverMode.Segregated, reynolds: SolverConf.Control.Reynolds, EoS: varDensConf.EoS)).Operator(2)); }
protected override SpatialOperator GetSpatialOperator(SolverConfiguration SolverConf, int SpatialComponent, int SpatialDirection) { SpatialOperator PressureOp = new SpatialOperator(new string[] { VariableNames.Pressure }, new string[] { "p1" }, QuadOrderFunc.Linear()); PressureOp.EquationComponents["p1"].Add(new PressureGradientLin_d(SpatialDirection, SolverConf.BcMap)); if (SolverConf.Control.PressureGradientSource != null) { PressureOp.EquationComponents["p1"].Add( new SrcPressureGradientLin_d(SolverConf.Control.PressureGradientSource[SpatialDirection])); } PressureOp.Commit(); return(PressureOp); }
/// <summary> /// Ctor without pressure stabilization. /// </summary> /// <param name="solverConfig"></param> /// <param name="_sparseSolver"></param> /// <param name="VelocityDivergence"></param> /// <param name="MatAsmblyCorrector"></param> /// <param name="Velocity_Intrmed"></param> /// <param name="DivB4"></param> public MultiphaseSolverCorrector(SolverConfiguration solverConfig, ISparseSolver _sparseSolver, SIMPLEOperator[] VelocityDivergence, SIMPLEMatrixAssembly MatAsmblyCorrector, VectorField <SinglePhaseField> Velocity_Intrmed, SinglePhaseField DivB4) : base(solverConfig, _sparseSolver) { if ((VelocityDivergence.Length != solverConfig.SpatialDimension) || (Velocity_Intrmed.Dim != solverConfig.SpatialDimension)) { throw new ArgumentException("Mismatch of dimensions!"); } m_VelocityDivergence = VelocityDivergence; m_MatAsmblyCorrector = MatAsmblyCorrector; m_Velocity_Intrmed = Velocity_Intrmed; m_DivB4 = DivB4; }
/// <summary> /// Ctor. /// </summary> /// <param name="solverConf"></param> /// <param name="sparseSolver"></param> /// <param name="MatAsmblyScalar"></param> /// <param name="MatAsmblyScalarApprox"></param> /// <param name="Scalar"></param> /// <param name="BDF"></param> public MultiphaseSolverLevelSet(SolverConfiguration solverConf, ISparseSolver sparseSolver, SIMPLEMatrixAssembly MatAsmblyScalar, SIMPLEMatrixAssembly MatAsmblyScalarApprox, ScalarFieldHistory <SinglePhaseField> Scalar, BDFScheme BDF) : base(solverConf, sparseSolver) { m_MatAsmblyLevelSet = MatAsmblyScalar; m_MatAsmblyLevelSetApprox = MatAsmblyScalarApprox; m_LevelSet = Scalar; m_solverConf = solverConf; m_multiphaseControl = solverConf.Control as MultiphaseSIMPLEControl; m_RelaxFactor = (1.0 - m_multiphaseControl.RelaxationFactorLevelSet) / m_multiphaseControl.RelaxationFactorLevelSet; m_ModeRelaxLevelSet = m_multiphaseControl.LevelSetRelaxationType; m_BDF = BDF; }
/// <summary> /// /// </summary> protected override void CreateFields() { using (new FuncTrace()) { // create fields for flow field WorkingSet = new VariableSet(base.GridData, Control, base.m_IOFields, base.m_RegisteredFields); // create extended fields for variable density solvers WorkingSet.CreateExtendedVariables(Control); // read settings for SIMPLE-algorithm SolverConf = new SolverConfiguration( Control, GridData, WorkingSet, base.MPIRank); // Plot analytic solution PlotAnalyticSolution(Control.AnalyticVelocityX, WorkingSet.VelBasis, "VelocityX_Ana"); PlotAnalyticSolution(Control.AnalyticVelocityY, WorkingSet.VelBasis, "VelocityY_Ana"); if (SolverConf.SpatialDimension == 3) { PlotAnalyticSolution(Control.AnalyticVelocityZ, WorkingSet.VelBasis, "VelocityZ_Ana"); } PlotAnalyticSolution(Control.AnalyticPressure, WorkingSet.PressureBasis, "Pressure_Ana"); switch (Control.PhysicsMode) { case PhysicsMode.Incompressible: break; case PhysicsMode.LowMach: LowMachSIMPLEControl lowMachConf = Control as LowMachSIMPLEControl; PlotAnalyticSolution(lowMachConf.AnalyticTemperature, WorkingSet.TemperatureBasis, "Temperature_Ana"); PlotAnalyticSolution(lowMachConf.AnalyticDensity, WorkingSet.TemperatureBasis, "Density_Ana"); break; case PhysicsMode.Multiphase: MultiphaseSIMPLEControl multiphaseConf = Control as MultiphaseSIMPLEControl; PlotAnalyticSolution(multiphaseConf.AnalyticLevelSet, WorkingSet.LevelSetBasis, "LevelSet_Ana"); PlotAnalyticSolution(multiphaseConf.AnalyticDensity, WorkingSet.LevelSetBasis, "Density_Ana"); break; default: throw new NotImplementedException(); } } }
/// <summary> /// Ctor /// </summary> /// <param name="VelocityMapping"></param> /// <param name="PressureMapping"></param> /// <param name="SolverConf"></param> /// <param name="Velocity"></param> /// <param name="VelocityMean"> /// VelocityMean for convective operator. /// </param> public OperatorFactoryFlowFieldIncompressible(UnsetteledCoordinateMapping VelocityMapping, UnsetteledCoordinateMapping PressureMapping, SolverConfiguration SolverConf, VectorField <SinglePhaseField> Velocity, VectorField <SinglePhaseField> VelocityMean) { // Standard operators, which are always used this.Convection = new SIMPLEOperator[SolverConf.SpatialDimension]; this.Visc = new SIMPLEOperator[SolverConf.SpatialDimension]; this.PressureGradient = new SIMPLEOperator[SolverConf.SpatialDimension]; this.VelocityDivergence = new SIMPLEOperator[SolverConf.SpatialDimension]; for (int d = 0; d < SolverConf.SpatialDimension; d++) { this.Convection[d] = new MomentumConvectionOperator(VelocityMapping, Velocity, VelocityMean, SolverConf, d); this.Visc[d] = new MomentumViscousOperator(VelocityMapping, SolverConf, d); this.PressureGradient[d] = new MomentumPressureGradientOperator(VelocityMapping, PressureMapping, SolverConf, d); this.VelocityDivergence[d] = new DivergenceVelocityOperator(PressureMapping, VelocityMapping, SolverConf, d); } // Optional pressure stabilization (needed for equal-order discretization) if (SolverConf.Control.PressureStabilizationScaling > 0.0) { this.PressureStabilization = new DivergencePressureStabilization(PressureMapping, SolverConf); } else { this.PressureStabilization = null; } // Alternative pressure correction replacing M_Div*M_Grad with SIP-discretization switch (SolverConf.Control.PredictorApproximation) { case PredictorApproximations.Identity: case PredictorApproximations.Diagonal: case PredictorApproximations.BlockDiagonal: this.IP1PressureCorrection = null; break; case PredictorApproximations.Identity_IP1: this.IP1PressureCorrection = new IP1_PressureCorrectionOperator(PressureMapping, SolverConf); break; default: throw new NotImplementedException(); } }
/// <summary> /// Ctor. /// </summary> /// <param name="solverConf"></param> /// <param name="_sparseSolver"></param> /// <param name="MatAsmblyCorrector"></param> /// <param name="VelocityDivergence"></param> /// <param name="Velocity_Intrmed"></param> /// <param name="DivB4"></param> /// <param name="BDF"></param> /// <param name="Temperature"></param> /// <param name="EoS"></param> public LowMachSolverCorrector(SolverConfiguration solverConf, ISparseSolver _sparseSolver, SIMPLEMatrixAssembly MatAsmblyCorrector, SIMPLEOperator[] VelocityDivergence, VectorField <SinglePhaseField> Velocity_Intrmed, SinglePhaseField DivB4, BDFScheme BDF, ScalarFieldHistory <SinglePhaseField> Temperature, MaterialLaw EoS, double[] RHSManuDivKontiOperatorAffine = null) : base(solverConf, _sparseSolver) { this.MatAsmblyCorrector = MatAsmblyCorrector; this.VelocityDivergence = VelocityDivergence; this.Velocity_Intrmed = Velocity_Intrmed; this.DivB4 = DivB4; this.BDF = BDF; this.Temperature = Temperature; this.EoS = EoS; this.RHSManuDivKontiOperatorAffine = RHSManuDivKontiOperatorAffine; }
/// <summary> /// Ctor. /// </summary> /// <param name="solverConf"></param> /// <param name="_sparseSolver"></param> /// <param name="MatAsmblyPredictor"></param> /// <param name="MatAsmblyPredictorApprox"></param> /// <param name="PressureGradient"></param> /// <param name="BDF"></param> /// <param name="Velocity"></param> /// <param name="Pressure"></param> public SolverPredictor(SolverConfiguration solverConf, ISparseSolver _sparseSolver, SIMPLEMatrixAssembly[] MatAsmblyPredictor, SIMPLEMatrixAssembly MatAsmblyPredictorApprox, SIMPLEOperator[] PressureGradient, BDFScheme BDF, VectorFieldHistory <SinglePhaseField> Velocity, SinglePhaseField Pressure) : base(solverConf, _sparseSolver) { m_SolverConf = solverConf; m_MatAsmblyPredictor = MatAsmblyPredictor; m_MatAsmblyPredictorApprox = MatAsmblyPredictorApprox; m_PressureGradient = PressureGradient; m_BDF = BDF; m_Velocity = Velocity; m_Pressure = Pressure; m_RelaxFactor = (1.0 - base.m_solverConf.Control.RelexationFactorVelocity) / base.m_solverConf.Control.RelexationFactorVelocity; }
/// <summary> /// Ctor. /// </summary> /// <param name="SolverConf"></param> /// <param name="WorkingSet"></param> /// <param name="WorkingSetMatrices"></param> public SIMPLEStepMultiphase(SolverConfiguration SolverConf, VariableSet WorkingSet, VariableMatrices WorkingSetMatrices) : base(SolverConf, WorkingSet, WorkingSetMatrices) { this.SolverConf = SolverConf; this.MultiphaseControl = SolverConf.Control as MultiphaseSIMPLEControl; if (this.MultiphaseControl == null) { throw new ArgumentException("Invalid configuration", nameof(SolverConf)); } // Construct SIMPLEOperators UnsetteledCoordinateMapping LevelSetMapping = new UnsetteledCoordinateMapping(WorkingSet.LevelSetBasis); OperatorsLevelSet = new OperatorFactoryLevelSet(LevelSetMapping, WorkingSet.Velocity.Current, WorkingSet.VelocityMean, SolverConf); // Construct matrix assemblies MatrixAssembliesLevelSet = new MatrixFactoryLevelSet(OperatorsLevelSet, LevelSetMapping.GridDat.iLogicalCells.NoOfLocalUpdatedCells, SolverConf, base.BDF); }
/// <summary> /// Ctor. /// </summary> /// <param name="SolverConf"></param> /// <param name="IncompressibleOperators"></param> /// <param name="PressureMapping"></param> /// <param name="Pressure"></param> /// <param name="BDF"></param> public MatrixFactoryIncompressibleFlows(SolverConfiguration SolverConf, OperatorFactoryFlowFieldIncompressible IncompressibleOperators, UnsetteledCoordinateMapping PressureMapping, SinglePhaseField Pressure, BDFScheme BDF) { // Initialize Predictor Predictor = new SIMPLEMatrixAssembly[SolverConf.SpatialDimension]; for (int d = 0; d < SolverConf.SpatialDimension; d++) { Predictor[d] = new MatrixAssemblyIncompressiblePredictor(IncompressibleOperators.Convection[d], IncompressibleOperators.Visc[d], 2, 1); } PredictorApprox = new MatrixAssemblyApprox( SolverConf, PressureMapping.GridDat.iLogicalCells.NoOfLocalUpdatedCells, Predictor[0], BDF, 1 + (1 + SolverConf.SpatialDimension) * SolverConf.Control.PredictorApproximationUpdateCycle); // Initialize Corrector PredictorApproxInv = new MatrixAssemblyApproxInv( SolverConf.Control, PressureMapping.GridDat.iLogicalCells.NoOfLocalUpdatedCells, PredictorApprox, SolverConf.SpatialDimension + SolverConf.SpatialDimension * SolverConf.Control.PredictorApproximationUpdateCycle); switch (SolverConf.Control.PredictorApproximation) { case PredictorApproximations.Identity: case PredictorApproximations.Diagonal: case PredictorApproximations.BlockDiagonal: Corrector = new MatrixAssemblyIncompressibleCorrector(IncompressibleOperators.VelocityDivergence, PredictorApproxInv, IncompressibleOperators.PressureGradient, SolverConf.Control.PredictorApproximationUpdateCycle, IncompressibleOperators.PressureStabilization); break; case PredictorApproximations.Identity_IP1: Corrector = new MatrixAssemblyCorrectorIP1(IncompressibleOperators.IP1PressureCorrection, IncompressibleOperators.PressureStabilization, SolverConf, BDF); break; default: throw new NotSupportedException("Unknown option for extended property 'Option_Approximation_Predictor'."); } }
/// <summary> /// Ctor. /// </summary> /// <param name="solverConfig"></param> /// <param name="_sparseSolver"></param> /// <param name="DensityMatrix"></param> /// <param name="MatAsmblyTemperature"></param> /// <param name="MatAsmblyTemperatureApprox"></param> /// <param name="Temperature"></param> /// <param name="BDF"></param> /// <param name="EoS"></param> /// <param name="ThermodynamicPressure"></param> public LowMachSolverTemperature(SolverConfiguration solverConfig, ISparseSolver _sparseSolver, BlockDiagonalMatrix DensityMatrix, SIMPLEMatrixAssembly MatAsmblyTemperature, SIMPLEMatrixAssembly MatAsmblyTemperatureApprox, ScalarFieldHistory <SinglePhaseField> Temperature, BDFScheme BDF, MaterialLaw EoS, ScalarFieldHistory <SinglePhaseField> ThermodynamicPressure) : base(solverConfig, _sparseSolver) { this.DensityMatrix = DensityMatrix; this.MatAsmblyTemperature = MatAsmblyTemperature; this.MatAsmblyTemperatureApprox = MatAsmblyTemperatureApprox; LowMachSIMPLEControl lowMachControl = solverConfig.Control as LowMachSIMPLEControl; this.ModeRelaxTemperature = lowMachControl.RelaxationModeTemperature; this.RelaxFactor = (1.0 - lowMachControl.RelexationFactorTemperature) / lowMachControl.RelexationFactorTemperature; this.Temperature = Temperature; this.BDF = BDF; this.EoS = EoS; this.gamma = lowMachControl.Gamma; this.ThermodynamicPressure = ThermodynamicPressure; }