40 namespace regionModels
48 void Foam::regionModels::regionModel::constructMeshObjects()
52 fvMesh* regionMeshPtr =
64 regionMeshPtr->objectRegistry::store();
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_)
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
215 faceAreaWeightAMI::typeName,
221 interRegionAMI_[nbrRegionID][regionPatchi].calculate(
p, nbrP);
226 return interRegionAMI_[nbrRegionID][regionPatchi];
230 label nbrRegionID = interRegionAMINames_.size();
232 interRegionAMINames_.append(nbrRegion.
name());
234 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
237 label nPatch = regionMesh().boundaryMesh().
size();
240 interRegionAMI_.resize(nbrRegionID + 1);
251 interRegionAMI_[nbrRegionID].set
256 faceAreaWeightAMI::typeName,
262 interRegionAMI_[nbrRegionID][regionPatchi].calculate(
p, nbrP);
266 return interRegionAMI_[nbrRegionID][regionPatchi];
273 const regionModel& nbrRegion,
274 const label regionPatchi
277 label nbrPatchi = -1;
280 const fvMesh& nbrRegionMesh = nbrRegion.regionMesh();
287 if (regionPatchi > pbm.
size() - 1)
290 <<
"region patch index out of bounds: " 291 <<
"region patch index = " << regionPatchi
292 <<
", maximum index = " << pbm.
size() - 1
296 const polyPatch& pp = regionMesh().boundaryMesh()[regionPatchi];
298 if (!isA<mappedPatchBase>(pp))
301 <<
"Expected a " << mappedPatchBase::typeName
305 const mappedPatchBase& mpb = refCast<const mappedPatchBase>(pp);
308 const word& primaryPatchName = mpb.samplePatch();
311 forAll(nbrRegion.intCoupledPatchIDs(), j)
313 const label nbrRegionPatchi = nbrRegion.intCoupledPatchIDs()[j];
315 const mappedPatchBase& mpb =
316 refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchi]);
318 if (mpb.samplePatch() == primaryPatchName)
320 nbrPatchi = nbrRegionPatchi;
327 const polyPatch&
p = regionMesh().boundaryMesh()[regionPatchi];
330 <<
"Unable to find patch pair for local patch " 331 <<
p.name() <<
" and region " << nbrRegion.name()
341 Foam::regionModels::regionModel::regionModel
344 const word& regionType
351 regionType +
"Properties",
352 mesh.time().constant(),
364 outputPropertiesPtr_(nullptr),
366 intCoupledPatchIDs_(),
369 interRegionAMINames_(),
374 Foam::regionModels::regionModel::regionModel
377 const word& regionType,
378 const word& modelName,
386 regionType +
"Properties",
387 mesh.time().constant(),
397 modelName_(modelName),
398 coeffs_(subOrEmptyDict(modelName +
"Coeffs")),
399 outputPropertiesPtr_(nullptr),
401 intCoupledPatchIDs_(),
402 regionName_(
lookup(
"region")),
403 functions_(*this, subOrEmptyDict(
"functions"))
407 constructMeshObjects();
418 Foam::regionModels::regionModel::regionModel
421 const word& regionType,
422 const word& modelName,
423 const dictionary&
dict,
431 regionType +
"Properties",
432 mesh.time().constant(),
442 active_(
dict.
get<Switch>(
"active")),
444 modelName_(modelName),
445 coeffs_(
dict.subOrEmptyDict(modelName +
"Coeffs")),
446 outputPropertiesPtr_(nullptr),
448 intCoupledPatchIDs_(),
449 regionName_(
dict.lookup(
"region")),
450 functions_(*this, subOrEmptyDict(
"functions"))
454 constructMeshObjects();
471 Info<<
"\nEvolving " << modelName_ <<
" for region " 472 << regionMesh().name() <<
endl;
488 if (time_.writeTime())
490 outputProperties().writeObject
502 functions_.preEvolveRegion();
512 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 & boundaryMesh() const
Return boundary mesh.
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
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.
A class for handling words, derived from Foam::string.
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 elements in the list.
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.
IOobject(const IOobject &)=default
Copy construct.
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.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
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...
defineTypeNameAndDebug(KirchhoffShell, 0)
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.