Skip to content
Snippets Groups Projects
Commit 4e6ec7d2 authored by Henry Weller's avatar Henry Weller
Browse files

functionObjects::specieReactionRates: Added volRegion support

Now the specie reaction rates may be averaged over the entire domain or
a specified cellZone.
parent 7b788f09
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ writeFileHeader ...@@ -37,6 +37,7 @@ writeFileHeader
) )
{ {
writeHeader(file(), "Specie reaction rates"); writeHeader(file(), "Specie reaction rates");
volRegion::writeFileHeader(*this, file());
writeHeaderValue(file(), "nSpecie", chemistryModel_.nSpecie()); writeHeaderValue(file(), "nSpecie", chemistryModel_.nSpecie());
writeHeaderValue(file(), "nReaction", chemistryModel_.nReaction()); writeHeaderValue(file(), "nReaction", chemistryModel_.nReaction());
...@@ -67,10 +68,14 @@ specieReactionRates ...@@ -67,10 +68,14 @@ specieReactionRates
) )
: :
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
volRegion(fvMeshFunctionObject::mesh_, dict),
logFiles(obr_, name), logFiles(obr_, name),
chemistryModel_ chemistryModel_
( (
mesh_.lookupObject<ChemistryModelType>("chemistryProperties") fvMeshFunctionObject::mesh_.lookupObject<ChemistryModelType>
(
"chemistryProperties"
)
) )
{ {
resetName("specieReactionRates"); resetName("specieReactionRates");
...@@ -114,8 +119,8 @@ bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::write() ...@@ -114,8 +119,8 @@ bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::write()
const label nSpecie = chemistryModel_.nSpecie(); const label nSpecie = chemistryModel_.nSpecie();
const label nReaction = chemistryModel_.nReaction(); const label nReaction = chemistryModel_.nReaction();
// Domain volume // Region volume
const scalar V = gSum(mesh_.V()); const scalar V = this->V();
for (label ri=0; ri<nReaction; ri++) for (label ri=0; ri<nReaction; ri++)
{ {
...@@ -132,9 +137,23 @@ bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::write() ...@@ -132,9 +137,23 @@ bool Foam::functionObjects::specieReactionRates<ChemistryModelType>::write()
chemistryModel_.calculateRR(ri, si) chemistryModel_.calculateRR(ri, si)
); );
scalar sumVRRi = 0;
if (isNull(cellIDs()))
{
sumVRRi = fvc::domainIntegrate(RR).value();
}
else
{
sumVRRi = gSum
(
scalarField(fvMeshFunctionObject::mesh_.V()*RR, cellIDs())
);
}
if (Pstream::master()) if (Pstream::master())
{ {
file() << token::TAB << fvc::domainIntegrate(RR).value()/V; file() << token::TAB << sumVRRi/V;
} }
} }
......
...@@ -33,6 +33,7 @@ Description ...@@ -33,6 +33,7 @@ Description
See also See also
Foam::functionObjects::fvMeshFunctionObject Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::volRegion
Foam::functionObjects::logFiles Foam::functionObjects::logFiles
SourceFiles SourceFiles
...@@ -44,6 +45,7 @@ SourceFiles ...@@ -44,6 +45,7 @@ SourceFiles
#define functionObjects_specieReactionRates_H #define functionObjects_specieReactionRates_H
#include "fvMeshFunctionObject.H" #include "fvMeshFunctionObject.H"
#include "volRegion.H"
#include "logFiles.H" #include "logFiles.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -61,6 +63,7 @@ template<class ChemistryModelType> ...@@ -61,6 +63,7 @@ template<class ChemistryModelType>
class specieReactionRates class specieReactionRates
: :
public fvMeshFunctionObject, public fvMeshFunctionObject,
public volRegion,
public logFiles public logFiles
{ {
// Private Member Data // Private Member Data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment