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-2021 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 (
33  const fluidReactionThermo& thermo,
35  const word& combustionProperties
36 )
37 {
39  (
40  IOobject
41  (
42  thermo.phasePropertyName(combustionProperties),
43  thermo.T().mesh().time().constant(),
44  thermo.T().mesh(),
45  IOobject::MUST_READ,
46  IOobject::NO_WRITE,
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 // ************************************************************************* //
fluidReactionThermo & thermo
Definition: createFields.H:28
static word phasePropertyName(const word &name, const word &phaseName)
Name of a property for a given phase.
Definition: basicThermo.H:150
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
Templated form of IOobject providing type information for file reading and header type checking...
Definition: IOobject.H:537
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Base-class for multi-component fluid thermodynamic properties.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
static autoPtr< combustionModel > New(const fluidReactionThermo &thermo, const compressibleMomentumTransportModel &turb, const word &combustionProperties=combustionPropertiesName)
Select using thermo and turbulence.
A class for handling words, derived from string.
Definition: word.H:59
static const char nl
Definition: Ostream.H:260
const Mesh & mesh() const
Return mesh.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual const volScalarField & T() const =0
Temperature [K].
messageStream Info
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:98
Base class for single-phase compressible turbulence models.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864