40 namespace regionModels
48 void Foam::regionModels::regionModel::constructMeshObjects()
54 regionMeshPtr =
new fvMesh
67 regionMeshPtr->objectRegistry::store();
72 void 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];
87 if (isA<mappedPatchBase>(regionPatch))
91 Pout<<
"found " << mappedWallPolyPatch::typeName
92 <<
" " << regionPatch.
name() <<
endl;
95 intCoupledPatchIDs.append(patchi);
97 nBoundaryFaces += regionPatch.faceCells().size();
99 const mappedPatchBase& mapPatch =
100 refCast<const mappedPatchBase>(regionPatch);
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);
194 const label regionPatchi,
195 const label nbrPatchi,
199 label nbrRegionID = interRegionAMINames_.find(nbrRegion.
name());
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];
239 const label nPatch = regionMesh().boundaryMesh().
size();
242 interRegionAMI_.resize(nbrRegionID + 1);
252 interRegionAMI_[nbrRegionID].set
257 faceAreaWeightAMI::typeName,
263 interRegionAMI_[nbrRegionID][regionPatchi].calculate(
p, nbrP);
267 return interRegionAMI_[nbrRegionID][regionPatchi];
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];
299 if (!isA<mappedPatchBase>(
pp))
302 <<
"Expected a " << mappedPatchBase::typeName
306 const mappedPatchBase& mpb = refCast<const mappedPatchBase>(
pp);
309 const word& primaryPatchName = mpb.samplePatch();
312 forAll(nbrRegion.intCoupledPatchIDs(), j)
314 const label nbrRegionPatchi = nbrRegion.intCoupledPatchIDs()[j];
316 const mappedPatchBase& mpb =
317 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
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()
342 Foam::regionModels::regionModel::regionModel
345 const word& regionType
352 regionType +
"Properties",
353 mesh.time().constant(),
365 outputPropertiesPtr_(nullptr),
367 intCoupledPatchIDs_(),
370 interRegionAMINames_(),
375 Foam::regionModels::regionModel::regionModel
378 const word& regionType,
379 const word& modelName,
387 regionType +
"Properties",
388 mesh.time().constant(),
398 modelName_(modelName),
399 coeffs_(subOrEmptyDict(modelName +
"Coeffs")),
400 outputPropertiesPtr_(nullptr),
402 intCoupledPatchIDs_(),
403 regionName_(
lookup(
"region")),
404 functions_(*this, subOrEmptyDict(
"functions"))
408 constructMeshObjects();
419 Foam::regionModels::regionModel::regionModel
422 const word& regionType,
423 const word& modelName,
424 const dictionary&
dict,
432 regionType +
"Properties",
433 mesh.time().constant(),
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
503 functions_.preEvolveRegion();
513 functions_.postEvolveRegion();
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
const polyBoundaryMesh & pbm
virtual void evolveRegion()
Evolve the region.
static int incrMsgType(int val=1) noexcept
Increment the message tag for standard messages.
virtual void info()
Provide some feedback.
virtual bool read()
Read object.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
static int & msgType() noexcept
Message tag of standard messages.
Ignore writing from objectRegistry::writeObject()
Lookup type of boundary radiation properties.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
virtual void preEvolveRegion()
Pre-evolve region.
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.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
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...
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.
label size() const noexcept
The number of entries in the list.
Reading is optional [identical to LAZY_READ].
const fvMesh & regionMesh() const
Return the region mesh database.
const word & name() const
Name function is needed to disambiguate those inherited from regIOobject and dictionary.
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)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
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.
Switch active_
Active flag.
int debug
Static debugging option.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
#define WarningInFunction
Report a warning using Foam::Warning.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
const Time & time_
Reference to the time database.
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...
messageStream Info
Information stream (stdout output on master, null elsewhere)
Base class for region models.
static autoPtr< AMIInterpolation > New(const word &modelName, const dictionary &dict, const bool reverseTarget=false)
Selector for dictionary.
A patch is a list of labels that address the faces in the global face list.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
word regionName_
Region name.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
defineTypeNameAndDebug(KirchhoffShell, 0)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())