@@ -65,6 +65,7 @@ Foam::dfChemistryModel<ThermoType>::dfChemistryModel
6565 hrtTemp_ (mixture_ .nSpecies ()),
6666 cTemp_ (mixture_ .nSpecies ()),
6767 RR_ (mixture_ .nSpecies ()),
68+ wrate_ (mixture_ .nSpecies ()),
6869 alpha_ (const_cast < volScalarField & > (thermo .alpha ())),
6970 T_ (thermo .T ()),
7071 p_ (thermo .p ()),
@@ -231,7 +232,27 @@ Foam::dfChemistryModel<ThermoType>::dfChemistryModel
231232 )
232233 );
233234 }
234-
235+ forAll (wrate_ , fieldi )
236+ {
237+ Info <<"here for create wrate_" << endl ;
238+ wrate_ .set
239+ (
240+ fieldi ,
241+ new volScalarField ::Internal
242+ (
243+ IOobject
244+ (
245+ "wrate." + Y_ [fieldi ].name (),
246+ mesh_ .time ().timeName (),
247+ mesh_ ,
248+ IOobject ::NO_READ ,
249+ IOobject ::NO_WRITE
250+ ),
251+ mesh_ ,
252+ dimensionedScalar (dimMass /dimVolume /dimTime , 0 )
253+ )
254+ );
255+ }
235256 forAll (rhoD_ , i )
236257 {
237258 rhoD_ .set
@@ -727,6 +748,34 @@ Foam::dfChemistryModel<ThermoType>::updateReactionRates
727748 return deltaTMin ;
728749}
729750
751+ template < class ThermoType >
752+ void Foam ::dfChemistryModel < ThermoType > ::calculateW ()
753+ {
754+ doublereal Yi [mixture_ .nSpecies ()];
755+ doublereal twrate [mixture_ .nSpecies ()];
756+
757+ forAll (rho_ , celli )
758+ {
759+ const scalar rhoi = rho_ [celli ];
760+ const scalar Ti = T_ [celli ];
761+ const scalar pi = p_ [celli ];
762+
763+ for (label i = 0 ; i < mixture_ .nSpecies (); i ++ )
764+ {
765+ Yi [i ] = Y_ [i ][celli ];
766+ }
767+
768+ CanteraGas_ -> setState_TPY (Ti , pi , Yi );
769+
770+ CanteraKinetics_ -> getNetProductionRates (twrate );
771+
772+ for (label i = 0 ; i < mixture_ .nSpecies (); i ++ )
773+ {
774+ wrate_ [i ][celli ] = twrate [i ]* CanteraGas_ -> molecularWeight (i );
775+ }
776+ }
777+ }
778+
730779template < class ThermoType >
731780Foam ::tmp < Foam ::DimensionedField < Foam ::scalar , Foam ::volMesh >>
732781Foam ::dfChemistryModel < ThermoType > ::calculateRR
0 commit comments