Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
29#include "combustionModel.H"
30
31// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32
33namespace Foam
34{
36}
37
39(
40 "combustionProperties"
41);
42
43
44// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45
46Foam::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 }
70 return io;
71}
72
73
74// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75
76Foam::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 * * * * * * * * * * * * * * * //
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// ************************************************************************* //
compressible::turbulenceModel & turb
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition Switch.H:81
Abstract base-class for fluid and solid thermodynamic properties.
Definition basicThermo.H:62
Base class for combustion models.
const word modelType_
Model type.
const fvMesh & mesh_
Reference to the mesh database.
static const word combustionPropertiesName
Default combustionProperties dictionary name.
dictionary coeffs_
Dictionary of the model.
virtual ~combustionModel()
Destructor.
const fvMesh & mesh() const
Return const access to the mesh database.
const compressibleTurbulenceModel & turb_
Reference to the turbulence model.
virtual bool read()
Update properties from given dictionary.
Abstract base class for turbulence models (RAS, LES and laminar).
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
Definition dictionary.C:560
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, IOobjectOption::readOption readOpt=IOobjectOption::MUST_READ) const
Find entry and assign to T val. FatalIOError if it is found and the number of tokens is incorrect,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
virtual bool read()
Read object.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
volScalarField & p
dynamicFvMesh & mesh
const auto & io
Namespace for OpenFOAM.