Newer
Older
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
\\/ M anipulation |
-------------------------------------------------------------------------------
License
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "PaSR.H"
#include "fvmSup.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CombThermoType>
Foam::combustionModels::PaSR<CombThermoType>::PaSR
(
const word& modelType,
const fvMesh& mesh
)
:
CombThermoType(modelType, mesh),
Cmix_(this->coeffs().lookup("Cmix")),
turbulentReaction_(this->coeffs().lookup("turbulentReaction")),
kappa_
(
IOobject
(
"kappa",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("kappa", dimless, 0.0)
),
useReactionRate_(this->coeffs().lookupOrDefault("useReactionRate", false))
{
if (useReactionRate_)
{
Info<< " using reaction rate" << endl;
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CombThermoType>
Foam::combustionModels::PaSR<CombThermoType>::~PaSR()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CombThermoType>
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::PaSR<CombThermoType>::tc() const
{
return this->pChemistry_->tc();
}
template<class CombThermoType>
void Foam::combustionModels::PaSR<CombThermoType>::correct()
{
if (this->active())
{
const scalar t = this->mesh().time().value();
const scalar dt = this->mesh().time().deltaTValue();
if (!useReactionRate_)
{
}
else
{
this->pChemistry_->calculate();
}
if (turbulentReaction_)
{
tmp<volScalarField> trho(this->rho());
const volScalarField& rho = trho();
tmp<volScalarField> tepsilon(this->turbulence().epsilon());
const volScalarField& epsilon = tepsilon();
tmp<volScalarField> tmuEff(this->turbulence().muEff());
const volScalarField& muEff = tmuEff();
tmp<volScalarField> ttc(tc());
const volScalarField& tc = ttc();
const dimensionedScalar e0
(
"e0",
sqr(dimLength)/pow3(dimTime),
SMALL
);
forAll(epsilon, i)
{
if (epsilon[i] > 0)
{
scalar tk =
Cmix_.value()
*Foam::sqrt(muEff[i]/rho[i]/(epsilon[i] + e0.value()));
// Chalmers PaSR model
if (!useReactionRate_)
{
kappa_[i] = (dt + tc[i])/(dt + tc[i] + tk);
}
else
{
kappa_[i] = tc[i]/(tc[i] + tk);
}
}
else
{
// Return to laminar combustion
kappa_[i] = 1.0;
}
}
}
else
{
kappa_ = 1.0;
}
}
}
template<class CombThermoType>
Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::PaSR<CombThermoType>::R(const volScalarField& Y) const
{
tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
fvScalarMatrix& Su = tSu();
if (this->active())
{
const label specieI = this->thermo().composition().species()[Y.name()];
Su += kappa_*this->pChemistry_->RR(specieI);
}
return tSu;
}
template<class CombThermoType>
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::PaSR<CombThermoType>::dQ() const
{
tmp<volScalarField> tdQ
(
new volScalarField
(
IOobject
(
"dQ",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("dQ", dimEnergy/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->active())
{
volScalarField& dQ = tdQ();
dQ = kappa_*this->pChemistry_->dQ();
}
return tdQ;
}
template<class CombThermoType>
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::PaSR<CombThermoType>::Sh() const
{
tmp<volScalarField> tSh
(
new volScalarField
(
IOobject
(
"Sh",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->active())
{
scalarField& Sh = tSh();
Sh = kappa_*this->pChemistry_->Sh();
}
return tSh;
}
template<class CombThermoType>
bool Foam::combustionModels::PaSR<CombThermoType>::read()
{
if (CombThermoType::read())
{
this->coeffs().lookup("Cmix") >> Cmix_;
this->coeffs().lookup("turbulentReaction") >> turbulentReaction_;
this->coeffs().lookup("useReactionRate") >> useReactionRate_;
return true;
}
else
{
return false;
}
}
// ************************************************************************* //