sootModelNew.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) 2013-2020 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 "error.H"
27 #include "sootModel.H"
28 #include "noSoot.H"
29 #include "basicThermo.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
35 (
36  const dictionary& dict,
37  const fvMesh& mesh
38 )
39 {
40  // Get the soot model type name
41  word modelType(sootModels::noSoot::typeName);
42  if (dict.found(sootModel::typeName))
43  {
44  dict.lookup(sootModel::typeName) >> modelType;
45  Info<< "Selecting soot model " << modelType << endl;
46  }
47 
48  // Backwards compatibility check
49  const wordList cmpts(basicThermo::splitThermoName(modelType, 3));
50  if (cmpts.size() == 3)
51  {
52  modelType = cmpts[0];
53 
55  << "Template parameters are no longer required when selecting a "
56  << sootModel::typeName << ". This information is now "
57  << "obtained directly from the thermodynamics. Actually selecting "
58  << "combustion model " << modelType << "." << endl;
59  }
60 
61  typename dictionaryConstructorTable::iterator cstrIter =
62  dictionaryConstructorTablePtr_->find(modelType);
63 
64  if (cstrIter == dictionaryConstructorTablePtr_->end())
65  {
67  << "Unknown " << sootModel::typeName << " type "
68  << modelType << nl << nl
69  << "Valid " << sootModel::typeName << " types are:" << nl
70  << dictionaryConstructorTablePtr_->sortedToc()
71  << exit(FatalError);
72  }
73 
74  return autoPtr<sootModel>(cstrIter()(dict, mesh, modelType));
75 }
76 
77 
78 // ************************************************************************* //
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
static wordList splitThermoName(const word &thermoName, const int nCmpt)
Split name of thermo package into a list of the components names.
Definition: basicThermo.C:117
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:860
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:659
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
const dictionary & dict() const
Reference to the dictionary.
Definition: sootModel.H:118
const fvMesh & mesh() const
Reference to the mesh.
Definition: sootModel.H:112
static autoPtr< sootModel > New(const dictionary &dict, const fvMesh &mesh)
Selector.
Definition: sootModelNew.C:35
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
#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:251
messageStream Info
error FatalError
static const char nl
Definition: Ostream.H:260
dictionary dict