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 -------------------------------------------------------------------------------
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 
28 #include "regionFaModel.H"
29 #include "faMesh.H"
30 #include "Time.H"
31 #include "mappedWallPolyPatch.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace regionModels
39 {
40  defineTypeNameAndDebug(regionFaModel, 0);
41 }
42 }
43 
44 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
45 
46 void Foam::regionModels::regionFaModel::constructMeshObjects()
47 {
48  regionMeshPtr_.reset
49  (
50  new faMesh(primaryMesh_)
51  );
52 }
53 
54 
55 void Foam::regionModels::regionFaModel::initialise()
56 {
57  if (debug)
58  {
59  Pout<< "regionFaModel::initialise()" << endl;
60  }
61 
62  vsmPtr_.reset(new volSurfaceMapping(regionMeshPtr_()));
63 }
64 
65 
66 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
67 
69 {
70  if (active_)
71  {
72  if (const dictionary* dictptr = dict.findDict(modelName_ + "Coeffs"))
73  {
74  coeffs_ <<= *dictptr;
75  }
76 
77  infoOutput_.readIfPresent("infoOutput", dict);
78 
79  return true;
80  }
81 
82  return false;
83 }
84 
85 
86 // * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
87 
89 {
90  return vsmPtr_();
91 }
92 
93 
94 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
95 
97 (
98  const fvPatch& patch,
99  const word& regionType,
100  const word& modelName,
101  const dictionary& dict,
102  bool readFields
103 )
104 :
105  primaryMesh_(patch.boundaryMesh().mesh()),
106  patch_(patch),
107  time_(patch.boundaryMesh().mesh().time()),
108  active_(dict.get<Switch>("active")),
109  infoOutput_(false),
110  modelName_(modelName),
111  regionMeshPtr_(nullptr),
112  coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")),
113  vsmPtr_(nullptr),
114  patchID_(patch.index()),
115  regionName_(dict.lookup("region"))
116 {
117  if (active_)
118  {
119  constructMeshObjects();
120  initialise();
121 
122  if (readFields)
123  {
124  read(dict);
125  }
126  }
127 }
128 
129 
130 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
131 
133 {
134  if (active_)
135  {
136  Info<< "\nEvolving " << modelName_ << " for region "
137  << regionMesh().name() << endl;
138 
139  preEvolveRegion();
140 
141  evolveRegion();
142 
143  postEvolveRegion();
144 
145  // Provide some feedback
146  if (infoOutput_)
147  {
148  Info<< incrIndent;
149  info();
150  Info<< endl << decrIndent;
151  }
152  }
153 }
154 
155 
157 {}
158 
159 
161 {}
162 
163 
165 {}
166 
167 
169 {}
170 
171 
172 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
mappedWallPolyPatch.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::regionModels::defineTypeNameAndDebug
defineTypeNameAndDebug(KirchhoffShell, 0)
Foam::regionModels::regionFaModel::regionMeshPtr_
autoPtr< faMesh > regionMeshPtr_
Pointer to the region mesh database.
Definition: regionFaModel.H:147
Foam::read
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:108
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
faMesh.H
Foam::regionModels::regionFaModel::regionFaModel
regionFaModel(const fvPatch &patch, const word &regionType, const word &modelName, const dictionary &dict, bool readFields=true)
Construct from mesh and name and dict.
Definition: regionFaModel.C:97
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::regionModels::regionFaModel::vsm
const volSurfaceMapping & vsm() const
Return volSurfaceMapping.
Definition: regionFaModel.C:88
Foam::incrIndent
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:327
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::regionModels::regionFaModel::postEvolveRegion
virtual void postEvolveRegion()
Post-evolve region.
Definition: regionFaModel.C:164
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::decrIndent
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:334
Foam::regionModels::regionFaModel::preEvolveRegion
virtual void preEvolveRegion()
Pre-evolve region.
Definition: regionFaModel.C:156
Foam::readFields
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
Definition: ReadFieldsTemplates.C:312
Foam::regionModels::regionFaModel::evolveRegion
virtual void evolveRegion()
Evolve the region.
Definition: regionFaModel.C:160
Time.H
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::volSurfaceMapping
Volume to surface and surface to volume mapping.
Definition: volSurfaceMapping.H:56
Foam::regionModels::regionFaModel::read
virtual bool read(const dictionary &dict)
Read control parameters from dictionary.
Definition: regionFaModel.C:68
Foam::regionModels::regionFaModel::info
virtual void info()
Provide some feedback.
Definition: regionFaModel.C:168
regionFaModel.H
Foam::regionModels::regionFaModel::evolve
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
Definition: regionFaModel.C:132
Foam::regionModels::regionFaModel::primaryMesh_
const fvMesh & primaryMesh_
Reference to the primary mesh database.
Definition: regionFaModel.H:129
zeroGradientFvPatchFields.H