combustionModelNew.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-2022 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 #include "noCombustion.H"
28 
29 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
30 
32 (
35  const word& combustionProperties
36 )
37 {
39  (
40  IOobject
41  (
42  thermo.phasePropertyName(combustionProperties),
43  thermo.T().mesh().time().constant(),
44  thermo.T().mesh(),
47  false
48  )
49  );
50 
51  word modelType(combustionModels::noCombustion::typeName);
52  if (combIO.headerOk())
53  {
54  IOdictionary(combIO).lookup(combustionModel::typeName) >> modelType;
55  }
56  else
57  {
58  Info<< "Combustion model not active: "
59  << thermo.phasePropertyName(combustionProperties)
60  << " not found" << endl;
61  }
62 
63  Info<< "Selecting combustion model " << modelType << endl;
64 
65  const wordList cmpts2(basicThermo::splitThermoName(modelType, 2));
66  const wordList cmpts3(basicThermo::splitThermoName(modelType, 3));
67  if (cmpts2.size() == 2 || cmpts3.size() == 3)
68  {
69  modelType = cmpts2.size() ? cmpts2[0] : cmpts3[0];
70 
72  << "Template parameters are no longer required when selecting a "
73  << combustionModel::typeName << ". This information is now "
74  << "obtained directly from the thermodynamics. Actually selecting "
75  << "combustion model " << modelType << "." << endl;
76  }
77 
78  typename dictionaryConstructorTable::iterator cstrIter =
79  dictionaryConstructorTablePtr_->find(modelType);
80 
81  if (cstrIter == dictionaryConstructorTablePtr_->end())
82  {
84  << "Unknown " << combustionModel::typeName << " type "
85  << modelType << nl << nl
86  << "Valid " << combustionModel::typeName << " types are:" << nl
87  << dictionaryConstructorTablePtr_->sortedToc()
88  << exit(FatalError);
89 
90  const wordList names(dictionaryConstructorTablePtr_->sortedToc());
91  }
92 
94  (
95  cstrIter()(modelType, thermo, turb, combustionProperties)
96  );
97 }
98 
99 
100 // ************************************************************************* //
const Mesh & mesh() const
Return mesh.
IOdictionary(const IOobject &io, const word &wantedType)
Construct given an IOobject, supply wanted typeName.
Definition: IOdictionary.C:47
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
static word phasePropertyName(const word &name, const word &phaseName)
Name of a property for a given phase.
Definition: basicThermo.H:154
static wordList splitThermoName(const word &thermoName, const int nCmpt)
Split name of thermo package into a list of the components names.
Definition: basicThermo.C:81
virtual const volScalarField & T() const =0
Temperature [K].
const fluidMulticomponentThermo & thermo() const
Return const access to the thermo.
static autoPtr< combustionModel > New(const fluidMulticomponentThermo &thermo, const compressibleMomentumTransportModel &turb, const word &combustionProperties=combustionPropertiesName)
Select using thermo and turbulence.
Base class for single-phase compressible turbulence models.
Base-class for multi-component fluid thermodynamic properties.
Templated form of IOobject providing type information for file reading and header type checking.
Definition: IOobject.H:531
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
#define WarningInFunction
Report a warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
messageStream Info
error FatalError
static const char nl
Definition: Ostream.H:266
fluidMulticomponentThermo & thermo
Definition: createFields.H:31