ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / regionModels / pyrolysisModels / pyrolysisModel / pyrolysisModelCollection.C
blob4bc3ca977e8fa08ec1f1ed0af079f93058c746dd
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "pyrolysisModelCollection.H"
27 #include "volFields.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 defineTemplateTypeNameAndDebug
33     Foam::IOPtrList<Foam::regionModels::pyrolysisModels::pyrolysisModel>,
34     0
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 namespace Foam
41 namespace regionModels
43 namespace pyrolysisModels
46 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
48 pyrolysisModelCollection::pyrolysisModelCollection
50     const fvMesh& mesh
53     IOPtrList<pyrolysisModel>
54     (
55         IOobject
56         (
57             "pyrolysisZones",
58             mesh.time().constant(),
59             mesh,
60             IOobject::MUST_READ,
61             IOobject::NO_WRITE
62         ),
63         pyrolysisModel::iNew(mesh)
64     ),
65     mesh_(mesh)
69 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
72 void pyrolysisModelCollection::preEvolveRegion()
74     forAll(*this, i)
75     {
76         this->operator[](i).preEvolveRegion();
77     }
81 void pyrolysisModelCollection::evolveRegion()
83     forAll(*this, i)
84     {
85         this->operator[](i).evolveRegion();
86     }
90 void pyrolysisModelCollection::evolve()
92     forAll(*this, i)
93     {
94         pyrolysisModel& pyrolysis = this->operator[](i);
96         if (pyrolysis.active())
97         {
98             if (pyrolysis.primaryMesh().changing())
99             {
100                 FatalErrorIn("pyrolysisModelCollection::evolve()")
101                     << "Currently not possible to apply "
102                     << pyrolysis.modelName()
103                     << " model to moving mesh cases" << nl<< abort(FatalError);
104             }
106             // Pre-evolve
107             pyrolysis.preEvolveRegion();
109             // Increment the region equations up to the new time level
110             pyrolysis.evolveRegion();
112             // Provide some feedback
113             if (pyrolysis.infoOutput())
114             {
115                 Info<< incrIndent;
116                 pyrolysis.info();
117                 Info<< endl << decrIndent;
118             }
119         }
120     }
124 void pyrolysisModelCollection::info() const
126     forAll(*this, i)
127     {
128         this->operator[](i).info();
129     }
133 scalar pyrolysisModelCollection::maxDiff() const
135     scalar maxDiff = 0.0;
136     forAll(*this, i)
137     {
138         if (maxDiff < this->operator[](i).maxDiff())
139         {
140             maxDiff = this->operator[](i).maxDiff();
141         }
143     }
144     return maxDiff;
148 scalar pyrolysisModelCollection::solidRegionDiffNo() const
150     scalar totalDiNum = GREAT;
152     forAll(*this, i)
153     {
154         if
155         (
156             totalDiNum > this->operator[](i).solidRegionDiffNo()
157         )
158         {
159             totalDiNum = this->operator[](i).solidRegionDiffNo();
160         }
161     }
163     return totalDiNum;
167 } // End namespace pyrolysisModels
168 } // End namespace regionModels
169 } // End namespace Foam
171 // ************************************************************************* //