Exemplo n.º 1
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="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;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update scalar field variables after solving scalar equation.
        /// </summary>
        /// <param name="SolverConf"></param>
        /// <param name="ModeRelaxScalar"></param>
        /// <param name="relax_scalar"></param>
        /// <param name="Scalar"></param>
        /// <param name="ScalarRes"></param>
        /// <param name="ScalarMean"></param>
        /// <param name="Rho"></param>
        /// <param name="Eta"></param>
        /// <param name="RhoMatrix"></param>
        /// <param name="EoS"></param>
        /// <param name="ThermodynamicPressure">Null for multiphase flows.</param>
        public static void UpdateScalarFieldVariables(SIMPLEControl SolverConf, RelaxationTypes ModeRelaxScalar, double relax_scalar,
                                                      ScalarFieldHistory <SinglePhaseField> Scalar, SinglePhaseField ScalarRes, SinglePhaseField ScalarMean,
                                                      SinglePhaseField Rho, SinglePhaseField Eta, QuadratureMatrix RhoMatrix, MaterialLaw EoS,
                                                      SinglePhaseField ThermodynamicPressure, bool UpdateRhoVisc = true)
        {
            using (new FuncTrace()) {
                // Explicit Under-Relaxation of scalar variable
                // ============================================

                if (ModeRelaxScalar == RelaxationTypes.Explicit)
                {
                    // phi = alpha * phi_new + (1-alpha) * phi_old
                    Scalar.Current.Scale(relax_scalar);
                    Scalar.Current.Acc((1.0 - relax_scalar), ScalarRes);
                }

                // Scalar residual
                // ===============

                ScalarRes.Scale(-1.0);
                ScalarRes.Acc(1.0, Scalar.Current);

                // ScalarMean
                // ==========

                ScalarMean.Clear();
                ScalarMean.AccLaidBack(1.0, Scalar.Current);

                // Thermodynamic pressure - only for Low-Mach number flows
                // =======================================================

                switch (SolverConf.PhysicsMode)
                {
                case PhysicsMode.LowMach:
                    LowMachSIMPLEControl lowMachConf = SolverConf as LowMachSIMPLEControl;
                    if (lowMachConf.ThermodynamicPressureMode == ThermodynamicPressureMode.MassDetermined)
                    {
                        ThermodynamicPressure.Clear();
                        ThermodynamicPressure.AccConstant(((MaterialLawLowMach)EoS).GetMassDeterminedThermodynamicPressure(lowMachConf.InitialMass.Value, Scalar.Current));
                    }
                    break;

                case PhysicsMode.Multiphase:
                    break;

                default:
                    throw new ApplicationException();
                }

                if (UpdateRhoVisc)
                {
                    // Density
                    // =======

                    Rho.Clear();
                    Rho.ProjectFunction(1.0, EoS.GetDensity, null, Scalar.Current);
                    RhoMatrix.Update();

                    // Viscosity
                    // =========

                    Eta.Clear();
                    Eta.ProjectFunction(1.0, EoS.GetViscosity, null, Scalar.Current);
                }
            }
        }