pyrolysisModelCollection.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-2015 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29#include "volFields.H"
30
31// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32
33namespace Foam
34{
35 namespace regionModels
36 {
37 namespace pyrolysisModels
38 {
40 }
41 }
42}
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48namespace regionModels
49{
50namespace pyrolysisModels
51{
52
53// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54
56:
58{
59 IOdictionary pyrolysisZonesDict
60 (
62 (
63 "pyrolysisZones",
64 mesh.time().constant(),
65 mesh,
68 )
69 );
70
71 const wordList regions(pyrolysisZonesDict.toc());
72
73 setSize(regions.size());
74
75 for (label i = 0; i < regions.size(); i++)
76 {
77 set
78 (
79 i,
81 (
82 mesh,
83 pyrolysisZonesDict.subDict(regions[i]),
84 regions[i]
85 )
86 );
87 }
88}
89
90
91// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
92
94{}
95
96
97// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98
99
101{
102 forAll(*this, i)
103 {
104 this->operator[](i).preEvolveRegion();
105 }
106}
107
108
110{
111 forAll(*this, i)
112 {
113 this->operator[](i).evolveRegion();
114 }
115}
116
117
119{
120 forAll(*this, i)
121 {
122 pyrolysisModel& pyrolysis = this->operator[](i);
123
124 if (pyrolysis.active())
125 {
126 if (pyrolysis.primaryMesh().changing())
127 {
129 << "Currently not possible to apply "
130 << pyrolysis.modelName()
131 << " model to moving mesh cases" << nl<< abort(FatalError);
132 }
133
134 // Pre-evolve
135 pyrolysis.preEvolveRegion();
136
137 // Increment the region equations up to the new time level
138 pyrolysis.evolveRegion();
139
140 // Provide some feedback
141 if (pyrolysis.infoOutput())
142 {
144 pyrolysis.info();
145 Info<< endl << decrIndent;
146 }
147 }
148 }
149}
150
151
153{
154 forAll(*this, i)
155 {
156 this->operator[](i).info();
157 }
158}
159
160
162{
163 scalar maxDiff = 0.0;
164 forAll(*this, i)
165 {
166 maxDiff = max(maxDiff, this->operator[](i).maxDiff());
167 }
168
169 return maxDiff;
170}
171
172
174{
175 scalar totalDiNum = GREAT;
176 forAll(*this, i)
177 {
178 totalDiNum = min(totalDiNum, this->operator[](i).solidRegionDiffNo());
179 }
180
181 return totalDiNum;
182}
183
184
185} // End namespace pyrolysisModels
186} // End namespace regionModels
187} // End namespace Foam
188
189// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
const pyrolysisModel * set(const label i) const
Definition: PtrList.H:138
void setSize(const label newLen)
Same as resize()
Definition: PtrList.H:151
const word & constant() const
Return constant name.
Definition: TimePathsI.H:96
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
const T & operator[](const label i) const
Return const reference to the element.
Definition: UPtrListI.H:234
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:460
wordList toc() const
Return the table of contents.
Definition: dictionary.C:602
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:290
bool changing() const noexcept
Is mesh changing (topology changing and/or moving)
Definition: polyMesh.H:562
virtual scalar solidRegionDiffNo() const
Mean diffusion number of the solid regions.
virtual void info()
Provide some feedback from pyrolysis regions.
virtual scalar maxDiff() const
Return max diffusivity allowed in the solid.
virtual void evolveRegion()
Evolve the pyrolysis equation regions.
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionModelI.H:34
virtual void preEvolveRegion()
Pre-evolve region.
Definition: regionModel.C:500
Switch infoOutput() const
Return the information flag.
Definition: regionModelI.H:52
const word & modelName() const
Return the model name.
Definition: regionModelI.H:58
virtual void info()
Provide some feedback.
Definition: regionModel.C:516
Switch active() const
Return the active flag.
Definition: regionModelI.H:46
virtual void evolveRegion()
Evolve the region.
Definition: regionModel.C:506
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:349
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:356
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333