Ejemplo n.º 1
0
        protected override IList <double> DefineRhs(double dt, int SpatialComponent)
        {
            double[] rhs = new double[m_MatAsmblyLevelSet.LocalLength];

            double[] LevelSetAffine = m_MatAsmblyLevelSet.AssemblyAffine;

            SinglePhaseField RhsSummand = new SinglePhaseField(m_LevelSet.Current.Basis);

            if (m_BDF != null)
            {
                m_BDF.ComputeRhsSummand(dt, m_solverConf.BDFOrder, m_LevelSet, RhsSummand);
            }

            double[] UnderRelaxation = new double[rhs.Length];
            if (((m_ModeRelaxLevelSet == RelaxationTypes.Implicit)) && (m_RelaxFactor != 0.0))
            {
                m_MatAsmblyLevelSetApprox.AssemblyMatrix.SpMVpara(m_RelaxFactor, m_LevelSet.Current.CoordinateVector, 0.0, UnderRelaxation);
            }

            for (int i = 0; i < rhs.Length; i++)
            {
                rhs[i] =
                    -LevelSetAffine[i]
                    - RhsSummand.CoordinateVector[i]
                    + UnderRelaxation[i];
            }

            return(rhs);
        }
Ejemplo n.º 2
0
        protected override IList <double> DefineRhs(double dt, int SpatialComponent)
        {
            double[] rhs = new double[MatAsmblyTemperature.LocalLength];

            double[] TemperatureAffine = MatAsmblyTemperature.AssemblyAffine;

            SinglePhaseField RhsSummand = new SinglePhaseField(Temperature.Current.Basis);

            if (base.m_solverConf.Control.Algorithm == SolutionAlgorithms.Unsteady_SIMPLE)
            {
                BDF.ComputeRhsSummand(dt, base.m_solverConf.BDFOrder, Temperature, EoS, RhsSummand);
            }

            double[] UnderRelaxation = new double[rhs.Length];
            if (((ModeRelaxTemperature == RelaxationTypes.Implicit)) && (RelaxFactor != 0.0))
            {
                MatAsmblyTemperatureApprox.AssemblyMatrix.SpMVpara(RelaxFactor, Temperature.Current.CoordinateVector, 0.0, UnderRelaxation);
            }

            for (int i = 0; i < rhs.Length; i++)
            {
                rhs[i] =
                    -TemperatureAffine[i]
                    - RhsSummand.CoordinateVector[i] / gamma
                    + UnderRelaxation[i];
            }

            return(rhs);
        }
Ejemplo n.º 3
0
        protected override IList <double> DefineRhs(double dt, int SpatialComponent)
        {
            double[] rhs = new double[m_MatAsmblyPredictor.LocalLength];

            double[] PredictorAffine = m_MatAsmblyPredictor.AssemblyAffine;

            SinglePhaseField RhsSummand = new SinglePhaseField(m_Velocity.Current[SpatialComponent].Basis);

            if (m_BDF != null)
            {
                m_BDF.ComputeRhsSummand(dt, base.m_solverConf.BDFOrder, m_Scalar, m_Velocity, SpatialComponent, m_EoS, RhsSummand);
            }

            double[] PressureGradient = new double[rhs.Length];
            m_PressureGradient[SpatialComponent].OperatorMatrix.SpMVpara(1.0, m_Pressure.CoordinateVector, 0.0, PressureGradient);

            double[] ViscSplitExplicitPart = new double[rhs.Length];
            for (int j = 0; j < m_Velocity.Current.Dim; j++)
            {
                if (j != SpatialComponent)
                {
                    m_MatAsmblyViscSplit[SpatialComponent, j].AssemblyMatrix.SpMVpara(1.0, m_Velocity.Current[j].CoordinateVector, 1.0, ViscSplitExplicitPart);
                }
            }

            double[] BuoyantForce = new double[rhs.Length];
            if (m_BuoyantForceEvaluator != null)
            {
                m_BuoyantForceEvaluator[SpatialComponent].Evaluate(1.0, 0.0, BuoyantForce);
            }

            double[] UnderRelaxation = new double[rhs.Length];
            if (m_RelaxFactor != 0.0)
            {
                m_MatAsmblyPredictorApprox.AssemblyMatrix.SpMVpara(m_RelaxFactor, m_Velocity.Current[SpatialComponent].CoordinateVector, 0.0, UnderRelaxation);
            }


            for (int i = 0; i < rhs.Length; i++)
            {
                rhs[i] =
                    -PredictorAffine[i]
                    - m_PressureGradient[SpatialComponent].OperatorAffine[i]
                    - RhsSummand.CoordinateVector[i]
                    - PressureGradient[i]
                    - ViscSplitExplicitPart[i]
                    + BuoyantForce[i]
                    + UnderRelaxation[i];
            }

            return(rhs);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="SpatialComponent"></param>
        /// <returns></returns>
        protected override IList <double> DefineRhs(double dt, int SpatialComponent)
        {
            double[] rhs = new double[m_MatAsmblyPredictor[SpatialComponent].LocalLength];

            double[] PredictorAffine = m_MatAsmblyPredictor[SpatialComponent].AssemblyAffine;

            SinglePhaseField RhsSummand = new SinglePhaseField(m_Velocity.Current[0].Basis);

            if (m_BDF != null)
            {
                m_BDF.ComputeRhsSummand(dt, base.m_solverConf.BDFOrder, m_Velocity, SpatialComponent, RhsSummand);
            }

            double[] PressureGradient = new double[rhs.Length];
            m_PressureGradient[SpatialComponent].OperatorMatrix.SpMVpara(1.0, m_Pressure.CoordinateVector, 0.0, PressureGradient);

            double[] UnderRelaxation = new double[rhs.Length];
            if (m_RelaxFactor != 0.0)
            {
                m_MatAsmblyPredictorApprox.AssemblyMatrix.SpMVpara(m_RelaxFactor,
                                                                   m_Velocity.Current[SpatialComponent].CoordinateVector,
                                                                   0.0,
                                                                   UnderRelaxation);
            }

            for (int i = 0; i < rhs.Length; i++)
            {
                //See right-hand side of Eq. (18) in
                //B. Klein, F. Kummer, M. Keil, and M. Oberlack,
                //An extension of the SIMPLE based discontinuous Galerkin solver to unsteady incompressible flows, J. Comput. Phys., 2013.
                rhs[i] =
                    -PredictorAffine[i]
                    - m_PressureGradient[SpatialComponent].OperatorAffine[i]
                    - RhsSummand.CoordinateVector[i]
                    - PressureGradient[i]
                    + UnderRelaxation[i];
            }

            return(rhs);
        }