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 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_, false),
60  phaseName_(word::null)
61 {
62  read(dict);
63  resetLocalObjectName(IOobject::groupName(type(), phaseName_));
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 // ************************************************************************* //
virtual bool write()
Write function.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
Abstract base-class for Time/database functionObjects.
virtual ~Qdot()
Destructor.
Definition: Qdot.C:69
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Macros for easy insertion into run-time selection tables.
Qdot(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: Qdot.C:52
virtual bool read(const dictionary &)
Read optional controls.
bool read(const char *, int32_t &)
Definition: int32IO.C:85
virtual bool write()
Do nothing.
Definition: Qdot.C:111
virtual tmp< volScalarField > Qdot() const =0
Heat release rate [kg/m/s^3].
A class for handling words, derived from string.
Definition: word.H:59
static word groupName(Name name, const word &group)
Calculates and outputs the heat release rate for the current combustion model.
Definition: Qdot.H:52
static const word null
An empty word.
Definition: word.H:77
Base class for combustion models.
virtual bool read(const dictionary &)
Read the data.
Definition: Qdot.C:76
defineTypeNameAndDebug(Qdot, 0)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
FunctionObject base class for managing a list of objects on behalf of the inheriting function object...
virtual bool read(const dictionary &)
Read the list of objects to be written.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
virtual bool execute()
Calculate the Qdot field.
Definition: Qdot.C:89
Namespace for OpenFOAM.
static const word combustionPropertiesName
Default combustionProperties dictionary name.