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 | Copyright (C) 2011-2015 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 "volFields.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  namespace regionModels
34  {
35  namespace pyrolysisModels
36  {
37  defineTypeNameAndDebug(pyrolysisModelCollection, 0);
38  }
39  }
40 }
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace regionModels
47 {
48 namespace pyrolysisModels
49 {
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
53 pyrolysisModelCollection::pyrolysisModelCollection(const fvMesh& mesh)
54 :
56 
57 {
58  IOdictionary pyrolysisZonesDict
59  (
60  IOobject
61  (
62  "pyrolysisZones",
63  mesh.time().constant(),
64  mesh,
67  )
68  );
69 
70  const wordList regions(pyrolysisZonesDict.toc());
71 
72  setSize(regions.size());
73 
74  for (label i = 0; i < regions.size(); i++)
75  {
76  set
77  (
78  i,
80  (
81  mesh,
82  pyrolysisZonesDict.subDict(regions[i]),
83  regions[i]
84  )
85  );
86  }
87 }
88 
89 
90 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
98 
100 {
101  forAll(*this, i)
102  {
103  this->operator[](i).preEvolveRegion();
104  }
105 }
106 
107 
109 {
110  forAll(*this, i)
111  {
112  this->operator[](i).evolveRegion();
113  }
114 }
115 
116 
118 {
119  forAll(*this, i)
120  {
121  pyrolysisModel& pyrolysis = this->operator[](i);
122 
123  if (pyrolysis.active())
124  {
125  if (pyrolysis.primaryMesh().changing())
126  {
127  FatalErrorIn("pyrolysisModelCollection::evolve()")
128  << "Currently not possible to apply "
129  << pyrolysis.modelName()
130  << " model to moving mesh cases" << nl<< abort(FatalError);
131  }
132 
133  // Pre-evolve
134  pyrolysis.preEvolveRegion();
135 
136  // Increment the region equations up to the new time level
137  pyrolysis.evolveRegion();
138 
139  // Provide some feedback
140  if (pyrolysis.infoOutput())
141  {
142  Info<< incrIndent;
143  pyrolysis.info();
144  Info<< endl << decrIndent;
145  }
146  }
147  }
148 }
149 
150 
152 {
153  forAll(*this, i)
154  {
155  this->operator[](i).info();
156  }
157 }
158 
159 
161 {
162  scalar maxDiff = 0.0;
163  forAll(*this, i)
164  {
165  if (maxDiff < this->operator[](i).maxDiff())
166  {
167  maxDiff = this->operator[](i).maxDiff();
168  }
169 
170  }
171  return maxDiff;
172 }
173 
174 
176 {
177  scalar totalDiNum = GREAT;
178 
179  forAll(*this, i)
180  {
181  if
182  (
183  totalDiNum > this->operator[](i).solidRegionDiffNo()
184  )
185  {
186  totalDiNum = this->operator[](i).solidRegionDiffNo();
187  }
188  }
189 
190  return totalDiNum;
191 }
192 
193 
194 } // End namespace pyrolysisModels
195 } // End namespace regionModels
196 } // End namespace Foam
197 
198 // ************************************************************************* //
virtual void info()
Provide some feedback from pyrolysis regions.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
bool changing() const
Is mesh changing (topology changing and/or moving)
Definition: polyMesh.H:521
const Switch & infoOutput() const
Return the information flag.
Definition: regionModelI.H:49
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
messageStream Info
dynamicFvMesh & mesh
virtual void preEvolveRegion()
Pre-evolve region.
Definition: regionModel.C:564
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:638
const word & constant() const
Return constant name.
Definition: TimePaths.H:124
Namespace for OpenFOAM.
virtual void evolveRegion()
Evolve the region.
Definition: regionModel.C:570
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:228
static const char nl
Definition: Ostream.H:260
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:235
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
wordList toc() const
Return the table of contents.
Definition: dictionary.C:707
virtual scalar solidRegionDiffNo() const
Mean diffusion number of the solid regions.
#define forAll(list, i)
Definition: UList.H:421
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
errorManip< error > abort(error &err)
Definition: errorManip.H:131
virtual void evolveRegion()
Evolve the pyrolysis equation regions.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
virtual void info()
Provide some feedback.
Definition: regionModel.C:582
const Switch & active() const
Return the active flag.
Definition: regionModelI.H:43
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionModelI.H:31
error FatalError
const word & modelName() const
Return the model name.
Definition: regionModelI.H:55
virtual scalar maxDiff() const
Return max diffusivity allowed in the solid.
const pyrolysisModel & operator[](const label) const
Return element const reference.
static autoPtr< pyrolysisModel > New(const fvMesh &mesh, const word &regionType="pyrolysis")
Return a reference to the selected pyrolysis model.