Skip to content

Commit 41bfaaa

Browse files
committed
add calculation of net production rates in dfChemistryModel
1 parent c6a7132 commit 41bfaaa

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

src/dfChemistryModel/dfChemistryModel.C

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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+
730779
template<class ThermoType>
731780
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
732781
Foam::dfChemistryModel<ThermoType>::calculateRR

src/dfChemistryModel/dfChemistryModel.H

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public IOdictionary
119119
mutable scalarList cTemp_;
120120
// mass change rate, [kg/m^3/s]
121121
PtrList<volScalarField::Internal> RR_;
122+
// net production rates, [kg/m^3/s]
123+
PtrList<volScalarField::Internal> wrate_;
122124
hashedWordList species_;
123125
volScalarField& alpha_;
124126
volScalarField& T_;
@@ -285,6 +287,10 @@ public:
285287
//- Return access to chemical source terms [kg/m^3/s]
286288
volScalarField::Internal& RR(const label i) {return RR_[i];}
287289

290+
void calculateW();
291+
292+
volScalarField::Internal& wrate(const label i) {return wrate_[i];}
293+
288294
tmp<volScalarField::Internal> calculateRR
289295
(
290296
const label reactionI,

0 commit comments

Comments
 (0)