functionObjects::specieReactionRates: New functionObject to write the domain averaged reaction rates for each specie for each reaction
This commit is contained in:
parent
4765702445
commit
3621de7990
5 changed files with 338 additions and 2 deletions
|
|
@ -11,4 +11,6 @@ chemistryModel/TDACChemistryModel/tabulation/makeChemistryTabulationMethods.C
|
|||
|
||||
chemistrySolver/chemistrySolver/makeChemistrySolvers.C
|
||||
|
||||
functionObjects/specieReactionRates/specieReactionRates.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libchemistryModel
|
||||
|
|
|
|||
|
|
@ -124,6 +124,12 @@ public:
|
|||
//- Chemistry activation switch
|
||||
inline Switch chemistry() const;
|
||||
|
||||
//- The number of species
|
||||
virtual label nSpecie() const = 0;
|
||||
|
||||
//- The number of reactions
|
||||
virtual label nReaction() const = 0;
|
||||
|
||||
//- Return the latest estimation of integration step
|
||||
inline const volScalarField::Internal& deltaTChem() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -141,10 +141,10 @@ public:
|
|||
inline const PtrList<ThermoType>& specieThermo() const;
|
||||
|
||||
//- The number of species
|
||||
inline label nSpecie() const;
|
||||
virtual inline label nSpecie() const;
|
||||
|
||||
//- The number of reactions
|
||||
inline label nReaction() const;
|
||||
virtual inline label nReaction() const;
|
||||
|
||||
//- Temperature below which the reaction rates are assumed 0
|
||||
inline scalar Treact() const;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,202 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
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 "specieReactionRates.H"
|
||||
#include "volFields.H"
|
||||
#include "fvcVolumeIntegrate.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class ChemistryModelType>
|
||||
void Foam::functionObjects::specieReactionRates<ChemistryModelType>::
|
||||
writeFileHeader
|
||||
(
|
||||
const label i
|
||||
)
|
||||
{
|
||||
writeHeader(file(), "Specie reaction rates");
|
||||
writeHeaderValue(file(), "nSpecie", chemistryModel_.nSpecie());
|
||||
writeHeaderValue(file(), "nReaction", chemistryModel_.nReaction());
|
||||
|
||||
writeCommented(file(), "Time");
|
||||
writeTabbed(file(), "Reaction");
|
||||
|
||||
const wordList& speciesNames =
|
||||
chemistryModel_.thermo().composition().species();
|
||||
|
||||
forAll (speciesNames, si)
|
||||
{
|
||||
writeTabbed(file(), speciesNames[si]);
|
||||
}
|
||||
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ChemistryModelType>
|
||||
Foam::functionObjects::specieReactionRates<ChemistryModelType>::
|
||||
specieReactionRates
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name),
|
||||
chemistryModel_
|
||||
(
|
||||
mesh_.lookupObject<ChemistryModelType>("chemistryProperties")
|
||||
)
|
||||
{
|
||||
resetName("specieReactionRates");
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ChemistryModelType>
|
||||
Foam::functionObjects::specieReactionRates<ChemistryModelType>::
|
||||
~specieReactionRates()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class ChemistryModelType>
|
||||
bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
regionFunctionObject::read(dict);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class ChemistryModelType>
|
||||
bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::execute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class ChemistryModelType>
|
||||
bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::write()
|
||||
{
|
||||
logFiles::write();
|
||||
|
||||
const label nSpecie = chemistryModel_.nSpecie();
|
||||
const label nReaction = chemistryModel_.nReaction();
|
||||
|
||||
// Domain volume
|
||||
const scalar V = gSum(mesh_.V());
|
||||
|
||||
for (label ri=0; ri<nReaction; ri++)
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file());
|
||||
file() << token::TAB << ri;
|
||||
}
|
||||
|
||||
for (label si=0; si<nSpecie; si++)
|
||||
{
|
||||
volScalarField::Internal RR
|
||||
(
|
||||
chemistryModel_.calculateRR(ri, si)
|
||||
);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << token::TAB << fvc::domainIntegrate(RR).value()/V;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
file() << nl << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "rhoChemistryModel.H"
|
||||
#include "psiChemistryModel.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
typedef specieReactionRates<psiChemistryModel> psiSpecieReactionRates;
|
||||
|
||||
defineTemplateTypeNameAndDebugWithName
|
||||
(
|
||||
psiSpecieReactionRates,
|
||||
"psiSpecieReactionRates",
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
psiSpecieReactionRates,
|
||||
dictionary
|
||||
);
|
||||
|
||||
|
||||
typedef specieReactionRates<rhoChemistryModel> rhoSpecieReactionRates;
|
||||
|
||||
defineTemplateTypeNameAndDebugWithName
|
||||
(
|
||||
rhoSpecieReactionRates,
|
||||
"rhoSpecieReactionRates",
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
rhoSpecieReactionRates,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
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/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::specieReactionRates
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
Writes the domain averaged reaction rates for each specie for each reaction
|
||||
into the file \<timeDir\>/specieReactionRates.dat
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
|
||||
SourceFiles
|
||||
specieReactionRates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_specieReactionRates_H
|
||||
#define functionObjects_specieReactionRates_H
|
||||
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class specieReactionRates Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ChemistryModelType>
|
||||
class specieReactionRates
|
||||
:
|
||||
public fvMeshFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
// Private Member Data
|
||||
|
||||
const ChemistryModelType& chemistryModel_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
specieReactionRates(const specieReactionRates&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const specieReactionRates&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("specieReactionRates");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
specieReactionRates
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~specieReactionRates();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the specieReactionRates data
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Do nothing
|
||||
virtual bool execute();
|
||||
|
||||
//- Write the specie reaction rates
|
||||
virtual bool write();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Loading…
Add table
Reference in a new issue