Skip to content

Commit ff20db2

Browse files
add combustion model
1 parent 15d2875 commit ff20db2

File tree

7 files changed

+686
-1
lines changed

7 files changed

+686
-1
lines changed

src/dfCombustionModels/Make/files

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ CombustionModel/CombustionModel/CombustionModels.C
44
FGM/FGMLiquidEvaporationBoil/FGMLiquidEvaporationBoils.C
55

66
/*diffusion/diffusions.C*/
7-
/*infinitelyFastChemistry/infinitelyFastChemistrys.C*/
7+
infinitelyFastChemistry/infinitelyFastChemistrys.C
8+
eddyDissipationModel/eddyDissipationModels.C
89

910
PaSR/PaSRs.C
1011
EDC/EDCs.C
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
/*---------------------------------------------------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration |
5+
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6+
\\/ M anipulation |
7+
-------------------------------------------------------------------------------
8+
License
9+
This file is part of OpenFOAM.
10+
11+
OpenFOAM is free software: you can redistribute it and/or modify it
12+
under the terms of the GNU General Public License as published by
13+
the Free Software Foundation, either version 3 of the License, or
14+
(at your option) any later version.
15+
16+
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19+
for more details.
20+
21+
You should have received a copy of the GNU General Public License
22+
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23+
24+
\*---------------------------------------------------------------------------*/
25+
26+
#include "eddyDissipationModel.H"
27+
#include "turbulenceModel.H"
28+
#include "turbulentFluidThermoModel.H"
29+
#include "volFields.H"
30+
31+
namespace Foam
32+
{
33+
namespace combustionModels
34+
{
35+
36+
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37+
38+
template<class ReactionThermo>
39+
eddyDissipationModel<ReactionThermo>::eddyDissipationModel
40+
(
41+
const word& modelType,
42+
ReactionThermo& thermo,
43+
const compressibleTurbulenceModel& turb,
44+
const word& combustionProperties
45+
)
46+
:
47+
singleStepCombustion<ReactionThermo>
48+
(
49+
modelType,
50+
thermo,
51+
turb,
52+
combustionProperties
53+
),
54+
C_(readScalar(this->coeffs().lookup("C_EDC"))),
55+
Cd_(readScalar(this->coeffs().lookup("C_Diff"))),
56+
Cstiff_(readScalar(this->coeffs().lookup("C_Stiff"))),
57+
PV_
58+
(
59+
IOobject
60+
(
61+
"PV",
62+
this->mesh().time().timeName(),
63+
this->mesh(),
64+
IOobject::NO_READ,
65+
IOobject::AUTO_WRITE
66+
),
67+
this->mesh(),
68+
dimensionedScalar("zero",dimless,1.0)
69+
)
70+
{}
71+
72+
73+
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74+
75+
template<class ReactionThermo>
76+
eddyDissipationModel<ReactionThermo>::~eddyDissipationModel()
77+
{}
78+
79+
80+
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
81+
82+
template<class ReactionThermo>
83+
Foam::tmp<Foam::volScalarField>
84+
eddyDissipationModel<ReactionThermo>::rtTurb() const
85+
{
86+
return C_*this->turbulence().epsilon()/
87+
max(this->turbulence().k(),
88+
dimensionedScalar("SMALL",dimVelocity*dimVelocity,SMALL));
89+
}
90+
91+
template<class ReactionThermo>
92+
Foam::tmp<Foam::volScalarField>
93+
eddyDissipationModel<ReactionThermo>::rtDiff() const
94+
{
95+
const CanteraMixture& mixture_ = dynamic_cast<const CanteraMixture&>(this->thermo());
96+
const volScalarField& YO2 = mixture_.Y("O2");
97+
const compressible::LESModel& lesModel =
98+
YO2.db().lookupObject<compressible::LESModel>
99+
(
100+
turbulenceModel::propertiesName
101+
);
102+
103+
return Cd_*this->thermo().alpha()/this->rho()/sqr(lesModel.delta());
104+
}
105+
106+
template<class ReactionThermo>
107+
void eddyDissipationModel<ReactionThermo>::correct()
108+
{
109+
//- Set the product volume field, needed by alphat BC
110+
calcPV();
111+
112+
this->wFuel_ ==
113+
dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0);
114+
115+
// if (this->active())
116+
{
117+
CanteraMixture& mixture_ = dynamic_cast<CanteraMixture&>(this->thermo());
118+
this->singleMixture_.fresCorrect();
119+
120+
const label fuelI = this->singleMixture_.fuelIndex();
121+
122+
const volScalarField& YFuel = mixture_.Y(fuelI);
123+
124+
const dimensionedScalar s = this->singleMixture_.s();
125+
126+
if (mixture_.species().contains("O2"))
127+
{
128+
const volScalarField& YO2 = mixture_.Y("O2");
129+
130+
// this->wFuel_ ==
131+
// this->rho()/(this->mesh().time().deltaT()*C_)
132+
// *min(YFuel, YO2/s.value());
133+
134+
/*
135+
this->wFuel_ ==
136+
C_
137+
* this->rho()
138+
* this->turbulence().epsilon()
139+
/ max(this->turbulence().k(),
140+
dimensionedScalar("SMALL",dimVelocity*dimVelocity,SMALL))
141+
* min(YFuel, YO2/s.value());
142+
*/
143+
144+
/*
145+
this->wFuel_ ==
146+
this->rho()
147+
* min(YFuel, YO2/s.value())
148+
* max(rtTurb(),rtDiff());
149+
*/
150+
151+
volScalarField rt(max(rtTurb(),rtDiff()));
152+
153+
// clipping of wFuel to prevent negative HRR
154+
// this->wFuel_ ==
155+
// this->rho()
156+
// * min(max(0*YFuel,YFuel), max(0*YO2,YO2)/s.value())
157+
// / this->mesh_.time().deltaT() *
158+
// min(1./ Cstiff_* (1 - exp(- Cstiff_*this->mesh_.time().deltaT() * rt)),1.0);
159+
160+
this->wFuel_ ==
161+
this->rho()
162+
* min(YFuel, YO2/s.value())
163+
/ this->mesh_.time().deltaT() / Cstiff_
164+
* (1 - exp(- Cstiff_*this->mesh_.time().deltaT() * rt));
165+
}
166+
}
167+
}
168+
169+
170+
template<class ReactionThermo>
171+
bool eddyDissipationModel<ReactionThermo>::read()
172+
{
173+
if (singleStepCombustion<ReactionThermo>::read())
174+
{
175+
this->coeffs().lookup("C") >> C_ ;
176+
return true;
177+
}
178+
else
179+
{
180+
return false;
181+
}
182+
}
183+
184+
template<class ReactionThermo>
185+
label eddyDissipationModel<ReactionThermo>::getParameter() const
186+
{
187+
return 123;
188+
}
189+
190+
template<class ReactionThermo>
191+
void eddyDissipationModel<ReactionThermo>::calcPV()
192+
{
193+
CanteraMixture& mixture_ = dynamic_cast<CanteraMixture&>(this->thermo());
194+
//- Get species mass fraction
195+
const label fuelI = this->singleMixture_.fuelIndex();
196+
const volScalarField& YFuel = mixture_.Y(fuelI);
197+
const volScalarField& YO2 = mixture_.Y("O2");
198+
const volScalarField& YCO2 = mixture_.Y("CO2");
199+
200+
const dimensionedScalar s = this->singleMixture_.s();
201+
202+
//- Get Mspecies/Mfuel from reaction equation
203+
scalar rCO2(this->singleMixture_.specieStoichCoeffs()
204+
[mixture_.species()["CO2"]]);
205+
scalar rH2O(this->singleMixture_.specieStoichCoeffs()
206+
[mixture_.species()["H2O"]]);
207+
208+
PV_ = (YCO2*(1.0+rH2O/rCO2)+SMALL)/(YCO2*(1.0+rH2O/rCO2)+SMALL + min(YFuel,YO2/s.value())*(1.0+s.value()));
209+
210+
return;
211+
}
212+
213+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214+
215+
} // End namespace combustionModels
216+
} // End namespace Foam
217+
218+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*---------------------------------------------------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration |
5+
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6+
\\/ M anipulation |
7+
-------------------------------------------------------------------------------
8+
License
9+
This file is part of OpenFOAM.
10+
11+
OpenFOAM is free software: you can redistribute it and/or modify it
12+
under the terms of the GNU General Public License as published by
13+
the Free Software Foundation, either version 3 of the License, or
14+
(at your option) any later version.
15+
16+
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19+
for more details.
20+
21+
You should have received a copy of the GNU General Public License
22+
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23+
24+
Class
25+
Foam::combustionModels::eddyDissipationModel
26+
27+
Group
28+
grpCombustionModels
29+
30+
Description
31+
Simple infinitely fast chemistry combustion model based on the principle
32+
mixed is burnt. Additional parameter C is used to distribute the heat
33+
release rate.in time
34+
35+
SourceFiles
36+
eddyDissipationModel.C
37+
38+
\*---------------------------------------------------------------------------*/
39+
40+
#ifndef eddyDissipationModel_H
41+
#define eddyDissipationModel_H
42+
43+
#include "singleStepCombustion.H"
44+
45+
#include "LESModel.H"
46+
47+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48+
49+
namespace Foam
50+
{
51+
namespace combustionModels
52+
{
53+
54+
/*---------------------------------------------------------------------------*\
55+
Class eddyDissipationModel Declaration
56+
\*---------------------------------------------------------------------------*/
57+
58+
template<class ReactionThermo>
59+
class eddyDissipationModel
60+
:
61+
public singleStepCombustion<ReactionThermo>
62+
{
63+
// Private data
64+
65+
//- Model constant
66+
scalar C_;
67+
68+
scalar Cd_;
69+
70+
scalar Cstiff_;
71+
72+
//- Product volume - used by alphat BC
73+
74+
volScalarField PV_;
75+
76+
// Private Member Functions
77+
78+
//- Return the reciprocal of the turbulent mixing time scale
79+
tmp<volScalarField> rtTurb() const;
80+
81+
//- Return the reciprocal of the diffusion time scale
82+
tmp<volScalarField> rtDiff() const;
83+
84+
//- Calculate the product volume
85+
void calcPV();
86+
87+
//- No copy construct
88+
eddyDissipationModel(const eddyDissipationModel&) = delete;
89+
90+
//- No copy assignment
91+
void operator=(const eddyDissipationModel&) = delete;
92+
93+
94+
public:
95+
96+
//- Runtime type information
97+
TypeName("eddyDissipationModel");
98+
99+
100+
// Constructors
101+
102+
//- Construct from components
103+
eddyDissipationModel
104+
(
105+
const word& modelType,
106+
ReactionThermo& thermo,
107+
const compressibleTurbulenceModel& turb,
108+
const word& combustionProperties
109+
);
110+
111+
112+
//- Destructor
113+
virtual ~eddyDissipationModel();
114+
115+
116+
// Member Functions
117+
118+
//- Correct combustion rate
119+
virtual void correct();
120+
121+
//- Update properties
122+
virtual bool read();
123+
124+
label getParameter() const;
125+
};
126+
127+
128+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129+
130+
} // End namespace combustionModels
131+
} // End namespace Foam
132+
133+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134+
135+
#ifdef NoRepository
136+
#include "eddyDissipationModel.C"
137+
#endif
138+
139+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140+
141+
#endif
142+
143+
// ************************************************************************* //

0 commit comments

Comments
 (0)