Go to the documentation of this file.
39 namespace regionModels
47 void Foam::regionModels::regionModel::constructMeshObjects()
69 void Foam::regionModels::regionModel::initialise()
73 Pout<<
"regionModel::initialise()" <<
endl;
76 label nBoundaryFaces = 0;
77 DynamicList<label> primaryPatchIDs;
78 DynamicList<label> intCoupledPatchIDs;
79 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
83 const polyPatch& regionPatch = rbm[patchi];
84 if (isA<mappedPatchBase>(regionPatch))
88 Pout<<
"found " << mappedWallPolyPatch::typeName
89 <<
" " << regionPatch.
name() <<
endl;
92 intCoupledPatchIDs.append(patchi);
94 nBoundaryFaces += regionPatch.faceCells().size();
96 const mappedPatchBase& mapPatch =
97 refCast<const mappedPatchBase>(regionPatch);
101 primaryMesh_.time().foundObject<polyMesh>
103 mapPatch.sampleRegion()
108 const label primaryPatchi = mapPatch.samplePolyPatch().index();
109 primaryPatchIDs.append(primaryPatchi);
114 primaryPatchIDs_.transfer(primaryPatchIDs);
115 intCoupledPatchIDs_.transfer(intCoupledPatchIDs);
120 <<
"Region model has no mapped boundary conditions - transfer "
121 <<
"between regions will not be possible" <<
endl;
124 if (!outputPropertiesPtr_.valid())
126 const fileName uniformPath(word(
"uniform")/
"regionModels");
128 outputPropertiesPtr_.reset
134 regionName_ +
"OutputProperties",
136 uniformPath/regionName_,
155 if (
const dictionary* dictptr = findDict(modelName_ +
"Coeffs"))
157 coeffs_ <<= *dictptr;
160 infoOutput_.readIfPresent(
"infoOutput", *
this);
174 if (
const dictionary* dictptr =
dict.findDict(modelName_ +
"Coeffs"))
176 coeffs_ <<= *dictptr;
179 infoOutput_.readIfPresent(
"infoOutput",
dict);
191 const label regionPatchi,
192 const label nbrPatchi,
196 label nbrRegionID = interRegionAMINames_.find(nbrRegion.
name());
200 if (nbrRegionID != -1)
202 if (!interRegionAMI_[nbrRegionID].set(regionPatchi))
204 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
210 interRegionAMI_[nbrRegionID].set
228 return interRegionAMI_[nbrRegionID][regionPatchi];
232 label nbrRegionID = interRegionAMINames_.size();
234 interRegionAMINames_.append(nbrRegion.
name());
236 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
239 label nPatch = regionMesh().boundaryMesh().size();
242 interRegionAMI_.
resize(nbrRegionID + 1);
253 interRegionAMI_[nbrRegionID].set
270 return interRegionAMI_[nbrRegionID][regionPatchi];
278 const label regionPatchi
281 label nbrPatchi = -1;
291 if (regionPatchi > pbm.size() - 1)
294 <<
"region patch index out of bounds: "
295 <<
"region patch index = " << regionPatchi
296 <<
", maximum index = " << pbm.size() - 1
302 if (!isA<mappedPatchBase>(pp))
305 <<
"Expected a " << mappedPatchBase::typeName
320 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
324 nbrPatchi = nbrRegionPatchi;
331 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
334 <<
"Unable to find patch pair for local patch "
335 <<
p.name() <<
" and region " << nbrRegion.
name()
345 Foam::regionModels::regionModel::regionModel
348 const word& regionType
355 regionType +
"Properties",
356 mesh.time().constant(),
367 regionMeshPtr_(
nullptr),
369 outputPropertiesPtr_(
nullptr),
371 intCoupledPatchIDs_(),
374 interRegionAMINames_(),
379 Foam::regionModels::regionModel::regionModel
382 const word& regionType,
383 const word& modelName,
391 regionType +
"Properties",
392 mesh.time().constant(),
400 active_(get<Switch>(
"active")),
402 modelName_(modelName),
403 regionMeshPtr_(
nullptr),
404 coeffs_(subOrEmptyDict(modelName +
"Coeffs")),
405 outputPropertiesPtr_(
nullptr),
407 intCoupledPatchIDs_(),
408 regionName_(
lookup(
"region")),
409 functions_(*
this, subOrEmptyDict(
"functions"))
413 constructMeshObjects();
424 Foam::regionModels::regionModel::regionModel
427 const word& regionType,
428 const word& modelName,
437 regionType +
"Properties",
438 mesh.time().constant(),
450 modelName_(modelName),
451 regionMeshPtr_(
nullptr),
452 coeffs_(
dict.subOrEmptyDict(modelName +
"Coeffs")),
453 outputPropertiesPtr_(
nullptr),
455 intCoupledPatchIDs_(),
456 regionName_(
dict.lookup(
"region")),
457 functions_(*
this, subOrEmptyDict(
"functions"))
461 constructMeshObjects();
484 Info<<
"\nEvolving " << modelName_ <<
" for region "
485 << regionMesh().name() <<
endl;
501 if (time_.writeTime())
503 outputProperties().writeObject
507 time_.writeCompression(),
517 functions_.preEvolveRegion();
527 functions_.postEvolveRegion();
int debug
Static debugging option.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
virtual void evolveRegion()
Evolve the region.
virtual void info()
Provide some feedback.
bool read(const char *buf, int32_t &val)
Same as readInt32.
static word timeName(const scalar t, const int precision=precision_)
autoPtr< fvMesh > regionMeshPtr_
Pointer to the region mesh database.
virtual bool read()
Read object.
static const versionNumber currentVersion
The current version number.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
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.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
#define forAll(list, i)
Loop across all elements in list.
Base class for region models.
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
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 polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
virtual void postEvolveRegion()
Post-evolve region.
messageStream Info
Information stream (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
virtual const fileName & name() const
Return the name of the stream.
const cellModel * lookup(const word &modelName)
Deprecated(2017-11) equivalent to cellModel::ptr static method.
const fvMesh & regionMesh() const
Return the region mesh database.
virtual void preEvolveRegion()
Pre-evolve region.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
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.
defineTypeNameAndDebug(regionModel, 0)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
errorManip< error > abort(error &err)
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.
void resize(const label newLen)
Adjust size of PtrList.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
virtual ~regionModel()
Destructor.
static int & msgType()
Message tag of standard messages.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Time & time_
Reference to the time database.
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
IOobject(const word &name, const fileName &instance, const objectRegistry ®istry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
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.
#define WarningInFunction
Report a warning using Foam::Warning.
word regionName_
Region name.
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE)