Ejemplo n.º 1
0
        protected double Source(double[] x, double[] parameters, double[] U)
        {
            //double Temperature = U[0]  > 1.0 ? U[0] : 1.0 ;
            //double YF = U[1] > 0.0 ? U[1] : 0.0;
            //double YO = U[2] > 0.0 ? U[2] : 0.0;

            double Temperature = U[0];
            double YF          = U[1];
            double YO          = U[2];
            double Ta          = ReactionRateConstants[1];
            double MM_F        = MolarMasses[0];
            double MM_O        = MolarMasses[1];

            if (YF * YO > 1e-6 && VariableOneStepParameters)  //  calculate one-Step model parameters
            {
                Ta = EoS.getTa(YF, YO) / TRef;
            }

            rho = EoS.GetDensity(U);

            double ReactionRate = m_Da * Math.Exp(-Ta / Temperature) * (rho * YF / MM_F) * (rho * YO / MM_O);

            //Debug.Assert(!double.IsNaN(ReactionRate));
            //Debug.Assert(!double.IsInfinity(ReactionRate));



            return(-MolarMasses[SpeciesIndex] * StoichiometricCoefficients[SpeciesIndex] * ReactionRate);
        }
        /// <summary>
        ///
        /// </summary>
        protected double Source(double[] x, double[] parameters, double[] U)
        {
            rho = EoS.GetDensity(U);
            Debug.Assert(!double.IsNaN(rho));
            Debug.Assert(!double.IsInfinity(rho));

            double Ta = ReactionRateConstants[1];

            //double Temperature = U[0]  > 1.0 ? U[0] : 1.0 ;
            //double YF = U[1] > 0.0 ? U[1] : 0.0;
            //double YO = U[2] > 0.0 ? U[2] : 0.0;

            double Temperature = U[0];
            double YF          = U[1];
            double YO          = U[2];

            if (YF * YO > 1e-6 && VariableOneStepParameters)  //  calculate one-Step model parameters
            {
                Ta = EoS.getTa(YF, YO) / TRef;
                HeatReleaseFactor = EoS.getHeatRelease(YF, YO) / (cpRef * TRef);
            }
            double PM_CH4 = molarMasses[0];
            double PM_O2  = molarMasses[1];

            ReactionRate = m_Da * Math.Exp(-Ta / Temperature) * (rho * YF / PM_CH4) * (rho * YO / PM_O2);

            return(-HeatReleaseFactor * ReactionRate * PM_CH4);
        }