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_,
147 if (
const dictionary* dictPtr = subDictPtr(modelName_ +
"Coeffs"))
149 coeffs_ <<= *dictPtr;
152 infoOutput_.readIfPresent(
"infoOutput", *
this);
170 coeffs_ <<= *dictPtr;
173 infoOutput_.readIfPresent(
"infoOutput", dict);
188 const label regionPatchi,
189 const label nbrPatchi,
197 if (nbrRegionID != -1)
199 if (!interRegionAMI_[nbrRegionID].
set(regionPatchi))
201 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
207 interRegionAMI_[nbrRegionID].set
225 return interRegionAMI_[nbrRegionID][regionPatchi];
229 label nbrRegionID = interRegionAMINames_.size();
231 interRegionAMINames_.append(nbrRegion.
name());
233 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
236 label nPatch = regionMesh().boundaryMesh().
size();
239 interRegionAMI_.resize(nbrRegionID + 1);
250 interRegionAMI_[nbrRegionID].set
267 return interRegionAMI_[nbrRegionID][regionPatchi];
275 const label regionPatchi
278 label nbrPatchi = -1;
288 if (regionPatchi > pbm.
size() - 1)
291 <<
"region patch index out of bounds: " 292 <<
"region patch index = " << regionPatchi
293 <<
", maximum index = " << pbm.
size() - 1
299 if (!isA<mappedPatchBase>(pp))
302 <<
"Expected a " << mappedPatchBase::typeName
317 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
321 nbrPatchi = nbrRegionPatchi;
328 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
331 <<
"Unable to find patch pair for local patch " 332 << p.
name() <<
" and region " << nbrRegion.
name()
342 Foam::regionModels::regionModel::regionModel
345 const word& regionType
352 regionType +
"Properties",
364 regionMeshPtr_(
nullptr),
366 outputPropertiesPtr_(
nullptr),
368 intCoupledPatchIDs_(),
371 interRegionAMINames_(),
376 Foam::regionModels::regionModel::regionModel
379 const word& regionType,
380 const word& modelName,
388 regionType +
"Properties",
397 active_(
lookup(
"active")),
399 modelName_(modelName),
400 regionMeshPtr_(
nullptr),
401 coeffs_(subOrEmptyDict(modelName +
"Coeffs")),
402 outputPropertiesPtr_(
nullptr),
404 intCoupledPatchIDs_(),
405 regionName_(
lookup(
"regionName")),
406 functions_(*
this, subOrEmptyDict(
"functions"))
410 constructMeshObjects();
421 Foam::regionModels::regionModel::regionModel
424 const word& regionType,
425 const word& modelName,
434 regionType +
"Properties",
445 active_(dict.
lookup(
"active")),
447 modelName_(modelName),
448 regionMeshPtr_(
nullptr),
450 outputPropertiesPtr_(
nullptr),
452 intCoupledPatchIDs_(),
453 regionName_(dict.
lookup(
"regionName")),
454 functions_(*
this, subOrEmptyDict(
"functions"))
458 constructMeshObjects();
481 Info<<
"\nEvolving " << modelName_ <<
" for region " 482 << regionMesh().name() <<
endl;
500 if (time_.writeTime())
502 outputProperties().writeObject
506 time_.writeCompression(),
516 functions_.preEvolveRegion();
526 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.
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.
static const dictionary null
Null dictionary.
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
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.
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 ...
const word & name() const
Name function is needed to disambiguate those inherited.
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.
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.