Go to the documentation of this file.
58 if (!
mesh.upToDatePoints(AMITime_))
64 <<
" mesh points are up to time " <<
mesh.pointsInstance()
65 <<
" patch:" << this->
name()
73 && (updated || prevTimeIndex_ !=
mesh.time().timeIndex())
78 Pout<<
"cyclicACMIPolyPatch::updateAreas() :"
79 <<
" patch:" << this->
name()
81 <<
" AMITime_:" << AMITime_.
eventNo()
82 <<
" uptodate:" <<
mesh.upToDatePoints(AMITime_)
83 <<
" mesh.time().timeIndex():" <<
mesh.time().timeIndex()
84 <<
" prevTimeIndex_:" << prevTimeIndex_
91 <<
"Topology changes and scaling currently not supported."
92 <<
" Patch " << this->
name() <<
endl;
95 const scalar t =
mesh.time().timeOutputValue();
106 if (!tgtScalePtr_.valid())
120 Pout<<
"cyclicACMIPolyPatch::updateAreas : scaling masks"
121 <<
" for " <<
name() <<
" mask " <<
gAverage(srcScaledMask_)
133 prevTimeIndex_ =
mesh.time().timeIndex();
163 label nUncovered = 0;
165 for (
const scalar
sum : weightSum)
167 if (
sum < tolerance_)
171 else if (
sum > scalar(1) - tolerance_)
180 Info<<
"ACMI: Patch " <<
name <<
" uncovered/blended/covered = "
181 << nUncovered <<
", " << nTotal-nUncovered-nCovered
182 <<
", " << nCovered <<
endl;
197 const scalar maxTol = scalar(1) - tolerance_;
203 <<
"rescaling non-overlap patch areas for: "
206 if (mask.size() != noSf.size())
209 <<
"Inconsistent sizes for patch: " << acmipp.
name()
210 <<
" - not manipulating patches" <<
nl
211 <<
" - size: " << size() <<
nl
212 <<
" - non-overlap patch size: " << noSf.size() <<
nl
213 <<
" - mask size: " << mask.size() <<
nl
214 <<
"This is OK for decomposition but"
215 <<
" should be considered fatal at run-time" <<
endl;
222 const scalar w =
min(maxTol,
max(tolerance_, mask[facei]));
223 noSf[facei] = noFaceArea[facei]*(scalar(1) - w);
226 if (!createAMIFaces_)
233 <<
"scaling coupled patch areas for: " << acmipp.
name() <<
endl;
240 Sf[facei] = faceArea[facei]*
max(tolerance_, mask[facei]);
252 scalar&
sum = weightsSum[i];
278 const polyPatch& nonOverlapPatch = this->nonOverlapPatch();
281 <<
"cyclicACMIPolyPatch::resetAMI : recalculating weights"
282 <<
" for " <<
name() <<
" and " << nonOverlapPatch.
name()
290 <<
"cyclicACMIPolyPatch::resetAMI : clearing cellCentres"
291 <<
" for " <<
name() <<
" and " << nonOverlapPatch.
name() <<
nl
292 <<
"The mesh already has cellCentres calculated when"
293 <<
" resetting ACMI " <<
name() <<
"." <<
nl
294 <<
"This is a problem since ACMI adapts the face areas"
295 <<
" (to close cells) so this has" <<
nl
296 <<
"to be done before cell centre calculation." <<
nl
297 <<
"This can happen if e.g. the cyclicACMI is after"
298 <<
" any processor patches in the boundary." <<
endl;
309 <<
"primitiveMesh must already have face geometry"
337 <<
" non-overlap patch: " <<
patch.nonOverlapPatch().name()
338 <<
" size:" <<
patch.nonOverlapPatch().size()
339 <<
" mask size:" <<
patch.srcMask().size() <<
endl;
344 <<
" non-overlap patch: " <<
patch.nonOverlapPatch().name()
345 <<
" size:" <<
patch.nonOverlapPatch().size()
346 <<
" mask size:" <<
patch.neighbPatch().tgtMask().size()
355 if (!owner() || !canResetAMI())
360 const polyPatch& nonOverlapPatch = this->nonOverlapPatch();
364 if (srcScalePtr_.valid())
367 thisSf_ = this->faceAreas();
370 nbrNoSf_ = nbrNonOverlapPatch.
faceAreas();
403 if (!createAMIFaces_ && canResetAMI())
408 scalePatchFaceAreas();
431 if (!createAMIFaces_ && canResetAMI())
436 scalePatchFaceAreas();
479 if (srcScalePtr_.valid())
484 return srcScaledMask_;
495 if (tgtScalePtr_.valid())
500 return tgtScaledMask_;
518 const word& patchType,
520 const word& defaultAMIMethod
535 nonOverlapPatchID_(-1),
553 AMIPtr_->setRequireMatch(
false);
566 const word& patchType,
567 const word& defaultAMIMethod
571 nonOverlapPatchName_(
dict.
get<
word>(
"nonOverlapPatch")),
572 nonOverlapPatchID_(-1),
596 AMIPtr_->setRequireMatch(
false);
598 if (nonOverlapPatchName_ ==
name)
601 <<
"Non-overlapping patch name " << nonOverlapPatchName_
602 <<
" cannot be the same as this patch " <<
name
618 nonOverlapPatchName_(pp.nonOverlapPatchName_),
619 nonOverlapPatchID_(-1),
624 pp.srcScalePtr_.valid()
625 ? pp.srcScalePtr_.clone(*
this)
643 AMIPtr_->setRequireMatch(
false);
656 const label newStart,
657 const word& nbrPatchName,
658 const word& nonOverlapPatchName
662 nonOverlapPatchName_(nonOverlapPatchName),
663 nonOverlapPatchID_(-1),
668 pp.srcScalePtr_.valid()
669 ? pp.srcScalePtr_.clone(*
this)
687 AMIPtr_->setRequireMatch(
false);
689 if (nonOverlapPatchName_ ==
name())
692 <<
"Non-overlapping patch name " << nonOverlapPatchName_
693 <<
" cannot be the same as this patch " <<
name()
712 nonOverlapPatchName_(pp.nonOverlapPatchName_),
713 nonOverlapPatchID_(-1),
718 pp.srcScalePtr_.valid()
719 ? pp.srcScalePtr_.clone(*
this)
737 AMIPtr_->setRequireMatch(
false);
748 if (!owner() && srcScalePtr_.valid())
751 <<
"Ignoring \"scale\" setting in slave patch " <<
name()
753 srcScalePtr_.clear();
754 tgtScalePtr_.clear();
757 return refCast<const cyclicACMIPolyPatch>(pp);
763 if (nonOverlapPatchID_ == -1)
768 if (nonOverlapPatchID_ == -1)
771 <<
"Illegal non-overlapping patch name " << nonOverlapPatchName_
772 <<
nl <<
"Valid patch names are "
777 if (nonOverlapPatchID_ < index())
780 <<
"Boundary ordering error: " <<
type()
781 <<
" patch must be defined prior to its non-overlapping patch"
783 <<
type() <<
" patch: " <<
name() <<
", ID:" << index() <<
nl
784 <<
"Non-overlap patch: " << nonOverlapPatchName_
785 <<
", ID:" << nonOverlapPatchID_ <<
nl
793 if (size() == noPp.size())
800 scalar ratio =
mag(magSf[facei]/(noMagSf[facei] + ROOTVSMALL));
802 if (ratio - 1 > tolerance_)
817 <<
"Inconsistent ACMI patches " <<
name() <<
" and "
818 << noPp.
name() <<
". Patches should have identical topology"
823 return nonOverlapPatchID_;
853 os.
writeEntry(
"nonOverlapPatch", nonOverlapPatchName_);
855 if (owner() && srcScalePtr_.valid())
857 srcScalePtr_->writeData(os);
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
const bMesh & mesh() const
Defines the attributes of an object for which implicit objectRegistry management is supported,...
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
virtual void resetAMI() const
Reset the AMI interpolator, use current patch points.
virtual bool owner() const
Does this side own the patch?
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.
bool upToDate(const regIOobject &) const
Return true if up-to-date with respect to given object.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
const scalarField & tgtWeightsSum() const
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Type gAverage(const FieldField< Field, Type > &f)
bool upToDate(const regIOobject &) const
Return true if given object is up to date with *this.
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void clearCellGeom()
Clear cell-based geometry only.
const scalarListList & weights() const
Helper function to return the weights.
void setUpToDate(regIOobject &) const
Set object up to date with *this.
const scalarField & srcWeightsSum() const
static const scalar tolerance_
Tolerance used e.g. for area calculations/limits.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label eventNo() const
Event number at last update.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
virtual void resetAMI() const
Reset the AMI interpolator, use current patch points.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
SubField is a Field obtained as a section of another Field.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
const scalarField & weightsSum() const
Helper function to return the weights sum.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
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 scalarField & srcMask() const
Return the mask/weighting for the source patch.
word name(const complex &c)
Return string representation of complex.
bool hasCellCentres() const
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
virtual void clearGeom()
Clear geometry.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const polyMesh & mesh() const
Return the mesh reference.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
cyclicACMIPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType, const transformType transform=UNKNOWN, const word &defaultAMIMethod=partialFaceAreaWeightAMI::typeName)
Construct from (base coupled patch) components.
Macros for easy insertion into run-time selection tables.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
errorManip< error > abort(error &err)
#define DebugPout
Report an information message using Foam::Pout.
bool hasFaceAreas() const
void setUpToDate()
Set as up-to-date.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
virtual void scalePatchFaceAreas()
Scale patch face areas to maintain physical area.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const cyclicACMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
const std::string patch
OpenFOAM patch number as a std::string.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
virtual void clearGeom()
Clear geometry.
const vectorField::subField faceAreas() const
Return face normals.
virtual bool updateAreas() const
Update the AMI and patch areas. Return true if anything.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
static const word null
An empty word.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
bool createAMIFaces_
Flag to indicate that new AMI faces will created.
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI).
defineTypeNameAndDebug(combustionModel, 0)
const word & name() const
The patch name.
#define WarningInFunction
Report a warning using Foam::Warning.
A list of faces which address into the list of points.
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
void reportCoverage(const word &name, const scalarField &weightSum) const
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Cyclic patch for Arbitrary Mesh Interface (AMI)