36 namespace regionModels
44 void Foam::regionModels::regionModel::constructMeshObjects()
47 if (!time_.foundObject<fvMesh>(regionName_))
66 void Foam::regionModels::regionModel::initialise()
70 Pout<<
"regionModel::initialise()" <<
endl;
73 label nBoundaryFaces = 0;
74 DynamicList<label> primaryPatchIDs;
75 DynamicList<label> intCoupledPatchIDs;
76 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
80 const polyPatch& regionPatch = rbm[
patchi];
81 if (isA<mappedPatchBase>(regionPatch))
85 Pout<<
"found " << mappedWallPolyPatch::typeName
86 <<
" " << regionPatch.
name() <<
endl;
89 intCoupledPatchIDs.append(
patchi);
91 nBoundaryFaces += regionPatch.faceCells().size();
93 const mappedPatchBase& mapPatch =
94 refCast<const mappedPatchBase>(regionPatch);
98 primaryMesh_.time().foundObject<polyMesh>
100 mapPatch.sampleRegion()
105 const label primaryPatchi = mapPatch.samplePolyPatch().index();
106 primaryPatchIDs.append(primaryPatchi);
111 primaryPatchIDs_.transfer(primaryPatchIDs);
112 intCoupledPatchIDs_.transfer(intCoupledPatchIDs);
117 <<
"Region model has no mapped boundary conditions - transfer " 118 <<
"between regions will not be possible" <<
endl;
121 if (!outputPropertiesPtr_.valid())
123 const fileName uniformPath(word(
"uniform")/
"regionModels");
125 outputPropertiesPtr_.reset
131 regionName_ +
"OutputProperties",
133 uniformPath/regionName_,
152 if (
const dictionary* dictPtr = subDictPtr(modelName_ +
"Coeffs"))
154 coeffs_ <<= *dictPtr;
157 infoOutput_.readIfPresent(
"infoOutput", *
this);
175 coeffs_ <<= *dictPtr;
178 infoOutput_.readIfPresent(
"infoOutput", dict);
193 const label regionPatchi,
194 const label nbrPatchi,
202 if (nbrRegionID != -1)
204 if (!interRegionAMI_[nbrRegionID].
set(regionPatchi))
206 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
212 interRegionAMI_[nbrRegionID].set
230 return interRegionAMI_[nbrRegionID][regionPatchi];
234 label nbrRegionID = interRegionAMINames_.size();
236 interRegionAMINames_.append(nbrRegion.
name());
238 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
241 label nPatch = regionMesh().boundaryMesh().
size();
244 interRegionAMI_.resize(nbrRegionID + 1);
255 interRegionAMI_[nbrRegionID].set
272 return interRegionAMI_[nbrRegionID][regionPatchi];
280 const label regionPatchi
283 label nbrPatchi = -1;
293 if (regionPatchi > pbm.
size() - 1)
296 <<
"region patch index out of bounds: " 297 <<
"region patch index = " << regionPatchi
298 <<
", maximum index = " << pbm.
size() - 1
304 if (!isA<mappedPatchBase>(pp))
307 <<
"Expected a " << mappedPatchBase::typeName
322 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
326 nbrPatchi = nbrRegionPatchi;
333 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
336 <<
"Unable to find patch pair for local patch " 337 << p.
name() <<
" and region " << nbrRegion.
name()
347 Foam::regionModels::regionModel::regionModel
350 const word& regionType
357 regionType +
"Properties",
369 regionMeshPtr_(
nullptr),
371 outputPropertiesPtr_(
nullptr),
373 intCoupledPatchIDs_(),
376 interRegionAMINames_(),
381 Foam::regionModels::regionModel::regionModel
384 const word& regionType,
385 const word& modelName,
393 regionType +
"Properties",
402 active_(
lookup(
"active")),
404 modelName_(modelName),
405 regionMeshPtr_(
nullptr),
406 coeffs_(subOrEmptyDict(modelName +
"Coeffs")),
407 outputPropertiesPtr_(
nullptr),
409 intCoupledPatchIDs_(),
410 regionName_(
lookup(
"regionName")),
411 functions_(*
this, subOrEmptyDict(
"functions"))
415 constructMeshObjects();
426 Foam::regionModels::regionModel::regionModel
429 const word& regionType,
430 const word& modelName,
439 regionType +
"Properties",
450 active_(dict.
lookup(
"active")),
452 modelName_(modelName),
453 regionMeshPtr_(
nullptr),
455 outputPropertiesPtr_(
nullptr),
457 intCoupledPatchIDs_(),
458 regionName_(dict.
lookup(
"regionName")),
459 functions_(*
this, subOrEmptyDict(
"functions"))
463 constructMeshObjects();
486 Info<<
"\nEvolving " << modelName_ <<
" for region " 487 << regionMesh().name() <<
endl;
505 if (time_.writeTime())
507 outputProperties().writeObject
511 time_.writeCompression(),
521 functions_.preEvolveRegion();
531 functions_.postEvolveRegion();
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const fileName & name() const
Return the name of the stream.
#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.
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.
virtual const AMIPatchToPatchInterpolation & interRegionAMI(const regionModel &nbrRegion, const label regionPatchi, const label nbrPatchi, const bool flip) const
Create or return a new inter-region AMI object.
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...
prefixOSstream Pout(cout, "Pout")
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...
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.