combustionModel.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-2018 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 "combustionModel.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(combustionModel, 0);
33 }
34 
36 (
37  "combustionProperties"
38 );
39 
40 
41 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
42 
43 Foam::IOobject Foam::combustionModel::createIOobject
44 (
45  basicThermo& thermo,
46  const word& combustionProperties
47 ) const
48 {
49  IOobject io
50  (
51  thermo.phasePropertyName(combustionProperties),
52  thermo.db().time().constant(),
53  thermo.db(),
56  );
57 
58  if (io.typeHeaderOk<IOdictionary>(true))
59  {
61  return io;
62  }
63  else
64  {
65  io.readOpt() = IOobject::NO_READ;
66  return io;
67  }
68 }
69 
70 
71 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72 
73 Foam::combustionModel::combustionModel
74 (
75  const word& modelType,
76  basicThermo& thermo,
77  const compressibleTurbulenceModel& turb,
78  const word& combustionProperties
79 )
80 :
81  IOdictionary(createIOobject(thermo, combustionProperties)),
82  mesh_(thermo.p().mesh()),
83  turb_(turb),
84  active_(lookupOrDefault<Switch>("active", true)),
85  coeffs_(optionalSubDict(modelType + "Coeffs")),
86  modelType_(modelType)
87 {}
88 
89 
90 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 
93 {}
94 
95 
96 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
97 
99 {
100  if (regIOobject::read())
101  {
102  this->lookup("active") >> active_;
103  coeffs_ = optionalSubDict(modelType_ + "Coeffs");
104  return true;
105  }
106  else
107  {
108  return false;
109  }
110 }
111 
112 
113 // ************************************************************************* //
Abstract base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:52
virtual bool read()
Read object.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
virtual volScalarField & p()
Pressure [Pa].
Definition: basicThermo.C:487
stressControl lookup("compactNormalStress") >> compactNormalStress
A class for handling words, derived from string.
Definition: word.H:59
virtual ~combustionModel()
Destructor.
virtual bool read()
Update properties from given dictionary.
Abstract base class for turbulence models (RAS, LES and laminar).
const Mesh & mesh() const
Return mesh.
defineTypeNameAndDebug(combustionModel, 0)
readOption readOpt() const
Definition: IOobject.H:359
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.
static const word combustionPropertiesName
Default combustionProperties dictionary name.