combustionModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2020-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "combustionModel.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(combustionModel, 0);
36 }
37 
39 (
40  "combustionProperties"
41 );
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
46 Foam::IOobject Foam::combustionModel::createIOobject
47 (
48  basicThermo& thermo,
49  const word& combustionProperties
50 ) const
51 {
52  IOobject io
53  (
54  thermo.phasePropertyName(combustionProperties),
55  thermo.db().time().constant(),
56  thermo.db(),
59  );
60 
61  if (io.typeHeaderOk<IOdictionary>(true))
62  {
64  }
65  else
66  {
67  io.readOpt(IOobject::NO_READ);
68  }
69 
70  return io;
71 }
72 
73 
74 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75 
76 Foam::combustionModel::combustionModel
77 (
78  const word& modelType,
81  const word& combustionProperties
82 )
83 :
84  IOdictionary(createIOobject(thermo, combustionProperties)),
85  mesh_(thermo.p().mesh()),
86  turb_(turb),
87  active_(getOrDefault<Switch>("active", true)),
88  coeffs_(optionalSubDict(modelType + "Coeffs")),
89  modelType_(modelType)
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94 
96 {}
97 
98 
99 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
100 
102 {
103  if (regIOobject::read())
104  {
105  this->readEntry("active", active_);
106  coeffs_ = optionalSubDict(modelType_ + "Coeffs");
107  return true;
108  }
109 
110  return false;
111 }
112 
113 
114 // ************************************************************************* //
Abstract base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:59
IOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
Definition: IOdictionary.C:30
virtual bool read()
Read object.
compressible::turbulenceModel & turb
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
Definition: Switch.H:77
Ignore writing from objectRegistry::writeObject()
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
psiReactionThermo & thermo
Definition: createFields.H:28
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual ~combustionModel()
Destructor.
virtual bool read()
Update properties from given dictionary.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Abstract base class for turbulence models (RAS, LES and laminar).
defineTypeNameAndDebug(combustionModel, 0)
IOobject(const IOobject &)=default
Copy construct.
Nothing to be read.
volScalarField & p
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Namespace for OpenFOAM.
static const word combustionPropertiesName
Default combustionProperties dictionary name.