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(),
45  false
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(),
63  false
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 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::solidReactionThermo
Foam::solidReactionThermo.
Definition: solidReactionThermo.H:55
basicSolidChemistryModel.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::dictionary::get
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:107
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::basicThermo::printThermoNames
static Ostream & printThermoNames(Ostream &os, const wordList &cmptNames, const wordList &thermoNames)
Print (filtered) table of thermo names, splits on " ,<>".
Definition: basicThermo.C:75
Foam::dictionary::subDict
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:460
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::basicSolidChemistryModel::New
static autoPtr< basicSolidChemistryModel > New(solidReactionThermo &thermo)
Selector.
Definition: basicSolidChemistryModelNew.C:34
Foam::autoPtr< Foam::basicSolidChemistryModel >
thermoDict
const dictionary & thermoDict
Definition: EEqn.H:16
Foam::List< word >
Foam::word::null
static const word null
An empty word.
Definition: word.H:80
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:186
Foam::IOobject::MUST_READ
Definition: IOobject.H:185
Foam::dictionary::dictName
word dictName() const
The local dictionary name (final part of scoped name)
Definition: dictionaryI.H:60