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);
178 const label regionPatchi,
179 const label nbrPatchi,
187 if (nbrRegionID != -1)
189 if (!interRegionAMI_[nbrRegionID].
set(regionPatchi))
191 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
197 interRegionAMI_[nbrRegionID].set
215 return interRegionAMI_[nbrRegionID][regionPatchi];
219 label nbrRegionID = interRegionAMINames_.size();
221 interRegionAMINames_.append(nbrRegion.
name());
223 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
226 label nPatch = regionMesh().boundaryMesh().
size();
229 interRegionAMI_.resize(nbrRegionID + 1);
240 interRegionAMI_[nbrRegionID].set
257 return interRegionAMI_[nbrRegionID][regionPatchi];
265 const label regionPatchi
268 label nbrPatchi = -1;
278 if (regionPatchi > pbm.
size() - 1)
281 <<
"region patch index out of bounds: " 282 <<
"region patch index = " << regionPatchi
283 <<
", maximum index = " << pbm.
size() - 1
289 if (!isA<mappedPatchBase>(pp))
292 <<
"Expected a " << mappedPatchBase::typeName
307 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
311 nbrPatchi = nbrRegionPatchi;
318 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
321 <<
"Unable to find patch pair for local patch " 322 << p.
name() <<
" and region " << nbrRegion.
name()
332 Foam::regionModels::regionModel::regionModel
335 const word& regionType
342 regionType +
"Properties",
353 regionMeshPtr_(
nullptr),
355 outputPropertiesPtr_(
nullptr),
357 intCoupledPatchIDs_(),
360 interRegionAMINames_(),
365 Foam::regionModels::regionModel::regionModel
368 const word& regionType,
369 const word& modelName,
377 regionType +
"Properties",
387 modelName_(modelName),
388 regionMeshPtr_(
nullptr),
389 coeffs_(optionalSubDict(modelName +
"Coeffs")),
390 outputPropertiesPtr_(
nullptr),
392 intCoupledPatchIDs_(),
393 regionName_(
lookup(
"regionName")),
394 functions_(*
this, subOrEmptyDict(
"functions"))
396 constructMeshObjects();
406 Foam::regionModels::regionModel::regionModel
409 const word& regionType,
410 const word& modelName,
419 regionType +
"Properties",
431 modelName_(modelName),
432 regionMeshPtr_(
nullptr),
434 outputPropertiesPtr_(
nullptr),
436 intCoupledPatchIDs_(),
437 regionName_(dict.
lookup(
"regionName")),
438 functions_(*
this, subOrEmptyDict(
"functions"))
440 constructMeshObjects();
460 Info<<
"\nEvolving " << modelName_ <<
" for region " 461 << regionMesh().name() <<
endl;
477 if (time_.writeTime())
479 outputProperties().writeObject
483 time_.writeCompression(),
492 functions_.preEvolveRegion();
502 functions_.postEvolveRegion();
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t 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.
static int & msgType()
Message tag of standard messages.
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 findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
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.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Mesh data needed to do the Finite Volume discretisation.
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
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...
virtual const AMIInterpolation & interRegionAMI(const regionModel &nbrRegion, const label regionPatchi, const label nbrPatchi, const bool flip) const
Create or return a new inter-region AMI object.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.