Qdot.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2019-2022 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 "Qdot.H"
27 #include "combustionModel.H"
28 #include "volFields.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 namespace functionObjects
36 {
38 
40  (
42  Qdot,
44  );
45 }
46 }
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
52 (
53  const word& name,
54  const Time& runTime,
55  const dictionary& dict
56 )
57 :
58  fvMeshFunctionObject(name, runTime, dict),
59  writeLocalObjects(obr_),
60  phaseName_(word::null)
61 {
62  read(dict);
64 }
65 
66 
67 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
68 
70 {}
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
76 (
77  const dictionary& dict
78 )
79 {
82 
83  phaseName_ = dict.lookupOrDefault<word>("phase", word::null);
84 
85  return true;
86 }
87 
88 
90 {
91  word fieldName(IOobject::groupName(type(), phaseName_));
92 
93  const word modelName
94  (
96  (
98  phaseName_
99  )
100  );
101 
102  return
103  store
104  (
105  fieldName,
106  mesh_.lookupObject<combustionModel>(modelName).Qdot()
107  );
108 }
109 
110 
112 {
113  return writeLocalObjects::write();
114 }
115 
116 
117 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
static word groupName(Name name, const word &group)
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
Base class for combustion models.
virtual tmp< volScalarField > Qdot() const =0
Heat release rate [kg/m/s^3].
static const word combustionPropertiesName
Default combustionProperties dictionary name.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Abstract base-class for Time/database functionObjects.
virtual const word & type() const =0
Runtime type information.
Calculates and outputs the heat release rate for the current combustion model.
Definition: Qdot.H:56
Qdot(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: Qdot.C:52
virtual ~Qdot()
Destructor.
Definition: Qdot.C:69
virtual bool execute()
Calculate the Qdot field.
Definition: Qdot.C:89
virtual bool write()
Do nothing.
Definition: Qdot.C:111
virtual bool read(const dictionary &)
Read the data.
Definition: Qdot.C:76
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
virtual bool read(const dictionary &)
Read optional controls.
FunctionObject base class for managing a list of objects on behalf of the inheriting function object,...
void resetLocalObjectName(const word &name)
Reset the list of local object names from a single word.
virtual bool read(const dictionary &)
Read the list of objects to be written.
virtual bool write()
Write function.
A class for handling words, derived from string.
Definition: word.H:62
static const word null
An empty word.
Definition: word.H:77
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
Namespace for OpenFOAM.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
dictionary dict