Loading...
Searching...
No Matches
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 * * * * * * * * * * * * * //
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
55pyrolysisModelCollection::pyrolysisModelCollection(const fvMesh& mesh)
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();
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 =
167 Foam::max(maxDiff, this->operator[](i).maxDiff());
168 }
169
170 return maxDiff;
171}
172
173
175{
176 scalar totalDiNum = GREAT;
177 forAll(*this, i)
178 {
179 totalDiNum =
180 Foam::min(totalDiNum, this->operator[](i).solidRegionDiffNo());
181 }
182
183 return totalDiNum;
184}
185
186
187} // End namespace pyrolysisModels
188} // End namespace regionModels
189} // End namespace Foam
190
191// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const pyrolysisModel * set(const label i) const
Definition PtrList.H:171
void setSize(const label n)
Definition PtrList.H:357
constexpr PtrList() noexcept
Definition PtrListI.H:29
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
const pyrolysisModel & operator[](const label i) const
Definition UPtrListI.H:289
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition dictionary.C:441
wordList toc() const
Return the table of contents.
Definition dictionary.C:587
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
bool changing() const noexcept
Is mesh changing (topology changing and/or moving).
Definition polyMesh.H:768
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.
static autoPtr< pyrolysisModel > New(const fvMesh &mesh, const word &regionType="pyrolysis")
Return a reference to the selected pyrolysis model.
Switch active() const noexcept
Return the active flag.
Switch infoOutput() const noexcept
Return the information flag.
virtual void preEvolveRegion()
Pre-evolve region.
virtual void info()
Provide some feedback.
const fvMesh & primaryMesh() const noexcept
Return the reference to the primary mesh database.
const word & modelName() const noexcept
Return the model name.
virtual void evolveRegion()
Evolve the region.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition Ostream.H:490
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:26
errorManip< error > abort(error &err)
Definition errorManip.H:139
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition Ostream.H:499
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
points setSize(newPointi)
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299