Adding optional build of the thermo tpe per reaction. This thermo is not necessary for solid reactions.

NOTE: in Reaction.C constructors bool initReactionThermo is used by solidReaction where there is no
need of setting a lhs - rhs thermo type for each reaction. This is needed for mechanism with reversible reactions
This commit is contained in:
sergio
2017-05-26 10:18:01 -07:00
parent 4bc3c5f2ba
commit 9bc87005ad
8 changed files with 69 additions and 18 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -67,7 +67,7 @@ Foam::solidReaction<ReactionThermo>::solidReaction
const dictionary& dict const dictionary& dict
) )
: :
Reaction<ReactionThermo>(species, thermoDatabase, dict), Reaction<ReactionThermo>(species, thermoDatabase, dict, false),
pyrolisisGases_(dict.parent().parent().lookup("gaseousSpecies")), pyrolisisGases_(dict.parent().parent().lookup("gaseousSpecies")),
glhs_(), glhs_(),
grhs_() grhs_()

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -111,19 +111,20 @@ void Foam::Reaction<ReactionThermo>::setThermo
const HashPtrTable<ReactionThermo>& thermoDatabase const HashPtrTable<ReactionThermo>& thermoDatabase
) )
{ {
typename ReactionThermo::thermoType rhsThermo typename ReactionThermo::thermoType rhsThermo
( (
rhs_[0].stoichCoeff rhs_[0].stoichCoeff
*(*thermoDatabase[species_[rhs_[0].index]]).W() *(*thermoDatabase[species_[rhs_[0].index]]).W()
*(*thermoDatabase[species_[rhs_[0].index]]) *(*thermoDatabase[species_[rhs_[0].index]])
); );
for (label i=1; i<rhs_.size(); ++i) for (label i=1; i<rhs_.size(); ++i)
{ {
rhsThermo += rhsThermo +=
rhs_[i].stoichCoeff rhs_[i].stoichCoeff
*(*thermoDatabase[species_[rhs_[i].index]]).W() *(*thermoDatabase[species_[rhs_[i].index]]).W()
*(*thermoDatabase[species_[rhs_[i].index]]); *(*thermoDatabase[species_[rhs_[i].index]]);
} }
typename ReactionThermo::thermoType lhsThermo typename ReactionThermo::thermoType lhsThermo
@ -154,7 +155,8 @@ Foam::Reaction<ReactionThermo>::Reaction
const speciesTable& species, const speciesTable& species,
const List<specieCoeffs>& lhs, const List<specieCoeffs>& lhs,
const List<specieCoeffs>& rhs, const List<specieCoeffs>& rhs,
const HashPtrTable<ReactionThermo>& thermoDatabase const HashPtrTable<ReactionThermo>& thermoDatabase,
bool initReactionThermo
) )
: :
ReactionThermo::thermoType(*thermoDatabase[species[0]]), ReactionThermo::thermoType(*thermoDatabase[species[0]]),
@ -163,7 +165,10 @@ Foam::Reaction<ReactionThermo>::Reaction
lhs_(lhs), lhs_(lhs),
rhs_(rhs) rhs_(rhs)
{ {
setThermo(thermoDatabase); if (initReactionThermo)
{
setThermo(thermoDatabase);
}
} }
@ -325,7 +330,8 @@ Foam::Reaction<ReactionThermo>::Reaction
( (
const speciesTable& species, const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase, const HashPtrTable<ReactionThermo>& thermoDatabase,
const dictionary& dict const dictionary& dict,
bool initReactionThermo
) )
: :
ReactionThermo::thermoType(*thermoDatabase[species[0]]), ReactionThermo::thermoType(*thermoDatabase[species[0]]),
@ -339,7 +345,11 @@ Foam::Reaction<ReactionThermo>::Reaction
lhs_, lhs_,
rhs_ rhs_
); );
setThermo(thermoDatabase);
if (initReactionThermo)
{
setThermo(thermoDatabase);
}
} }

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -186,18 +186,27 @@ public:
const speciesTable& species, const speciesTable& species,
const List<specieCoeffs>& lhs, const List<specieCoeffs>& lhs,
const List<specieCoeffs>& rhs, const List<specieCoeffs>& rhs,
const HashPtrTable<ReactionThermo>& thermoDatabase const HashPtrTable<ReactionThermo>& thermoDatabase,
bool initReactionThermo = true
); );
//- Construct as copy given new speciesTable //- Construct as copy given new speciesTable
Reaction(const Reaction<ReactionThermo>&, const speciesTable& species); Reaction
(
const Reaction<ReactionThermo>&,
const speciesTable& species
);
//- Construct from dictionary //- Construct from dictionary
// NOTE: initReactionThermo is used by solidReaction where there is no
// need of setting a lhs - rhs thermo type for each reaction. This is
// needed for mechanism with reversible reactions
Reaction Reaction
( (
const speciesTable& species, const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase, const HashPtrTable<ReactionThermo>& thermoDatabase,
const dictionary& dict const dictionary& dict,
bool initReactionThermo = true
); );
//- Construct and return a clone //- Construct and return a clone

View File

@ -11,7 +11,7 @@ FoamFile
format ascii; format ascii;
class volScalarField; class volScalarField;
location "0"; location "0";
object Qr; object qr;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,7 +29,7 @@ FoamFile
filmCoupled false; filmCoupled false;
radFluxName Qr; qrHSource on;
minimumDelta 1e-6; minimumDelta 1e-6;

View File

@ -33,7 +33,7 @@ EulerImplicitCoeffs
odeCoeffs odeCoeffs
{ {
solver Rosenbrock43; solver Rosenbrock34;
absTol 1e-12; absTol 1e-12;
relTol 0.01; relTol 0.01;
} }

View File

@ -1,3 +1,12 @@
elements
(
O
C
H
N
);
species species
( (
O2 O2

View File

@ -21,6 +21,10 @@ O2
{ {
molWeight 31.9988; molWeight 31.9988;
} }
elements
{
O 2;
}
thermodynamics thermodynamics
{ {
Tlow 200; Tlow 200;
@ -42,6 +46,11 @@ H2O
{ {
molWeight 18.0153; molWeight 18.0153;
} }
elements
{
O 1;
H 2;
}
thermodynamics thermodynamics
{ {
Tlow 200; Tlow 200;
@ -63,6 +72,11 @@ CH4
{ {
molWeight 16.0428; molWeight 16.0428;
} }
elements
{
C 1;
H 4;
}
thermodynamics thermodynamics
{ {
Tlow 200; Tlow 200;
@ -84,6 +98,11 @@ CO2
{ {
molWeight 44.01; molWeight 44.01;
} }
elements
{
C 1;
O 2;
}
thermodynamics thermodynamics
{ {
Tlow 200; Tlow 200;
@ -105,6 +124,10 @@ N2
{ {
molWeight 28.0134; molWeight 28.0134;
} }
elements
{
N 2;
}
thermodynamics thermodynamics
{ {
Tlow 200; Tlow 200;