Example #1
0
        /// <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();
        }
Example #2
0
 /// <summary>
 /// Ctor.
 /// </summary>
 public MatrixAssemblyApproxInv(SIMPLEControl SolverConf, int LocalNoOfCells, SIMPLEMatrixAssembly Approx, int MaxUseMatrix = 1)
     : base(Approx.IsConstant, false, MaxUsePerIterMatrix: MaxUseMatrix)
 {
     m_Approx         = Approx;
     m_SolverConf     = SolverConf;
     m_LocalNoOfCells = LocalNoOfCells;
     base.Initialize();
 }
        /// <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;
        }
Example #4
0
        /// <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>
        /// Ctor.
        /// </summary>
        /// <param name="DivergenceConti"></param>
        /// <param name="PredictorApproxInv"></param>
        /// <param name="PressureGradient"></param>
        /// <param name="UpdateCycleAppPred"></param>
        /// <param name="PressureStabilization">
        /// Can be null,
        /// i.e. no pressure stabilization is used.
        /// </param>
        public MatrixAssemblyIncompressibleCorrector(SIMPLEOperator[] DivergenceConti, SIMPLEMatrixAssembly PredictorApproxInv, SIMPLEOperator[] PressureGradient,
                                                     int UpdateCycleAppPred, SIMPLEOperator PressureStabilization)
            : base(PredictorApproxInv.IsConstant, false)
        {
            if (DivergenceConti.Length != PressureGradient.Length)
            {
                throw new ArgumentException("Mismatch in dimensions");
            }

            m_DivergenceConti    = DivergenceConti;
            m_PredictorApproxInv = PredictorApproxInv;
            m_PressureGradient   = PressureGradient;

            m_PressureStabilization = PressureStabilization;

            base.Initialize();
        }
        /// <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="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;
        }
Example #10
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="solverConf"></param>
        /// <param name="_sparseSolver"></param>
        /// <param name="DensityMatrix"></param>
        /// <param name="MatAsmblyPredictor"></param>
        /// <param name="MatAsmblyPredictorApprox"></param>
        /// <param name="PressureGradient"></param>
        /// <param name="Pressure"></param>
        /// <param name="MatAsmblyViscSplit"></param>
        /// <param name="BuoyantForce"></param>
        /// <param name="Velocity"></param>
        /// <param name="Scalar"></param>
        /// <param name="EoS"></param>
        /// <param name="BDF"></param>
        public VariableDensitySolverPredictor(SolverConfiguration solverConf, ISparseSolver _sparseSolver,
                                              BlockDiagonalMatrix DensityMatrix, SIMPLEMatrixAssembly MatAsmblyPredictor, SIMPLEMatrixAssembly MatAsmblyPredictorApprox,
                                              SIMPLEOperator[] PressureGradient, SinglePhaseField Pressure,
                                              SIMPLEMatrixAssembly[,] MatAsmblyViscSplit, IEvaluatorNonLin[] BuoyantForce,
                                              VectorFieldHistory <SinglePhaseField> Velocity, ScalarFieldHistory <SinglePhaseField> Scalar, MaterialLaw EoS, BDFScheme BDF)
            : base(solverConf, _sparseSolver)
        {
            m_DensityMatrix            = DensityMatrix;
            m_MatAsmblyPredictor       = MatAsmblyPredictor;
            m_MatAsmblyPredictorApprox = MatAsmblyPredictorApprox;

            m_PressureGradient      = PressureGradient;
            m_Pressure              = Pressure;
            m_MatAsmblyViscSplit    = MatAsmblyViscSplit;
            m_BuoyantForceEvaluator = BuoyantForce;
            m_Velocity              = Velocity;
            m_Scalar = Scalar;
            m_EoS    = EoS;

            m_RelaxFactor = (1.0 - base.m_solverConf.Control.RelexationFactorVelocity) / base.m_solverConf.Control.RelexationFactorVelocity;

            m_BDF = BDF;
        }
Example #11
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="solverConf"></param>
        /// <param name="sparseSolver"></param>
        /// <param name="MatAsmblyCorrector"></param>
        /// <param name="VelocityDivergence"></param>
        /// <param name="BDF"></param>
        /// <param name="Velocity_Intrmed"></param>
        /// <param name="DivB4"></param>
        /// <param name="PressureStabilization">Can be null</param>
        /// <param name="Pressure"></param>
        public SolverCorrector(SolverConfiguration solverConf, ISparseSolver sparseSolver,
                               SIMPLEMatrixAssembly MatAsmblyCorrector, SIMPLEOperator[] VelocityDivergence, BDFScheme BDF,
                               VectorField <SinglePhaseField> Velocity_Intrmed, SinglePhaseField DivB4,
                               SIMPLEOperator PressureStabilization, SinglePhaseField Pressure)
            : base(solverConf, sparseSolver)
        {
            if ((VelocityDivergence.Length != solverConf.SpatialDimension) || (Velocity_Intrmed.Dim != solverConf.SpatialDimension))
            {
                throw new ArgumentException("Mismatch of dimensions!");
            }

            m_SolverConf = solverConf;

            m_MatAsmblyCorrector = MatAsmblyCorrector;
            m_VelocityDivergence = VelocityDivergence;

            m_BDF = BDF;

            m_Velocity_Intrmed = Velocity_Intrmed;
            m_DivB4            = DivB4;

            m_PressureStabilization = PressureStabilization;
            m_Pressure = Pressure;
        }
Example #12
0
 /// <summary>
 /// [Incompressible] Ctor.
 /// </summary>
 public MatrixAssemblyApprox(SolverConfiguration SolverConf, int NoOfCells, SIMPLEMatrixAssembly Src, BDFScheme BDF, int MaxUseMatrix = 1)
     : this(SolverConf, NoOfCells, Src, BDF, null, MaxUseMatrix)
 {
 }
Example #13
0
        /// <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();
            }
        }