Skip to content

Commit 61bcac9

Browse files
add singleStepReaction
1 parent ff20db2 commit 61bcac9

File tree

4 files changed

+445
-0
lines changed

4 files changed

+445
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*---------------------------------------------------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration | Website: https://openfoam.org
5+
\\ / A nd | Copyright (C) 2012-2018 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 "ThermoCombustion.H"
27+
28+
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29+
30+
template<class ReactionThermo>
31+
Foam::ThermoCombustion<ReactionThermo>::ThermoCombustion
32+
(
33+
const word& modelType,
34+
ReactionThermo& thermo,
35+
const compressibleTurbulenceModel& turb
36+
)
37+
:
38+
CombustionModel<ReactionThermo>
39+
(
40+
modelType,
41+
thermo,
42+
turb,
43+
combustionModel::combustionPropertiesName
44+
),
45+
thermo_(thermo)
46+
{}
47+
48+
49+
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
50+
51+
template<class ReactionThermo>
52+
Foam::ThermoCombustion<ReactionThermo>::~ThermoCombustion()
53+
{}
54+
55+
56+
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
57+
58+
template<class ReactionThermo>
59+
ReactionThermo&
60+
Foam::ThermoCombustion<ReactionThermo>::thermo()
61+
{
62+
return thermo_;
63+
}
64+
65+
66+
template<class ReactionThermo>
67+
const ReactionThermo&
68+
Foam::ThermoCombustion<ReactionThermo>::thermo() const
69+
{
70+
return thermo_;
71+
}
72+
73+
74+
// ************************************************************************* //
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*---------------------------------------------------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration | Website: https://openfoam.org
5+
\\ / A nd | Copyright (C) 2012-2018 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::ThermoCombustion
26+
27+
Description
28+
Thermo model wrapper for combustion models
29+
30+
SourceFiles
31+
ThermoCombustion.C
32+
33+
\*---------------------------------------------------------------------------*/
34+
35+
#ifndef ThermoCombustion_H
36+
#define ThermoCombustion_H
37+
38+
#include "autoPtr.H"
39+
#include "CombustionModel.H"
40+
41+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42+
43+
namespace Foam
44+
{
45+
46+
/*---------------------------------------------------------------------------*\
47+
class ThermoCombustion Declaration
48+
\*---------------------------------------------------------------------------*/
49+
50+
template<class ReactionThermo>
51+
class ThermoCombustion
52+
:
53+
public CombustionModel<ReactionThermo>
54+
{
55+
protected:
56+
57+
// Protected data
58+
59+
//- Thermo
60+
ReactionThermo& thermo_;
61+
62+
63+
public:
64+
65+
// Constructors
66+
67+
//- Construct from components
68+
ThermoCombustion
69+
(
70+
const word& modelType,
71+
ReactionThermo& thermo,
72+
const compressibleTurbulenceModel& turb
73+
);
74+
75+
76+
//- Destructor
77+
virtual ~ThermoCombustion();
78+
79+
80+
// Member Functions
81+
82+
//- Return access to the thermo package
83+
virtual ReactionThermo& thermo();
84+
85+
//- Return const access to the thermo package
86+
virtual const ReactionThermo& thermo() const;
87+
};
88+
89+
90+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
91+
92+
} // End namespace Foam
93+
94+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95+
96+
#ifdef NoRepository
97+
#include "ThermoCombustion.C"
98+
#endif
99+
100+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101+
102+
#endif
103+
104+
// ************************************************************************* //
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
/*---------------------------------------------------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration | Website: https://openfoam.org
5+
\\ / A nd | Copyright (C) 2011-2018 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 "singleStepCombustion.H"
27+
#include "fvmSup.H"
28+
29+
namespace Foam
30+
{
31+
namespace combustionModels
32+
{
33+
34+
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35+
36+
template<class ReactionThermo>
37+
singleStepCombustion<ReactionThermo>::singleStepCombustion
38+
(
39+
const word& modelType,
40+
ReactionThermo& thermo,
41+
const compressibleTurbulenceModel& turb,
42+
const word& combustionProperties
43+
)
44+
:
45+
ThermoCombustion<ReactionThermo>(modelType, thermo, turb),
46+
singleMixture_(dynamic_cast<dfSingleStepReactingMixture&>(thermo)),
47+
wFuel_
48+
(
49+
IOobject
50+
(
51+
this->thermo().phasePropertyName("wFuel"),
52+
this->mesh().time().timeName(),
53+
this->mesh(),
54+
IOobject::NO_READ,
55+
IOobject::NO_WRITE
56+
),
57+
this->mesh(),
58+
dimensionedScalar(dimMass/dimVolume/dimTime, 0)
59+
),
60+
semiImplicit_(readBool(this->coeffs_.lookup("semiImplicit")))
61+
{
62+
if (semiImplicit_)
63+
{
64+
Info<< "Combustion mode: semi-implicit" << endl;
65+
}
66+
else
67+
{
68+
Info<< "Combustion mode: explicit" << endl;
69+
}
70+
}
71+
72+
73+
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
74+
75+
template<class ReactionThermo>
76+
singleStepCombustion<ReactionThermo>::~singleStepCombustion()
77+
{}
78+
79+
80+
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
81+
82+
template<class ReactionThermo>
83+
tmp<fvScalarMatrix> singleStepCombustion<ReactionThermo>::R
84+
(
85+
volScalarField& Y
86+
) const
87+
{
88+
const label specieI =singleMixture_.species()[Y.member()];
89+
90+
volScalarField wSpecie
91+
(
92+
wFuel_*singleMixture_.specieStoichCoeffs()[specieI]
93+
);
94+
95+
if (semiImplicit_)
96+
{
97+
const label fNorm = singleMixture_.specieProd()[specieI];
98+
const volScalarField fres(singleMixture_.fres(specieI));
99+
wSpecie /= max(fNorm*(Y - fres), scalar(1e-2));
100+
101+
return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y);
102+
}
103+
else
104+
{
105+
return wSpecie + fvm::Sp(0.0*wSpecie, Y);
106+
}
107+
}
108+
109+
110+
template<class ReactionThermo>
111+
tmp<volScalarField>
112+
singleStepCombustion<ReactionThermo>::Qdot() const
113+
{
114+
const label fuelI = singleMixture_.fuelIndex();
115+
volScalarField& YFuel =
116+
const_cast<volScalarField&>(singleMixture_.Y(fuelI));
117+
118+
return -singleMixture_.qFuel()*(R(YFuel) & YFuel);
119+
}
120+
121+
122+
template<class ReactionThermo>
123+
bool singleStepCombustion<ReactionThermo>::read()
124+
{
125+
if (ThermoCombustion<ReactionThermo>::read())
126+
{
127+
return true;
128+
}
129+
else
130+
{
131+
return false;
132+
}
133+
}
134+
135+
136+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137+
138+
} // End namespace combustionModels
139+
} // End namespace Foam
140+
141+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

0 commit comments

Comments
 (0)