@@ -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,26 @@ Foam::dfChemistryModel<ThermoType>::dfChemistryModel
231232 )
232233 );
233234 }
234-
235+ forAll (wrate_ , fieldi )
236+ {
237+ wrate_ .set
238+ (
239+ fieldi ,
240+ new volScalarField ::Internal
241+ (
242+ IOobject
243+ (
244+ "wrate." + Y_ [fieldi ].name (),
245+ mesh_ .time ().timeName (),
246+ mesh_ ,
247+ IOobject ::NO_READ ,
248+ IOobject ::NO_WRITE
249+ ),
250+ mesh_ ,
251+ dimensionedScalar (dimMass /dimVolume /dimTime , 0 )
252+ )
253+ );
254+ }
235255 forAll (rhoD_ , i )
236256 {
237257 rhoD_ .set
@@ -727,6 +747,34 @@ Foam::dfChemistryModel<ThermoType>::updateReactionRates
727747 return deltaTMin ;
728748}
729749
750+ template < class ThermoType >
751+ void Foam ::dfChemistryModel < ThermoType > ::calculateW ()
752+ {
753+ doublereal Yi [mixture_ .nSpecies ()];
754+ doublereal twrate [mixture_ .nSpecies ()];
755+
756+ forAll (rho_ , celli )
757+ {
758+ const scalar rhoi = rho_ [celli ];
759+ const scalar Ti = T_ [celli ];
760+ const scalar pi = p_ [celli ];
761+
762+ for (label i = 0 ; i < mixture_ .nSpecies (); i ++ )
763+ {
764+ Yi [i ] = Y_ [i ][celli ];
765+ }
766+
767+ CanteraGas_ -> setState_TPY (Ti , pi , Yi );
768+
769+ CanteraKinetics_ -> getNetProductionRates (twrate );
770+
771+ for (label i = 0 ; i < mixture_ .nSpecies (); i ++ )
772+ {
773+ wrate_ [i ][celli ] = twrate [i ]* CanteraGas_ -> molecularWeight (i );
774+ }
775+ }
776+ }
777+
730778template < class ThermoType >
731779Foam ::tmp < Foam ::DimensionedField < Foam ::scalar , Foam ::volMesh >>
732780Foam ::dfChemistryModel < ThermoType > ::calculateRR
0 commit comments