/// <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="SolverConf"></param> /// <param name="OperatorsFlowField"></param> /// <param name="Rho"></param> /// <param name="BDF"></param> /// <param name="VelocityMapping"></param> /// <param name="VelocityVectorMapping"></param> public MatrixFactoryVariableDensityFlowField(SolverConfiguration SolverConf, OperatorFactoryFlowFieldVariableDensity OperatorsFlowField, BlockDiagonalMatrix Rho, BDFScheme BDF, UnsetteledCoordinateMapping VelocityMapping, UnsetteledCoordinateMapping VelocityVectorMapping) { // Initialize Predictor // ==================== ViscSplit = new SIMPLEMatrixAssembly[SolverConf.SpatialDimension, SolverConf.SpatialDimension]; for (int i = 0; i < SolverConf.SpatialDimension; i++) { for (int j = 0; j < SolverConf.SpatialDimension; j++) { switch (SolverConf.Control.PhysicsMode) { case PhysicsMode.LowMach: ViscSplit[i, j] = new MatrixAssemblyViscSplit(OperatorsFlowField.Swip2[i], OperatorsFlowField.Swip3[i], j, VelocityMapping, VelocityVectorMapping); break; case PhysicsMode.Multiphase: ViscSplit[i, j] = new MatrixAssemblyViscSplit(OperatorsFlowField.Swip2[i], null, j, VelocityMapping, VelocityVectorMapping); break; case PhysicsMode.Incompressible: throw new ApplicationException("Using wrong matrix factory for incompressible flows"); default: throw new NotImplementedException(); } } } //SaveMatricesToTextFile(OperatorsFlowField, VelocityMapping, VelocityVectorMapping); Predictor = new SIMPLEMatrixAssembly[SolverConf.SpatialDimension]; PredictorApprox = new SIMPLEMatrixAssembly[SolverConf.SpatialDimension]; PredictorApproxInv = new SIMPLEMatrixAssembly[SolverConf.SpatialDimension]; for (int comp = 0; comp < SolverConf.SpatialDimension; comp++) { Predictor[comp] = new MatrixAssemblyVariableDensityPredictor(comp, OperatorsFlowField.Convection, OperatorsFlowField.Visc, ViscSplit); PredictorApprox[comp] = new MatrixAssemblyApprox(SolverConf, VelocityMapping.GridDat.iLogicalCells.NoOfLocalUpdatedCells, Predictor[comp], BDF, Rho, 1 + 2 * SolverConf.Control.PredictorApproximationUpdateCycle); PredictorApproxInv[comp] = new MatrixAssemblyApproxInv(SolverConf.Control, VelocityMapping.GridDat.iLogicalCells.NoOfLocalUpdatedCells, PredictorApprox[comp], 1 + SolverConf.Control.PredictorApproximationUpdateCycle); } // Initialize Corrector // ==================== switch (SolverConf.Control.PhysicsMode) { case PhysicsMode.LowMach: Corrector = new MatrixAssemblyVariableDensityCorrector(OperatorsFlowField.DivergenceConti, PredictorApproxInv, OperatorsFlowField.PressureGradient); break; case PhysicsMode.Multiphase: Corrector = new MatrixAssemblyVariableDensityCorrector(OperatorsFlowField.DivergenceConti, PredictorApproxInv, OperatorsFlowField.PressureGradient, SolverConf.Control.PredictorApproximationUpdateCycle); break; case PhysicsMode.Incompressible: throw new ApplicationException("Using wrong matrix factory for incompressible flows"); default: throw new NotImplementedException(); } }