ReactionList.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) 2011-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 
29 #include "ReactionList.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class ThermoType>
35 (
36  const speciesTable& species,
37  const ReactionTable<ThermoType>& thermoDb
38 )
39 :
41  species_(species),
42  thermoDb_(thermoDb),
43  dict_()
44 {}
45 
46 
47 template<class ThermoType>
49 (
50  const speciesTable& species,
51  const ReactionTable<ThermoType>& thermoDb,
52  const dictionary& dict
53 )
54 :
56  species_(species),
57  thermoDb_(thermoDb),
58  dict_(dict)
59 {
60  readReactionDict();
61 }
62 
63 
64 template<class ThermoType>
66 :
67  SLPtrList<Reaction<ThermoType>>(reactions),
68  species_(reactions.species_),
69  thermoDb_(reactions.thermoDb_),
70  dict_(reactions.dict_)
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
75 
76 template<class ThermoType>
78 {
79  for (const entry& dEntry : dict_.subDict("reactions"))
80  {
81  this->append
82  (
84  (
85  species_,
86  thermoDb_,
87  dEntry.dict()
88  ).ptr()
89  );
90  }
91 
92  return true;
93 }
94 
95 
96 template<class ThermoType>
98 {
99  os.beginBlock("reactions");
100 
101  for (const Reaction<ThermoType>& r : *this)
102  {
103  os.beginBlock(r.name());
104 
105  os.writeEntry("type", r.type());
106  r.write(os);
107 
108  os.endBlock();
109  }
110 
111  os.endBlock();
112 }
113 
114 
115 // ************************************************************************* //
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
ReactionList.H
Foam::Reaction::name
const word & name() const noexcept
Name of reaction.
Definition: Reaction.H:253
append
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
Foam::LPtrList
Template class for non-intrusive linked PtrLists.
Definition: LPtrList.H:50
Foam::ReactionList::ReactionList
ReactionList(const speciesTable &species, const ReactionTable< ThermoType > &thermoDatabase)
Construct empty list.
Definition: ReactionList.C:35
Foam::ReactionList
List of templated reactions.
Definition: ReactionList.H:56
Foam::hashedWordList
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
Definition: hashedWordList.H:54
Foam::Reaction::write
virtual void write(Ostream &os) const
Write.
Definition: Reaction.C:385
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::HashPtrTable< ThermoType >
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::ReactionList::readReactionDict
bool readReactionDict()
Read reactions from dictionary.
Definition: ReactionList.C:77
Foam::Reaction
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Definition: Reaction.H:59
Foam::ReactionList::write
void write(Ostream &os) const
Write.
Definition: ReactionList.C:97