chemistryReductionMethodNew.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 | Copyright (C) 2016 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 
27 #include "Time.H"
28 
29 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
30 
31 template<class CompType, class ThermoType>
34 (
35  const IOdictionary& dict,
37 )
38 {
39  IOdictionary thermoDict
40  (
41  IOobject
42  (
43  "thermophysicalProperties",
44  dict.db().time().constant(),
45  dict.db(),
46  IOobject::MUST_READ_IF_MODIFIED,
47  IOobject::NO_WRITE,
48  false
49  )
50  );
51 
52  word thermoTypeName;
53 
54  if (thermoDict.isDict("thermoType"))
55  {
56  const dictionary& thermoTypeDict(thermoDict.subDict("thermoType"));
57  thermoTypeName =
58  word(thermoTypeDict.lookup("transport")) + '<'
59  + word(thermoTypeDict.lookup("thermo")) + '<'
60  + word(thermoTypeDict.lookup("equationOfState")) + '<'
61  + word(thermoTypeDict.lookup("specie")) + ">>,"
62  + word(thermoTypeDict.lookup("energy")) + ">";
63  }
64  else
65  {
66  FatalIOErrorInFunction(thermoDict)
67  << "thermoType is in the old format and must be upgraded"
68  << exit(FatalIOError);
69  }
70 
71  dictionary MRdict(dict.subDict("reduction"));
72 
73  word chemistryReductionMethodTypeName =
74  word(MRdict.lookup("method")) + '<'
75  + word(dict.subDict("chemistryType").lookup("chemistryThermo")) + ','
76  + thermoTypeName + '>';
77 
78  typename dictionaryConstructorTable::iterator cstrIter =
79  dictionaryConstructorTablePtr_->find(chemistryReductionMethodTypeName);
80 
81  if (cstrIter == dictionaryConstructorTablePtr_->end())
82  {
84  << "Unknown chemistryReductionMethodType type "
85  << chemistryReductionMethodTypeName
86  << endl << endl
87  << "Valid chemistryReductionMethodType types are :" << endl
88  << dictionaryConstructorTablePtr_->toc()
89  << exit(FatalError);
90  }
91 
93  (
94  cstrIter()(dict, chemistry)
95  );
96 }
97 
98 
99 // ************************************************************************* //
Extends chemistryModel by adding the TDAC method.
dictionary dict
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
static autoPtr< chemistryReductionMethod< CompType, ThermoType > > New(const IOdictionary &dict, TDACChemistryModel< CompType, ThermoType > &chemistry)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:646
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:692
A class for handling words, derived from string.
Definition: word.H:59
const word & constant() const
Return constant name.
Definition: TimePaths.H:124
const Time & time() const
Return time.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:331
psiChemistryModel & chemistry
Definition: createFields.H:29
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:331
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:576
IOerror FatalIOError