36 namespace regionModels
44 void Foam::regionModels::regionModel::constructMeshObjects()
47 if (!time_.foundObject<fvMesh>(regionName_))
66 void Foam::regionModels::regionModel::initialise()
70 label nBoundaryFaces = 0;
71 DynamicList<label> primaryPatchIDs;
72 DynamicList<label> intCoupledPatchIDs;
73 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
77 const polyPatch& regionPatch = rbm[
patchi];
78 if (isA<mappedPatchBase>(regionPatch))
81 <<
"found " << mappedWallPolyPatch::typeName
82 <<
" " << regionPatch.name() <<
endl;
84 intCoupledPatchIDs.append(
patchi);
86 nBoundaryFaces += regionPatch.faceCells().size();
88 const mappedPatchBase& mapPatch =
89 refCast<const mappedPatchBase>(regionPatch);
93 primaryMesh_.time().foundObject<polyMesh>
95 mapPatch.sampleRegion()
100 const label primaryPatchi = mapPatch.samplePolyPatch().index();
101 primaryPatchIDs.append(primaryPatchi);
106 primaryPatchIDs_.transfer(primaryPatchIDs);
107 intCoupledPatchIDs_.transfer(intCoupledPatchIDs);
112 <<
"Region model has no mapped boundary conditions - transfer " 113 <<
"between regions will not be possible" <<
endl;
116 if (!outputPropertiesPtr_.valid())
118 const fileName uniformPath(word(
"uniform")/
"regionModels");
120 outputPropertiesPtr_.reset
126 regionName_ +
"OutputProperties",
128 uniformPath/regionName_,
145 if (
const dictionary* dictPtr = subDictPtr(modelName_ +
"Coeffs"))
147 coeffs_ <<= *dictPtr;
150 infoOutput_.readIfPresent(
"infoOutput", *
this);
165 coeffs_ <<= *dictPtr;
168 infoOutput_.readIfPresent(
"infoOutput", dict);
177 const label regionPatchi
180 label nbrPatchi = -1;
190 if (regionPatchi > pbm.
size() - 1)
193 <<
"region patch index out of bounds: " 194 <<
"region patch index = " << regionPatchi
195 <<
", maximum index = " << pbm.
size() - 1
201 if (!isA<mappedPatchBase>(pp))
204 <<
"Expected a " << mappedPatchBase::typeName
219 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
223 nbrPatchi = nbrRegionPatchi;
230 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
233 <<
"Unable to find patch pair for local patch " 234 << p.
name() <<
" and region " << nbrRegion.
name()
244 Foam::regionModels::regionModel::regionModel
247 const word& regionType
254 regionType +
"Properties",
265 regionMeshPtr_(
nullptr),
267 outputPropertiesPtr_(
nullptr),
269 intCoupledPatchIDs_(),
275 Foam::regionModels::regionModel::regionModel
278 const word& regionType,
279 const word& modelName,
287 regionType +
"Properties",
297 modelName_(modelName),
298 regionMeshPtr_(
nullptr),
299 coeffs_(optionalSubDict(modelName +
"Coeffs")),
300 outputPropertiesPtr_(
nullptr),
302 intCoupledPatchIDs_(),
303 regionName_(
lookup(
"regionName")),
304 functions_(*
this, subOrEmptyDict(
"functions"))
306 constructMeshObjects();
316 Foam::regionModels::regionModel::regionModel
319 const word& regionType,
320 const word& modelName,
329 regionType +
"Properties",
341 modelName_(modelName),
342 regionMeshPtr_(
nullptr),
344 outputPropertiesPtr_(
nullptr),
346 intCoupledPatchIDs_(),
347 regionName_(dict.
lookup(
"regionName")),
348 functions_(*
this, subOrEmptyDict(
"functions"))
350 constructMeshObjects();
370 Info<<
"\nEvolving " << modelName_ <<
" for region " 371 << regionMesh().name() <<
endl;
387 if (time_.writeTime())
389 outputProperties().writeObject
393 time_.writeCompression(),
402 functions_.preEvolveRegion();
412 functions_.postEvolveRegion();
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
const word & name() const
Return name.
virtual void evolveRegion()
Evolve the region.
virtual void info()
Provide some feedback.
virtual bool read()
Read object.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Time & time() const
Return the top-level database.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
defineTypeNameAndDebug(regionModel, 0)
bool read(const char *, int32_t &)
stressControl lookup("compactNormalStress") >> compactNormalStress
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
virtual void preEvolveRegion()
Pre-evolve region.
A class for handling words, derived from string.
virtual bool read()
Read control parameters from dictionary.
label nbrCoupledPatchID(const regionModel &nbrRegion, const label regionPatchi) const
Return the coupled patch ID paired with coupled patch.
virtual void postEvolveRegion()
Post-evolve region.
#define DebugInFunction
Report an information message using Foam::Info.
const word & constant() const
Return constant name.
static const dictionary null
Null dictionary.
const fvMesh & regionMesh() const
Return the region mesh database.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
errorManip< error > abort(error &err)
const dictionary * subDictPtr(const word &) const
Find and return a sub-dictionary pointer if present.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
virtual ~regionModel()
Destructor.
label size() const
Return the number of elements in the UPtrList.
#define WarningInFunction
Report a warning using Foam::Warning.
static const versionNumber currentVersion
Current version number.
Mesh data needed to do the Finite Volume discretisation.
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE)
Base class for region models.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const labelList & intCoupledPatchIDs() const
Return the list of patch IDs internally coupled with the.
A patch is a list of labels that address the faces in the global face list.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.