Go to the documentation of this file.
51 "faceZoneAndDirection",
52 "cellZoneAndDirection"
65 const word& faceZoneName,
72 const fvMesh&
mesh = refCast<const fvMesh>(obr_);
74 label zoneI =
mesh.faceZones().findZoneID(faceZoneName);
79 <<
"Unable to find faceZone " << faceZoneName
80 <<
". Valid faceZones are: " <<
mesh.faceZones().names()
84 faceZoneNames.
append(faceZoneName);
94 label faceI = fZone[i];
97 label facePatchID = -1;
98 if (
mesh.isInternalFace(faceI))
105 facePatchID =
mesh.boundaryMesh().whichPatch(faceI);
107 if (isA<coupledPolyPatch>(pp))
109 if (refCast<const coupledPolyPatch>(pp).owner())
118 else if (!isA<emptyPolyPatch>(pp))
120 faceID = faceI - pp.
start();
142 facePatchIDs.
append(facePatchID);
146 faceID.append(faceIDs);
147 facePatchID.append(facePatchIDs);
148 faceSign.append(faceSigns);
154 const word& faceZoneName,
163 const fvMesh&
mesh = refCast<const fvMesh>(obr_);
165 vector refDir = dir/(
mag(dir) + ROOTVSMALL);
167 label zoneI =
mesh.faceZones().findZoneID(faceZoneName);
172 <<
"Unable to find faceZone " << faceZoneName
173 <<
". Valid faceZones are: " <<
mesh.faceZones().names()
177 faceZoneNames.
append(faceZoneName);
178 zoneRefDir.
append(refDir);
193 label faceI = fZone[i];
196 label facePatchID = -1;
197 if (
mesh.isInternalFace(faceI))
204 facePatchID =
mesh.boundaryMesh().whichPatch(faceI);
206 if (isA<coupledPolyPatch>(pp))
208 if (refCast<const coupledPolyPatch>(pp).owner())
217 else if (!isA<emptyPolyPatch>(pp))
219 faceID = faceI - pp.
start();
231 if (facePatchID != -1)
238 n = Sf[faceID]/(magSf[faceID] + ROOTVSMALL);
241 if ((
n & refDir) > tolerance_)
251 facePatchIDs.
append(facePatchID);
255 faceID.append(faceIDs);
256 facePatchID.append(facePatchIDs);
257 faceSign.append(faceSigns);
263 const word& cellZoneName,
272 const fvMesh&
mesh = refCast<const fvMesh>(obr_);
274 vector refDir = dir/(
mag(dir) + ROOTVSMALL);
276 const label cellZoneI =
mesh.cellZones().findZoneID(cellZoneName);
281 <<
"Unable to find cellZone " << cellZoneName
282 <<
". Valid zones are: " <<
mesh.cellZones().names()
286 const label nInternalFaces =
mesh.nInternalFaces();
292 labelList nbrFaceCellAddr(
mesh.nFaces() - nInternalFaces, -1);
303 label nbrFaceI = faceI - nInternalFaces;
305 nbrFaceCellAddr[nbrFaceI] = cellAddr[own];
311 syncTools::swapBoundaryFaceList(
mesh, nbrFaceCellAddr);
320 for (
label faceI = 0; faceI < nInternalFaces; faceI++)
322 const label own = cellAddr[
mesh.faceOwner()[faceI]];
323 const label nbr = cellAddr[
mesh.faceNeighbour()[faceI]];
325 if (((own != -1) && (nbr == -1)) || ((own == -1) && (nbr != -1)))
328 n /=
mag(
n) + ROOTVSMALL;
330 if ((
n & refDir) > tolerance_)
333 faceLocalPatchIDs.
append(faceI);
337 else if ((
n & -refDir) > tolerance_)
340 faceLocalPatchIDs.
append(faceI);
355 const label own = cellAddr[
mesh.faceOwner()[faceI]];
356 const label nbr = nbrFaceCellAddr[faceI - nInternalFaces];
358 if ((own != -1) && (nbr == -1))
361 n /=
mag(
n) + ROOTVSMALL;
363 if ((
n & refDir) > tolerance_)
366 faceLocalPatchIDs.
append(localFaceI);
367 facePatchIDs.
append(patchI);
370 else if ((
n & -refDir) > tolerance_)
373 faceLocalPatchIDs.
append(localFaceI);
374 facePatchIDs.
append(patchI);
404 Info<<
"initialiseCellZoneAndDirection: "
405 <<
"Starting walk to split patch into faceZones"
419 for (; oldFaceID < patch.size(); oldFaceID++)
421 if (allFaceInfo[oldFaceID].region() == -1)
423 seedFaceI = globalFaces.
toGlobal(oldFaceID);
434 if (globalFaces.
isLocal(seedFaceI))
441 if (allEdgeInfo[fEdges[i]].region() != -1)
444 <<
"Problem in edge face wave: attempted to assign a "
445 <<
"value to an edge that has already been visited. "
446 <<
"Edge info: " << allEdgeInfo[fEdges[i]]
450 changedEdges.
append(fEdges[i]);
451 changedInfo.
append(regionI);
474 forAll(allFaceInfo, faceI)
476 if (allFaceInfo[faceI].region() == regionI)
482 Info<<
"*** region:" << regionI
491 label nRegion = regionI;
497 forAll(allFaceInfo, faceI)
499 regionI = allFaceInfo[faceI].region();
501 regionFaceIDs[regionI].
append(faceLocalPatchIDs[faceI]);
502 regionFacePatchIDs[regionI].
append(facePatchIDs[faceI]);
503 regionFaceSigns[regionI].
append(faceSigns[faceI]);
507 forAll(regionFaceIDs, regionI)
509 const word zoneName = cellZoneName +
":faceZone" +
Foam::name(regionI);
510 faceZoneNames.
append(zoneName);
511 zoneRefDir.
append(refDir);
512 faceID.append(regionFaceIDs[regionI]);
513 facePatchID.append(regionFacePatchIDs[regionI]);
514 faceSign.append(regionFaceSigns[regionI]);
527 Info<<
type() <<
" " << name_ <<
" output:" <<
nl
528 <<
" Created " << faceID.size()
529 <<
" separate face zones from cell zone " << cellZoneName <<
nl;
534 Info<<
" " << faceZoneNames[i] <<
": "
535 << nFaces <<
" faces" <<
nl;
559 label faceI = faceIDs[i];
561 if (facePatchIDs[i] == -1)
563 sumMagSf += magSf[faceI];
567 label patchI = facePatchIDs[i];
584 const bool loadFromFiles
605 if (!isA<fvMesh>(obr_))
609 <<
"No fvMesh available, deactivating " << name_
667 case mdFaceZoneAndDirection:
670 zoneAndDirection(
dict.
lookup(
"faceZoneAndDirection"));
672 forAll(zoneAndDirection, i)
674 initialiseFaceZoneAndDirection
676 zoneAndDirection[i].first(),
677 zoneAndDirection[i].second(),
687 case mdCellZoneAndDirection:
690 zoneAndDirection(
dict.
lookup(
"cellZoneAndDirection"));
692 forAll(zoneAndDirection, i)
694 initialiseCellZoneAndDirection
696 zoneAndDirection[i].first(),
697 zoneAndDirection[i].second(),
715 faceZoneName_.transfer(faceZoneName);
716 refDir_.transfer(refDir);
717 faceID_.transfer(faceID);
718 facePatchID_.transfer(facePatchID);
719 faceSign_.transfer(faceSign);
721 initialiseFaceArea();
725 filePtrs_.setSize(faceZoneName_.size());
729 const word& fzName = faceZoneName_[fileI];
730 filePtrs_.set(fileI, createFile(fzName));
744 Info<<
type() <<
" " << name_ <<
" output:" <<
nl;
746 forAll(faceZoneName_, zoneI)
748 const word& zoneName = faceZoneName_[zoneI];
749 scalar zoneArea = faceArea_[zoneI];
751 Info<<
" Zone: " << zoneName <<
", area: " << zoneArea <<
nl;
767 writeHeader(os,
"Flux summary");
768 writeHeaderValue(os,
"Face zone", fzName);
769 writeHeaderValue(os,
"Total area", area);
773 case mdFaceZoneAndDirection:
774 case mdCellZoneAndDirection:
776 writeHeaderValue(os,
"Reference direction", refDir);
783 writeHeaderValue(os,
"Scale factor", scaleFactor_);
785 writeCommented(os,
"Time");
786 os <<
tab <<
"positive"
825 flowType =
"volumetric";
834 <<
"Unsupported flux field " <<
phi.name() <<
" with dimensions "
835 <<
phi.dimensions() <<
". Expected eithe mass flow or volumetric "
841 Info<<
type() <<
" " << name_ <<
' ' << flowType <<
" flux output:"
845 forAll(faceZoneName_, zoneI)
847 const labelList& faceID = faceID_[zoneI];
848 const labelList& facePatchID = facePatchID_[zoneI];
849 const scalarList& faceSign = faceSign_[zoneI];
851 scalar phiPos = scalar(0);
852 scalar phiNeg = scalar(0);
853 scalar phif = scalar(0);
857 label faceI = faceID[i];
858 label patchI = facePatchID[i];
884 phiPos *= scaleFactor_;
885 phiNeg *= scaleFactor_;
887 scalar netFlux = phiPos + phiNeg;
888 scalar absoluteFlux = phiPos - phiNeg;
892 Info<<
" faceZone " << faceZoneName_[zoneI] <<
':' <<
nl
893 <<
" positive : " << phiPos <<
nl
894 <<
" negative : " << phiNeg <<
nl
895 <<
" net : " << netFlux <<
nl
896 <<
" absolute : " << absoluteFlux
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
A class for handling words, derived from string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
OFstream which keeps track of vertices.
#define forAll(list, i)
Loop across all elements in list.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
virtual Ostream & write(const char)
Write character.
bool read(const char *, int32_t &)
static const label labelMax
Wave propagation of information along patch. Every iteration information goes through one layer of fa...
label nEdges() const
Return number of edges in patch.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
void calc(const argList &args, const Time &runTime, const fvMesh &mesh)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
const objectRegistry & obr_
Reference to the database.
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
void read(const dictionary &dict)
Read.
bool isLocal(const label i) const
Is on local processor.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelListList & faceEdges() const
Return face-edge addressing.
dimensioned< scalar > mag(const dimensioned< Type > &)
Registry of regIOobjects.
const Foam::NamedEnum< Foam::scene::modeType, 2 > modeTypeNames_
void initialiseFaceArea()
Initialise the total area per derived faceZone.
virtual void execute()
Execute, currently does nothing.
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)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
List< List< label > > facePatchID_
Face patch IDs.
virtual void end()
Execute at the final time-loop, currently does nothing.
A subset of mesh faces organised as a primitive patch.
void initialiseCellZoneAndDirection(const word &cellZoneName, const vector &refDir, DynamicList< vector > &dir, DynamicList< word > &faceZoneNames, DynamicList< List< label > > &faceID, DynamicList< List< label > > &facePatchID, DynamicList< List< scalar > > &faceSign) const
Initialise face set from cell zone and direction.
void append(const T &)
Append an element at the end of the list.
A patch is a list of labels that address the faces in the global face list.
A List with indirect addressing.
void initialiseFaceZone(const word &faceZoneName, DynamicList< word > &faceZoneNames, DynamicList< List< label > > &faceID, DynamicList< List< label > > &facePatchID, DynamicList< List< scalar > > &faceSign) const
Initialise face set from face zone.
virtual void read(const dictionary &)
Read the field min/max data.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
A list of keyword definitions, which are a keyword followed by any number of values (e....
fluxSummary(const fluxSummary &)
Disallow default bitwise copy construct.
Mesh data needed to do the Finite Volume discretisation.
virtual ~fluxSummary()
Destructor.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
errorManip< error > abort(error &err)
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label start() const
Return start label of this patch in the polyMesh face list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setSize(const label)
Reset size of List.
label toLocal(const label i) const
From global to local on current processor.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label whichFace(const label l) const
Return label of face in patch from global face label.
List< scalar > faceArea_
Sum of face areas.
virtual void writeFileHeader(const word &fzName, const scalar area, const vector &refDir, Ostream &os) const
Output file header information.
Transport of region for use in PatchEdgeFaceWave.
Base class for output file data handling.
virtual void write()
Write the fluxSummary.
A List with indirect addressing.
List< List< label > > faceID_
Face IDs.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
static const NamedEnum< modeType, 3 > modeTypeNames_
Mode type names.
const dimensionSet dimVolume(pow3(dimLength))
void initialiseFaceZoneAndDirection(const word &faceZoneName, const vector &refDir, DynamicList< vector > &dir, DynamicList< word > &faceZoneNames, DynamicList< List< label > > &faceID, DynamicList< List< label > > &facePatchID, DynamicList< List< scalar > > &faceSign) const
Initialise face set from face zone and direction.
Generic GeometricField class.
const boolList & flipMap() const
Return face flip map.
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
word name(const complex &)
Return a string representation of a complex.
Initialise the NamedEnum HashTable from the static list of names.
label toGlobal(const label i) const
From local to global.
A list of faces which address into the list of points.