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();
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 // ************************************************************************* //
const T & operator[](const label i) const
Return const reference to the element at given position. FatalError for bounds problem or nullptr...
Definition: UPtrListI.H:289
virtual scalar solidRegionDiffNo() const
Mean diffusion number of the solid regions.
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
InfoProxy< IOstream > info() const noexcept
Return info proxy, used to print IOstream information to a stream.
Definition: IOstream.H:517
Ignore writing from objectRegistry::writeObject()
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
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:50
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
virtual void evolveRegion()
Evolve the pyrolysis equation regions.
points setSize(newPointi)
dynamicFvMesh & mesh
virtual scalar maxDiff() const
Return max diffusivity allowed in the solid.
static autoPtr< pyrolysisModel > New(const fvMesh &mesh, const word &regionType="pyrolysis")
Return a reference to the selected pyrolysis model.
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
virtual void info()
Provide some feedback from pyrolysis regions.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:511
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:502
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Namespace for OpenFOAM.