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 -------------------------------------------------------------------------------
10 License
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 
33 namespace Foam
34 {
35  namespace regionModels
36  {
37  namespace pyrolysisModels
38  {
39  defineTypeNameAndDebug(pyrolysisModelCollection, 0);
40  }
41  }
42 }
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 namespace regionModels
49 {
50 namespace pyrolysisModels
51 {
52 
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 
55 pyrolysisModelCollection::pyrolysisModelCollection(const fvMesh& mesh)
56 :
58 {
59  IOdictionary pyrolysisZonesDict
60  (
61  IOobject
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  {
143  Info<< incrIndent;
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 // ************************************************************************* //
Foam::regionModels::pyrolysisModels::pyrolysisModel
Base class for pyrolysis models.
Definition: pyrolysisModel.H:61
Foam::IOobject::NO_WRITE
Definition: IOobject.H:195
volFields.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:54
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::regionModels::regionModel::active
Switch active() const
Return the active flag.
Definition: regionModelI.H:46
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::solidRegionDiffNo
virtual scalar solidRegionDiffNo() const
Mean diffusion number of the solid regions.
Definition: pyrolysisModelCollection.C:173
Foam::regionModels::regionModel::evolveRegion
virtual void evolveRegion()
Evolve the region.
Definition: regionModel.C:506
Foam::regionModels::regionModel::info
virtual void info()
Provide some feedback.
Definition: regionModel.C:516
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::PtrList< pyrolysisModel >::set
const pyrolysisModel * set(const label i) const
Return const pointer to element (can be nullptr),.
Definition: PtrList.H:138
pyrolysisModelCollection.H
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::evolve
virtual void evolve()
Evolve regions.
Definition: pyrolysisModelCollection.C:118
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::~pyrolysisModelCollection
virtual ~pyrolysisModelCollection()
Destructor.
Definition: pyrolysisModelCollection.C:93
Foam::incrIndent
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:346
Foam::regionModels::regionModel::modelName
const word & modelName() const
Return the model name.
Definition: regionModelI.H:58
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::preEvolveRegion
virtual void preEvolveRegion()
Pre-evolve regions.
Definition: pyrolysisModelCollection.C:100
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::regionModels::regionModel::primaryMesh
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionModelI.H:34
Foam::regionModels::pyrolysisModels::defineTypeNameAndDebug
defineTypeNameAndDebug(noPyrolysis, 0)
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::dictionary::subDict
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:460
Foam::PtrList< pyrolysisModel >::setSize
void setSize(const label newLen)
Same as resize()
Definition: PtrList.H:151
Foam::regionModels::regionModel::preEvolveRegion
virtual void preEvolveRegion()
Pre-evolve region.
Definition: regionModel.C:500
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:45
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::maxDiff
virtual scalar maxDiff() const
Return max diffusivity allowed in the solid.
Definition: pyrolysisModelCollection.C:161
Foam::FatalError
error FatalError
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::decrIndent
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:353
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::regionModels::regionModel::infoOutput
Switch infoOutput() const
Return the information flag.
Definition: regionModelI.H:52
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::info
virtual void info()
Provide some feedback from pyrolysis regions.
Definition: pyrolysisModelCollection.C:152
Foam::polyMesh::changing
bool changing() const noexcept
Is mesh changing (topology changing and/or moving)
Definition: polyMesh.H:550
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::List< word >
Foam::dictionary::toc
wordList toc() const
Return the table of contents.
Definition: dictionary.C:602
Foam::regionModels::pyrolysisModels::pyrolysisModelCollection::evolveRegion
virtual void evolveRegion()
Evolve the pyrolysis equation regions.
Definition: pyrolysisModelCollection.C:109
Foam::IOobject::MUST_READ
Definition: IOobject.H:185