basicSolidChemistryModelNew.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) 2013-2017 OpenFOAM Foundation
9  Copyright (C) 2019-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 \*---------------------------------------------------------------------------*/
28 
30 
31 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
32 
35 {
36  const IOdictionary chemistryDict
37  (
38  IOobject
39  (
40  thermo.phasePropertyName("chemistryProperties"),
41  thermo.db().time().constant(),
42  thermo.db(),
46  )
47  );
48 
49  const dictionary& chemistryTypeDict =
50  chemistryDict.subDict("chemistryType");
51 
52  Info<< "Selecting chemistry type " << chemistryTypeDict << endl;
53 
55  (
56  IOobject
57  (
59  thermo.db().time().constant(),
60  thermo.db(),
64  )
65  );
66 
67  const dictionary& solidThermoTypeDict = thermoDict.subDict("thermoType");
68  const word solidThermoTypeName
69  (
70  solidThermoTypeDict.get<word>("transport") + '<'
71  + solidThermoTypeDict.get<word>("thermo") + '<'
72  + solidThermoTypeDict.get<word>("equationOfState") + '<'
73  + solidThermoTypeDict.get<word>("specie") + ">>,"
74  + solidThermoTypeDict.get<word>("energy") + ">"
75  );
76 
77  const dictionary& gasThermoTypeDict = thermoDict.subDict("gasThermoType");
78  const word gasThermoTypeName
79  (
80  gasThermoTypeDict.get<word>("transport") + '<'
81  + gasThermoTypeDict.get<word>("thermo") + '<'
82  + gasThermoTypeDict.get<word>("equationOfState") + '<'
83  + gasThermoTypeDict.get<word>("specie") + ">>,"
84  + gasThermoTypeDict.get<word>("energy") + ">"
85  );
86 
87  // Construct the name of the chemistry type from the components
88  const word chemistryTypeName
89  (
90  chemistryTypeDict.get<word>("chemistrySolver") + '<'
91  + chemistryTypeDict.get<word>("chemistryThermo") + '<'
92  + typeName + ','
93  + solidThermoTypeName + ',' + gasThermoTypeName + ">>"
94  );
95 
96  Info<< "chemistryTypeName " << chemistryTypeName << endl;
97 
98  const auto& cnstrTable = *(thermoConstructorTablePtr_);
99 
100  auto* ctorPtr = cnstrTable.lookup(chemistryTypeName, nullptr);
101 
102  if (!ctorPtr)
103  {
105  (
106  chemistryTypeDict,
107  typeName,
108  word::null, // Suppress long name? Just output dictionary (above)
109  cnstrTable
110  );
111 
112  // Table of available packages (as constituent parts)
114  (
115  FatalIOError,
116  wordList
117  ({
118  "chemistrySolver",
119  "chemistryThermo",
120  "baseChemistry",
121  "transport",
122  "thermo", // solid
123  "equationOfState",
124  "specie",
125  "energy",
126  "transport",
127  "thermo", // gas
128  "equationOfState",
129  "specie",
130  "energy"
131  }),
132  cnstrTable.sortedToc()
133  );
134 
136  << exit(FatalIOError);
137  }
138 
139  return autoPtr<basicSolidChemistryModel>(ctorPtr(thermo));
140 }
141 
142 
143 // ************************************************************************* //
word dictName() const
The local dictionary name (final part of scoped name)
Definition: dictionaryI.H:53
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
static Ostream & printThermoNames(Ostream &os, const wordList &cmptNames, const wordList &thermoNames)
Print (filtered) table of thermo names, splits on " ,<>".
Definition: basicThermo.C:68
Foam::solidReactionThermo.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
Ignore writing from objectRegistry::writeObject()
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:441
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
static autoPtr< basicSolidChemistryModel > New(solidReactionThermo &thermo)
Selector.
A class for handling words, derived from Foam::string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:84
const dictionary & thermoDict
Definition: EEqn.H:16
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
messageStream Info
Information stream (stdout output on master, null elsewhere)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:635
Do not request registration (bool: false)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...