36 namespace regionModels
44 void Foam::regionModels::regionModel::constructMeshObjects()
47 if (!time_.foundObject<fvMesh>(regionName_))
66 void Foam::regionModels::regionModel::constructMeshObjects
68 const dictionary& dict
72 if (!time_.foundObject<fvMesh>(regionName_))
91 void Foam::regionModels::regionModel::initialise()
95 Pout<<
"regionModel::initialise()" <<
endl;
98 label nBoundaryFaces = 0;
99 DynamicList<label> primaryPatchIDs;
100 DynamicList<label> intCoupledPatchIDs;
101 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
105 const polyPatch& regionPatch = rbm[
patchi];
106 if (isA<mappedPatchBase>(regionPatch))
110 Pout<<
"found " << mappedWallPolyPatch::typeName
111 <<
" " << regionPatch.
name() <<
endl;
114 intCoupledPatchIDs.append(
patchi);
116 nBoundaryFaces += regionPatch.faceCells().size();
118 const mappedPatchBase& mapPatch =
119 refCast<const mappedPatchBase>(regionPatch);
123 primaryMesh_.time().foundObject<polyMesh>
125 mapPatch.sampleRegion()
130 const label primaryPatchi = mapPatch.samplePolyPatch().index();
131 primaryPatchIDs.append(primaryPatchi);
136 primaryPatchIDs_.transfer(primaryPatchIDs);
137 intCoupledPatchIDs_.transfer(intCoupledPatchIDs);
142 <<
"Region model has no mapped boundary conditions - transfer " 143 <<
"between regions will not be possible" <<
endl;
146 if (!outputPropertiesPtr_.valid())
148 const fileName uniformPath(word(
"uniform")/
"regionModels");
150 outputPropertiesPtr_.reset
156 regionName_ +
"OutputProperties",
158 uniformPath/regionName_,
177 if (
const dictionary* dictPtr = subDictPtr(modelName_ +
"Coeffs"))
179 coeffs_ <<= *dictPtr;
182 infoOutput_.readIfPresent(
"infoOutput", *
this);
200 coeffs_ <<= *dictPtr;
203 infoOutput_.readIfPresent(
"infoOutput", dict);
218 const label regionPatchi,
219 const label nbrPatchi,
227 if (nbrRegionID != -1)
229 if (!interRegionAMI_[nbrRegionID].
set(regionPatchi))
231 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
237 interRegionAMI_[nbrRegionID].set
255 return interRegionAMI_[nbrRegionID][regionPatchi];
259 label nbrRegionID = interRegionAMINames_.size();
261 interRegionAMINames_.append(nbrRegion.
name());
263 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
266 label nPatch = regionMesh().boundaryMesh().
size();
269 interRegionAMI_.resize(nbrRegionID + 1);
280 interRegionAMI_[nbrRegionID].set
297 return interRegionAMI_[nbrRegionID][regionPatchi];
305 const label regionPatchi
308 label nbrPatchi = -1;
318 if (regionPatchi > pbm.
size() - 1)
321 <<
"region patch index out of bounds: " 322 <<
"region patch index = " << regionPatchi
323 <<
", maximum index = " << pbm.
size() - 1
329 if (!isA<mappedPatchBase>(pp))
332 <<
"Expected a " << mappedPatchBase::typeName
347 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
351 nbrPatchi = nbrRegionPatchi;
358 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
361 <<
"Unable to find patch pair for local patch " 362 << p.
name() <<
" and region " << nbrRegion.
name()
372 Foam::regionModels::regionModel::regionModel
375 const word& regionType
382 regionType +
"Properties",
394 regionMeshPtr_(NULL),
396 outputPropertiesPtr_(NULL),
398 intCoupledPatchIDs_(),
401 interRegionAMINames_(),
406 Foam::regionModels::regionModel::regionModel
409 const word& regionType,
410 const word& modelName,
418 regionType +
"Properties",
427 active_(
lookup(
"active")),
429 modelName_(modelName),
430 regionMeshPtr_(NULL),
431 coeffs_(subOrEmptyDict(modelName +
"Coeffs")),
432 outputPropertiesPtr_(NULL),
434 intCoupledPatchIDs_(),
435 regionName_(
lookup(
"regionName")),
436 functions_(*
this, subOrEmptyDict(
"functions"))
440 constructMeshObjects();
451 Foam::regionModels::regionModel::regionModel
454 const word& regionType,
455 const word& modelName,
464 regionType +
"Properties",
475 active_(dict.
lookup(
"active")),
477 modelName_(modelName),
478 regionMeshPtr_(NULL),
480 outputPropertiesPtr_(NULL),
482 intCoupledPatchIDs_(),
483 regionName_(dict.
lookup(
"regionName")),
484 functions_(*
this, subOrEmptyDict(
"functions"))
488 constructMeshObjects(dict);
511 Info<<
"\nEvolving " << modelName_ <<
" for region " 512 << regionMesh().name() <<
endl;
530 if (time_.writeTime())
532 outputProperties().writeObject
536 time_.writeCompression()
545 functions_.preEvolveRegion();
557 functions_.postEvolveRegion();
#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.
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.
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
static const dictionary null
Null dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static int & msgType()
Message tag of standard messages.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const fvMesh & regionMesh() const
Return the region mesh 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.
virtual void postEvolveRegion()
Post-evolve region.
virtual const fileName & name() const
Return the name of the stream.
label nbrCoupledPatchID(const regionModel &nbrRegion, const label regionPatchi) const
Return the coupled patch ID paired with coupled patch.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
const word & constant() const
Return constant name.
const word & name() const
Name function is needed to disambiguate those inherited.
const word & name() const
Return name.
errorManip< error > abort(error &err)
prefixOSstream Pout(cout,"Pout")
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 occurence of given element and return index,.
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE)
const dictionary * subDictPtr(const word &) const
Find and return a sub-dictionary pointer if present.
#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.
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.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
const labelList & intCoupledPatchIDs() const
Return the list of patch IDs internally coupled with the.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
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...
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
const Time & time() const
Return the top-level database.
label size() const
Return the number of elements in the UPtrList.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.