Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
combustionModels: Added Qdot function object
This function object writes out the heat release rate field for a
combustion model. This is useful for solvers where combustion is
optional, and which do not therefore write out the heat release rate by
default; e.g., chtMultiRegionFoam and reactingTwoPhaseEulerFoam.
  • Loading branch information
Will Bainbridge committed Jan 24, 2019
1 parent a085029 commit dc25f10
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/combustionModels/Make/files
Expand Up @@ -20,4 +20,6 @@ zoneCombustion/zoneCombustions.C

noCombustion/noCombustions.C

functionObjects/Qdot/Qdot.C

LIB = $(FOAM_LIBBIN)/libcombustionModels
117 changes: 117 additions & 0 deletions src/combustionModels/functionObjects/Qdot/Qdot.C
@@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 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 "Qdot.H"
#include "combustionModel.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(Qdot, 0);

addToRunTimeSelectionTable
(
functionObject,
Qdot,
dictionary
);
}
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::functionObjects::Qdot::Qdot
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
writeLocalObjects(obr_, false),
phaseName_(word::null)
{
read(dict);
resetLocalObjectName(type());
}


// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

Foam::functionObjects::Qdot::~Qdot()
{}


// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

bool Foam::functionObjects::Qdot::read
(
const dictionary& dict
)
{
fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict);

phaseName_ = dict.lookupOrDefault<word>("phase", word::null);

return true;
}


bool Foam::functionObjects::Qdot::execute()
{
word fieldName(IOobject::groupName(type(), phaseName_));

const word modelName
(
IOobject::groupName
(
combustionModel::combustionPropertiesName,
phaseName_
)
);

return
store
(
fieldName,
mesh_.lookupObject<combustionModel>(modelName).Qdot()
);
}


bool Foam::functionObjects::Qdot::write()
{
return writeLocalObjects::write();
}


// ************************************************************************* //
109 changes: 109 additions & 0 deletions src/combustionModels/functionObjects/Qdot/Qdot.H
@@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 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::Qdot
Description
Calculates and outputs the heat release rate for the current combustion
model.
SourceFiles
Qdot.C
\*---------------------------------------------------------------------------*/

#ifndef functionObjects_Qdot_H
#define functionObjects_Qdot_H

#include "fvMeshFunctionObject.H"
#include "writeLocalObjects.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace functionObjects
{

/*---------------------------------------------------------------------------*\
Class Qdot Declaration
\*---------------------------------------------------------------------------*/

class Qdot
:
public fvMeshFunctionObject,
public writeLocalObjects
{
private:

// Private data

//- The name of the phase
word phaseName_;


public:

//- Runtime type information
TypeName("Qdot");


// Constructors

//- Construct from Time and dictionary
Qdot
(
const word& name,
const Time& runTime,
const dictionary& dict
);


//- Destructor
virtual ~Qdot();


// Member Functions

//- Read the data
virtual bool read(const dictionary&);

//- Calculate the Qdot field
virtual bool execute();

//- Do nothing
virtual bool write();
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace functionObjects
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
Expand Up @@ -17,7 +17,7 @@ FoamFile

dimensions [ 0 2 -3 0 0 0 0 ];

internalField uniform 1.27351e-06;
internalField uniform 3.60203e-06;

boundaryField
{
Expand Down
Expand Up @@ -17,7 +17,7 @@ FoamFile

dimensions [ 0 2 -2 0 0 0 0 ];

internalField uniform 8.4375e-05;
internalField uniform 0.00016875;

boundaryField
{
Expand Down
@@ -0,0 +1,17 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Calculates the heat release rate Qdot, outputting the data as a Qdot field.
\*---------------------------------------------------------------------------*/

#includeEtc "caseDicts/postProcessing/combustion/Qdot.cfg"

region gas;

// ************************************************************************* //
Expand Up @@ -51,5 +51,10 @@ maxDi 5.0;

adjustTimeStep yes;

functions
{
#includeFunc Qdot
}


// ************************************************************************* //

0 comments on commit dc25f10

Please sign in to comment.