48void Foam::regionModels::regionModel::constructMeshObjects()
67 regionMeshPtr->objectRegistry::store();
72void Foam::regionModels::regionModel::initialise()
76 Pout<<
"regionModel::initialise()" <<
endl;
79 label nBoundaryFaces = 0;
80 DynamicList<label> primaryPatchIDs;
81 DynamicList<label> intCoupledPatchIDs;
82 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
86 const polyPatch& regionPatch = rbm[patchi];
91 Pout<<
"found " << mappedWallPolyPatch::typeName
92 <<
" " << regionPatch.
name() <<
endl;
95 intCoupledPatchIDs.append(patchi);
97 nBoundaryFaces += regionPatch.faceCells().size();
99 const mappedPatchBase& mapPatch =
104 primaryMesh_.time().foundObject<polyMesh>
106 mapPatch.sampleRegion()
111 const label primaryPatchi = mapPatch.samplePolyPatch().index();
112 primaryPatchIDs.append(primaryPatchi);
117 primaryPatchIDs_.transfer(primaryPatchIDs);
118 intCoupledPatchIDs_.transfer(intCoupledPatchIDs);
123 <<
"Region model has no mapped boundary conditions - transfer "
124 <<
"between regions will not be possible" <<
endl;
127 if (!outputPropertiesPtr_)
129 const fileName uniformPath(word(
"uniform")/
"regionModels");
131 outputPropertiesPtr_.reset
137 regionName_ +
"OutputProperties",
139 uniformPath/regionName_,
158 if (
const dictionary* dictptr = findDict(modelName_ +
"Coeffs"))
160 coeffs_ <<= *dictptr;
163 infoOutput_.readIfPresent(
"infoOutput", *
this);
177 if (
const dictionary* dictptr =
dict.findDict(modelName_ +
"Coeffs"))
179 coeffs_ <<= *dictptr;
182 infoOutput_.readIfPresent(
"infoOutput",
dict);
193 const regionModel& nbrRegion,
194 const label regionPatchi,
195 const label nbrPatchi,
199 label nbrRegionID = interRegionAMINames_.find(nbrRegion.name());
201 const fvMesh& nbrRegionMesh = nbrRegion.regionMesh();
203 if (nbrRegionID != -1)
205 if (!interRegionAMI_[nbrRegionID].set(regionPatchi))
207 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
212 interRegionAMI_[nbrRegionID].set
217 faceAreaWeightAMI::typeName,
223 interRegionAMI_[nbrRegionID][regionPatchi].calculate(
p, nbrP);
228 return interRegionAMI_[nbrRegionID][regionPatchi];
232 label nbrRegionID = interRegionAMINames_.size();
234 interRegionAMINames_.append(nbrRegion.name());
236 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
237 const polyPatch& nbrP = nbrRegionMesh.
boundaryMesh()[nbrPatchi];
239 const label nPatch = regionMesh().boundaryMesh().
size();
242 interRegionAMI_.resize(nbrRegionID + 1);
247 new PtrList<AMIPatchToPatchInterpolation>(nPatch)
252 interRegionAMI_[nbrRegionID].set
257 faceAreaWeightAMI::typeName,
263 interRegionAMI_[nbrRegionID][regionPatchi].calculate(
p, nbrP);
274 const regionModel& nbrRegion,
275 const label regionPatchi
278 label nbrPatchi = -1;
281 const fvMesh& nbrRegionMesh = nbrRegion.regionMesh();
288 if (regionPatchi >
pbm.size() - 1)
291 <<
"region patch index out of bounds: "
292 <<
"region patch index = " << regionPatchi
293 <<
", maximum index = " <<
pbm.size() - 1
297 const polyPatch&
pp = regionMesh().boundaryMesh()[regionPatchi];
302 <<
"Expected a " << mappedPatchBase::typeName
309 const word& primaryPatchName = mpb.samplePatch();
312 forAll(nbrRegion.intCoupledPatchIDs(), j)
314 const label nbrRegionPatchi = nbrRegion.intCoupledPatchIDs()[j];
316 const mappedPatchBase& mpb =
319 if (mpb.samplePatch() == primaryPatchName)
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()
342Foam::regionModels::regionModel::regionModel
345 const word& regionType
352 regionType +
"Properties",
365 outputPropertiesPtr_(nullptr),
367 intCoupledPatchIDs_(),
375Foam::regionModels::regionModel::regionModel
378 const word& regionType,
379 const word& modelName,
387 regionType +
"Properties",
396 active_(get<
Switch>(
"active")),
398 modelName_(modelName),
399 coeffs_(subOrEmptyDict(modelName +
"Coeffs")),
400 outputPropertiesPtr_(nullptr),
402 intCoupledPatchIDs_(),
403 regionName_(
lookup(
"region")),
404 functions_(*this, subOrEmptyDict(
"functions"))
408 constructMeshObjects();
419Foam::regionModels::regionModel::regionModel
422 const word& regionType,
423 const word& modelName,
432 regionType +
"Properties",
443 active_(
dict.get<Switch>(
"active")),
445 modelName_(modelName),
446 coeffs_(
dict.subOrEmptyDict(modelName +
"Coeffs")),
447 outputPropertiesPtr_(nullptr),
449 intCoupledPatchIDs_(),
450 regionName_(
dict.lookup(
"region")),
451 functions_(*this, subOrEmptyDict(
"functions"))
455 constructMeshObjects();
472 Info<<
"\nEvolving " << modelName_ <<
" for region "
473 << regionMesh().name() <<
endl;
489 if (time_.writeTime())
491 outputProperties().writeObject
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
static autoPtr< AMIInterpolation > New(const word &modelName, const dictionary &dict, const bool reverseTarget=false)
Selector for dictionary.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
@ REGISTER
Request registration (bool: true).
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A simple container for options an IOstream can normally have.
@ ASCII
"ascii" (normal default)
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name).
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
static int & msgType() noexcept
Message tag of standard messages.
static int incrMsgType(int val=1) noexcept
Increment the message tag for standard messages.
label size() const noexcept
The number of entries in the list.
const word & name() const
Name function is needed to disambiguate those inherited from regIOobject and dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
Find and return a sub-dictionary as a copy, otherwise return an empty dictionary.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
dictionary()
Default construct, a top-level empty dictionary.
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return an entry data stream. FatalIOError if not found, or not a stream.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
Mesh data needed to do the Finite Volume discretisation.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE).
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
constant condensation/saturation model.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
Lookup type of boundary radiation properties.
virtual bool read()
Read object.
Base class for region models.
autoPtr< IOdictionary > outputPropertiesPtr_
Dictionary of output properties.
Switch active_
Active flag.
const Time & time_
Reference to the time database.
const word modelName_
Model name.
virtual void postEvolveRegion()
Post-evolve region.
Switch infoOutput_
Active information output.
label nbrCoupledPatchID(const regionModel &nbrRegion, const label regionPatchi) const
Return the coupled patch ID paired with coupled patch.
word regionName_
Region name.
labelList primaryPatchIDs_
List of patch IDs on the primary region coupled to this region.
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.
const Time & time() const noexcept
Return the reference to the time database.
dictionary coeffs_
Model coefficients dictionary.
const fvMesh & regionMesh() const
Return the region mesh database.
PtrList< PtrList< AMIPatchToPatchInterpolation > > interRegionAMI_
List of AMI objects per coupled region.
virtual void preEvolveRegion()
Pre-evolve region.
const labelList & intCoupledPatchIDs() const noexcept
List of patch IDs internally coupled with the primary region.
virtual void evolve()
Main driver routing to evolve the region - calls other evolves.
const fvMesh & primaryMesh_
Reference to the primary mesh database.
regionModelFunctionObjectList functions_
Region model function objects.
virtual void info()
Provide some feedback.
wordList interRegionAMINames_
List of region names this region is coupled to.
const IOdictionary & outputProperties() const
Return const access to the output properties dictionary.
labelList intCoupledPatchIDs_
List of patch IDs internally coupled with the primary region.
const word & modelName() const noexcept
Return the model name.
virtual bool read()
Read control parameters from dictionary.
virtual void evolveRegion()
Evolve the region.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
Different types of constants.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
AMIInterpolation AMIPatchToPatchInterpolation
Patch-to-patch interpolation == Foam::AMIInterpolation.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
#define forAll(list, i)
Loop across all elements in list.