reactionModel.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) 2011-2026 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 "reactionModel.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
34 }
35 
37 (
38  "reactionProperties"
39 );
40 
41 
42 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43 
44 Foam::IOobject Foam::reactionModel::createIOobject
45 (
46  const fluidMulticomponentThermo& thermo,
47  const word& reactionProperties
48 ) const
49 {
50  typeIOobject<IOdictionary> io
51  (
52  thermo.phasePropertyName(reactionProperties),
53  thermo.T().mesh().time().constant(),
54  thermo.T().mesh(),
57  );
58 
59  if (io.headerOk())
60  {
61  io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
62  return io;
63  }
64  else
65  {
66  io.readOpt() = IOobject::NO_READ;
67  return io;
68  }
69 }
70 
71 
72 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
73 
75 (
76  const word& modelType,
79  const word& reactionProperties
80 )
81 :
82  IOdictionary(createIOobject(thermo, reactionProperties)),
83  mesh_(thermo.T().mesh()),
84  thermo_(thermo),
85  turb_(turb),
86  coeffs_(optionalTypeDict(modelType)),
87  modelType_(modelType)
88 {}
89 
90 
91 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
92 
94 {}
95 
96 
97 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
98 
100 {
101  if (regIOobject::read())
102  {
103  coeffs_ = optionalTypeDict(modelType_);
104  return true;
105  }
106  else
107  {
108  return false;
109  }
110 }
111 
112 
113 // ************************************************************************* //
const GeoMesh & mesh() const
Return mesh.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:119
static word phasePropertyName(const word &name, const word &phaseName)
Name of a property for a given phase.
Definition: basicThermo.H:151
virtual const volScalarField & T() const =0
Temperature [K].
Base class for single-phase compressible momentum transport models.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base-class for multi-component fluid thermodynamic properties.
Base class for reaction models.
Definition: reactionModel.H:53
const fluidMulticomponentThermo & thermo() const
Return const access to the thermo.
virtual ~reactionModel()
Destructor.
Definition: reactionModel.C:93
reactionModel(const word &modelType, const fluidMulticomponentThermo &thermo, const compressibleMomentumTransportModel &turb, const word &reactionProperties=reactionPropertiesName)
Construct from components.
Definition: reactionModel.C:75
static const word reactionPropertiesName
Default reactionProperties dictionary name.
Definition: reactionModel.H:90
virtual bool read()
Update properties from given dictionary.
Definition: reactionModel.C:99
virtual bool read()
Read object.
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
defineRunTimeSelectionTable(fvConstraint, dictionary)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
fluidMulticomponentThermo & thermo
Definition: createFields.H:15