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-------------------------------------------------------------------------------
11License
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
33template<class ThermoType>
35(
36 const speciesTable& species,
37 const ReactionTable<ThermoType>& thermoDb
38)
39:
40 SLPtrList<Reaction<ThermoType>>(),
41 species_(species),
42 thermoDb_(thermoDb),
43 dict_()
44{}
45
46
47template<class ThermoType>
49(
50 const speciesTable& species,
51 const ReactionTable<ThermoType>& thermoDb,
52 const dictionary& dict
53)
54:
55 SLPtrList<Reaction<ThermoType>>(),
56 species_(species),
57 thermoDb_(thermoDb),
58 dict_(dict)
59{
61}
62
63
64template<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
76template<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
96template<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
109 }
110
112}
113
114
115// ************************************************************************* //
Template class for non-intrusive linked PtrLists.
Definition: LPtrList.H:75
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:105
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:239
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:87
List of templated reactions.
Definition: ReactionList.H:59
bool readReactionDict()
Read reactions from dictionary.
Definition: ReactionList.C:77
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
Definition: Reaction.H:73
virtual void write(Ostream &os) const
Write.
Definition: Reaction.C:387
const word & name() const noexcept
Name of reaction.
Definition: Reaction.H:267
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:70
virtual bool write()
Write the output fields.
A wordList with hashed named lookup, which can be faster in some situations than using the normal lis...
OBJstream os(runTime.globalPath()/outputName)
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
dictionary dict