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  {
38  }
39  }
40 }
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace regionModels
47 {
48 namespace pyrolysisModels
49 {
50 
51 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 
54 :
56 {
57  IOdictionary pyrolysisZonesDict
58  (
59  IOobject
60  (
61  "pyrolysisZones",
62  mesh.time().constant(),
63  mesh,
66  )
67  );
68 
69  const wordList regions(pyrolysisZonesDict.toc());
70 
71  setSize(regions.size());
72 
73  for (label i = 0; i < regions.size(); i++)
74  {
75  set
76  (
77  i,
79  (
80  mesh,
81  pyrolysisZonesDict.subDict(regions[i]),
82  regions[i]
83  )
84  );
85  }
86 }
87 
88 
89 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
90 
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
97 
99 {
100  forAll(*this, i)
101  {
102  this->operator[](i).preEvolveRegion();
103  }
104 }
105 
106 
108 {
109  forAll(*this, i)
110  {
111  this->operator[](i).evolveRegion();
112  }
113 }
114 
115 
117 {
118  forAll(*this, i)
119  {
120  pyrolysisModel& pyrolysis = this->operator[](i);
121 
122  if (pyrolysis.active())
123  {
124  if (pyrolysis.primaryMesh().changing())
125  {
127  << "Currently not possible to apply "
128  << pyrolysis.modelName()
129  << " model to moving mesh cases" << nl<< abort(FatalError);
130  }
131 
132  // Pre-evolve
133  pyrolysis.preEvolveRegion();
134 
135  // Increment the region equations up to the new time level
136  pyrolysis.evolveRegion();
137 
138  // Provide some feedback
139  if (pyrolysis.infoOutput())
140  {
141  Info<< incrIndent;
142  pyrolysis.info();
143  Info<< endl << decrIndent;
144  }
145  }
146  }
147 }
148 
149 
151 {
152  forAll(*this, i)
153  {
154  this->operator[](i).info();
155  }
156 }
157 
158 
160 {
161  scalar maxDiff = 0.0;
162  forAll(*this, i)
163  {
164  maxDiff = max(maxDiff, this->operator[](i).maxDiff());
165  }
166 
167  return maxDiff;
168 }
169 
170 
172 {
173  scalar totalDiNum = GREAT;
174  forAll(*this, i)
175  {
176  totalDiNum = min(totalDiNum, this->operator[](i).solidRegionDiffNo());
177  }
178 
179  return totalDiNum;
180 }
181 
182 
183 } // End namespace pyrolysisModels
184 } // End namespace regionModels
185 } // End namespace Foam
186 
187 // ************************************************************************* //
Foam::regionModels::pyrolysisModels::pyrolysisModel
Base class for pyrolysis models.
Definition: pyrolysisModel.H:60
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::regionModels::regionModel::active
const Switch & active() const
Return the active flag.
Definition: regionModelI.H:43
Foam::polyMesh::changing
bool changing() const
Is mesh changing (topology changing and/or moving)
Definition: polyMesh.H:521
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::solidRegionDiffNo
virtual scalar solidRegionDiffNo() const
Mean diffusion number of the solid regions.
Definition: pyrolysisModelCollection.C:171
Foam::regionModels::regionModel::evolveRegion
virtual void evolveRegion()
Evolve the region.
Definition: regionModel.C:549
Foam::regionModels::regionModel::info
virtual void info()
Provide some feedback.
Definition: regionModel.C:561
Foam::IOobject::MUST_READ
@ MUST_READ
Definition: IOobject.H:108
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
pyrolysisModelCollection.H
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::evolve
virtual void evolve()
Evolve regions.
Definition: pyrolysisModelCollection.C:116
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::~pyrolysisModelCollection
virtual ~pyrolysisModelCollection()
Destructor.
Definition: pyrolysisModelCollection.C:91
Foam::incrIndent
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:228
Foam::regionModels::regionModel::modelName
const word & modelName() const
Return the model name.
Definition: regionModelI.H:55
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::preEvolveRegion
virtual void preEvolveRegion()
Pre-evolve regions.
Definition: pyrolysisModelCollection.C:98
Foam::regionModels::regionModel::primaryMesh
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionModelI.H:31
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::pyrolysisModelCollection
pyrolysisModelCollection(const pyrolysisModelCollection &)
Disallow default bitwise copy construct.
Foam::regionModels::pyrolysisModels::defineTypeNameAndDebug
defineTypeNameAndDebug(noPyrolysis, 0)
Foam::PtrList< pyrolysisModel >::set
bool set(const label) const
Is element set.
Foam::label
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
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::regionModels::regionModel::preEvolveRegion
virtual void preEvolveRegion()
Pre-evolve region.
Definition: regionModel.C:543
Foam::regionModels::pyrolysisModels::pyrolysisModel::New
static autoPtr< pyrolysisModel > New(const fvMesh &mesh, const word &regionType="pyrolysis")
Return a reference to the selected pyrolysis model.
Definition: pyrolysisModelNew.C:42
Foam::PtrList< pyrolysisModel >::operator[]
const T & operator[](const label) const
Return element const reference.
Foam::PtrList
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
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::maxDiff
virtual scalar maxDiff() const
Return max diffusivity allowed in the solid.
Definition: pyrolysisModelCollection.C:159
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::decrIndent
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:235
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
pyrolysisModelCollection
A centralized pyrolysis collection.
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::info
virtual void info()
Provide some feedback from pyrolysis regions.
Definition: pyrolysisModelCollection.C:150
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::PtrList< pyrolysisModel >::setSize
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:142
Foam::dictionary::toc
wordList toc() const
Return the table of contents.
Definition: dictionary.C:697
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::regionModels::regionModel::infoOutput
const Switch & infoOutput() const
Return the information flag.
Definition: regionModelI.H:49
Foam::dictionary::subDict
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:631
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::evolveRegion
virtual void evolveRegion()
Evolve the pyrolysis equation regions.
Definition: pyrolysisModelCollection.C:107
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)