regionFaModel.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) 2019-2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
28#include "regionFaModel.H"
29#include "faMesh.H"
30#include "Time.H"
31#include "mappedWallPolyPatch.H"
33
34// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35
36namespace Foam
37{
38namespace regionModels
39{
41}
42}
43
44const Foam::word
46
47// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
48
49void Foam::regionModels::regionFaModel::constructMeshObjects()
50{
51 regionMeshPtr_.reset
52 (
53 new faMesh(primaryMesh_)
54 );
55}
56
57
58void Foam::regionModels::regionFaModel::initialise()
59{
60 if (debug)
61 {
62 Pout<< "regionFaModel::initialise()" << endl;
63 }
64
65 vsmPtr_.reset(new volSurfaceMapping(regionMeshPtr_()));
66
67 if (!outputPropertiesPtr_)
68 {
69 const fileName uniformPath(word("uniform")/regionFaModelName);
70
71 outputPropertiesPtr_.reset
72 (
73 new IOdictionary
74 (
75 IOobject
76 (
77 regionName_ + "OutputProperties",
78 time_.timeName(),
79 uniformPath/regionName_,
80 primaryMesh_,
83 )
84 )
85 );
86 }
87}
88
89
91{
92 if (active_)
93 {
94 if (const dictionary* dictptr = dict.findDict(modelName_ + "Coeffs"))
95 {
96 coeffs_ <<= *dictptr;
97 }
98
99 infoOutput_.readIfPresent("infoOutput", dict);
100
101 return true;
102 }
103
104 return false;
105}
106
107
108// * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
109
111{
112 return vsmPtr_();
113}
114
115
116// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
117
119(
120 const fvPatch& patch,
121 const word& regionType,
122 const word& modelName,
123 const dictionary& dict,
124 bool readFields
125)
126:
128 (
130 (
131 IOobject::groupName(regionFaModelName, patch.name()),
132 patch.boundaryMesh().mesh().time().constant(),
133 patch.boundaryMesh().mesh().time(),
134 IOobject::NO_READ,
135 IOobject::NO_WRITE
136 )
137 ),
138 primaryMesh_(patch.boundaryMesh().mesh()),
139 patch_(patch),
140 time_(patch.boundaryMesh().mesh().time()),
141 active_(dict.get<Switch>("active")),
142 infoOutput_(false),
143 modelName_(modelName),
144 regionMeshPtr_(nullptr),
145 coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")),
146 outputPropertiesPtr_(nullptr),
147 vsmPtr_(nullptr),
148 patchID_(patch.index()),
149 regionName_(dict.lookup("region"))
150{
151 constructMeshObjects();
152 initialise();
153
154 if (readFields)
155 {
156 init(dict);
157 }
158}
159
160
161// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
162
164{
165 if (active_)
166 {
167 Info<< "\nEvolving " << modelName_ << " for region "
168 << regionMesh().name() << endl;
169
170 preEvolveRegion();
171
172 evolveRegion();
173
174 postEvolveRegion();
175
176 // Provide some feedback
177 if (infoOutput_)
178 {
180 info();
181 Info<< endl << decrIndent;
182 }
183 }
184}
185
186
188{}
189
190
192{}
193
194
196{}
197
198
200{
201 return 0;
202}
203
204// ************************************************************************* //
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:63
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
constant condensation/saturation model.
Lookup type of boundary radiation properties.
Definition: lookup.H:66
Base class for area region models.
virtual void postEvolveRegion()
Post-evolve region.
static const word regionFaModelName
Default name regionFaModel.
virtual scalar CourantNumber() const
Courant number of the region.
autoPtr< faMesh > regionMeshPtr_
Pointer to the region mesh database.
virtual void preEvolveRegion()
Pre-evolve region.
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
const fvMesh & primaryMesh_
Reference to the primary mesh database.
const volSurfaceMapping & vsm() const
Return mapping between surface and volume fields.
virtual void evolveRegion()
Evolve the region.
Volume to surface and surface to volume mapping.
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:349
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:356
dictionary dict