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];
213 interRegionAMI_[nbrRegionID].set
218 faceAreaWeightAMI::typeName,
224 interRegionAMI_[nbrRegionID][regionPatchi].calculate(
p, nbrP);
229 return interRegionAMI_[nbrRegionID][regionPatchi];
233 label nbrRegionID = interRegionAMINames_.size();
235 interRegionAMINames_.append(nbrRegion.
name());
237 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
240 label nPatch = regionMesh().boundaryMesh().
size();
243 interRegionAMI_.resize(nbrRegionID + 1);
254 interRegionAMI_[nbrRegionID].set
259 faceAreaWeightAMI::typeName,
265 interRegionAMI_[nbrRegionID][regionPatchi].calculate(
p, nbrP);
269 return interRegionAMI_[nbrRegionID][regionPatchi];
276 const regionModel& nbrRegion,
277 const label regionPatchi
280 label nbrPatchi = -1;
283 const fvMesh& nbrRegionMesh = nbrRegion.regionMesh();
290 if (regionPatchi >
pbm.size() - 1)
293 <<
"region patch index out of bounds: " 294 <<
"region patch index = " << regionPatchi
295 <<
", maximum index = " <<
pbm.size() - 1
299 const polyPatch&
pp = regionMesh().boundaryMesh()[regionPatchi];
301 if (!isA<mappedPatchBase>(
pp))
304 <<
"Expected a " << mappedPatchBase::typeName
308 const mappedPatchBase& mpb = refCast<const mappedPatchBase>(
pp);
311 const word& primaryPatchName = mpb.samplePatch();
314 forAll(nbrRegion.intCoupledPatchIDs(), j)
316 const label nbrRegionPatchi = nbrRegion.intCoupledPatchIDs()[j];
318 const mappedPatchBase& mpb =
319 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
321 if (mpb.samplePatch() == primaryPatchName)
323 nbrPatchi = nbrRegionPatchi;
330 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
333 <<
"Unable to find patch pair for local patch " 334 <<
p.name() <<
" and region " << nbrRegion.name()
344 Foam::regionModels::regionModel::regionModel
347 const word& regionType
354 regionType +
"Properties",
355 mesh.time().constant(),
367 outputPropertiesPtr_(nullptr),
369 intCoupledPatchIDs_(),
372 interRegionAMINames_(),
377 Foam::regionModels::regionModel::regionModel
380 const word& regionType,
381 const word& modelName,
389 regionType +
"Properties",
390 mesh.time().constant(),
400 modelName_(modelName),
401 coeffs_(subOrEmptyDict(modelName +
"Coeffs")),
402 outputPropertiesPtr_(nullptr),
404 intCoupledPatchIDs_(),
405 regionName_(
lookup(
"region")),
406 functions_(*this, subOrEmptyDict(
"functions"))
410 constructMeshObjects();
421 Foam::regionModels::regionModel::regionModel
424 const word& regionType,
425 const word& modelName,
426 const dictionary&
dict,
434 regionType +
"Properties",
435 mesh.time().constant(),
445 active_(
dict.
get<Switch>(
"active")),
447 modelName_(modelName),
448 coeffs_(
dict.subOrEmptyDict(modelName +
"Coeffs")),
449 outputPropertiesPtr_(nullptr),
451 intCoupledPatchIDs_(),
452 regionName_(
dict.lookup(
"region")),
453 functions_(*this, subOrEmptyDict(
"functions"))
457 constructMeshObjects();
474 Info<<
"\nEvolving " << modelName_ <<
" for region " 475 << regionMesh().name() <<
endl;
491 if (time_.writeTime())
493 outputProperties().writeObject
505 functions_.preEvolveRegion();
515 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.
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
const polyBoundaryMesh & pbm
virtual void evolveRegion()
Evolve the region.
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.
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.
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 time name of given scalar time 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.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type.
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())