34 template<
class CloudType>
48 Info<<
"Creating output file." <<
endl;
51 if (Pstream::master())
54 mkDir(this->writeTimeDir());
62 this->writeTimeDir()/(
type() +
'_' + zoneName +
".dat")
67 <<
"# Source : " <<
type() <<
nl 68 <<
"# Face zone : " << zoneName <<
nl 69 <<
"# Faces : " << nFaces <<
nl 70 <<
"# Area : " << totArea <<
nl 71 <<
"# Time" <<
tab <<
"mass" <<
tab <<
"massFlowRate" <<
endl;
77 template<
class CloudType>
83 scalar timeNew = time.
value();
84 scalar timeElapsed = timeNew - timeOld_;
86 totalTime_ += timeElapsed;
88 const scalar
alpha = (totalTime_ - timeElapsed)/totalTime_;
89 const scalar
beta = timeElapsed/totalTime_;
91 forAll(faceZoneIDs_, zoneI)
93 massFlowRate_[zoneI] =
94 alpha*massFlowRate_[zoneI] + beta*mass_[zoneI]/timeElapsed;
95 massTotal_[zoneI] += mass_[zoneI];
98 const label proci = Pstream::myProcNo();
104 forAll(faceZoneIDs_, zoneI)
106 const word& zoneName = fzm[faceZoneIDs_[zoneI]].
name();
109 allProcMass[proci] = massTotal_[zoneI];
110 Pstream::gatherList(allProcMass);
111 zoneMassTotal[zoneI] =
112 ListListOps::combine<scalarList>
116 const scalar sumMassTotal =
sum(zoneMassTotal[zoneI]);
119 allProcMassFlowRate[proci] = massFlowRate_[zoneI];
120 Pstream::gatherList(allProcMassFlowRate);
121 zoneMassFlowRate[zoneI] =
122 ListListOps::combine<scalarList>
126 const scalar sumMassFlowRate =
sum(zoneMassFlowRate[zoneI]);
128 Info<<
" " << zoneName
129 <<
": total mass = " << sumMassTotal
130 <<
"; average mass flow rate = " << sumMassFlowRate
133 if (outputFilePtr_.set(zoneI))
135 OFstream& os = outputFilePtr_[zoneI];
136 os << time.
timeName() << token::TAB << sumMassTotal << token::TAB
137 << sumMassFlowRate<<
endl;
144 if (surfaceFormat_ !=
"none")
146 forAll(faceZoneIDs_, zoneI)
148 const faceZone& fZone = fzm[faceZoneIDs_[zoneI]];
155 fZone().meshPoints(),
156 fZone().meshPointMap(),
158 uniqueMeshPointLabels
163 allProcPoints[proci] = uniquePoints;
164 Pstream::gatherList(allProcPoints);
166 faceList faces(fZone().localFaces());
172 allProcFaces[proci] = faces;
173 Pstream::gatherList(allProcFaces);
175 if (Pstream::master())
179 ListListOps::combine<pointField>
187 ListListOps::combine<faceList>
198 this->coeffDict().subOrEmptyDict(
"formatOptions").
199 subOrEmptyDict(surfaceFormat_)
205 this->writeTimeDir(),
210 zoneMassTotal[zoneI],
216 this->writeTimeDir(),
221 zoneMassFlowRate[zoneI],
231 forAll(faceZoneIDs_, zoneI)
233 massFlowRate_[zoneI] = 0.0;
250 template<
class CloudType>
255 const word& modelName
260 surfaceFormat_(this->coeffDict().
lookup(
"surfaceFormat")),
261 resetOnWrite_(this->coeffDict().
lookup(
"resetOnWrite")),
266 log_(this->coeffDict().
lookup(
"log")),
268 timeOld_(owner.mesh().time().value())
271 mass_.setSize(faceZoneNames.
size());
272 massTotal_.setSize(faceZoneNames.
size());
273 massFlowRate_.setSize(faceZoneNames.
size());
275 outputFilePtr_.setSize(faceZoneNames.
size());
283 const word& zoneName = faceZoneNames[i];
290 massTotal_[i].setSize(fz.
size(), 0.0);
291 massFlowRate_[i].setSize(fz.
size(), 0.0);
294 Info<<
" " << zoneName <<
" faces: " << nFaces <<
nl;
296 scalar totArea = 0.0;
300 if (facei < owner.mesh().nInternalFaces())
302 totArea += magSf[fz[j]];
306 label bFacei = facei - owner.mesh().nInternalFaces();
313 || refCast<const coupledPolyPatch>(pp).owner()
323 makeLogFile(zoneName, i, nFaces, totArea);
327 faceZoneIDs_.transfer(zoneIDs);
333 template<
class CloudType>
340 faceZoneIDs_(pff.faceZoneIDs_),
341 surfaceFormat_(pff.surfaceFormat_),
342 resetOnWrite_(pff.resetOnWrite_),
343 totalTime_(pff.totalTime_),
345 massTotal_(pff.massTotal_),
346 massFlowRate_(pff.massFlowRate_),
355 template<
class CloudType>
362 template<
class CloudType>
373 || this->owner().
solution().
transient()
376 const faceZoneMesh& fzm = this->owner().mesh().faceZones();
380 const faceZone& fz = fzm[faceZoneIDs_[i]];
394 mass_[i][
faceId] += p.mass()*p.nParticle();
const labelList & patchID() const
Per boundary face label the patch index.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
label whichFace(const label l) const
Return label of face in patch from global face label.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
void write()
Write post-processing info.
A list of keyword definitions, which are a keyword followed by any number of values (e...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
FacePostProcessing(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Base class for graphics format writing. Entry points are.
const Type & value() const
Return const reference to value.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
virtual ~FacePostProcessing()
Destructor.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
virtual const pointField & points() const
Return raw points.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
virtual void postFace(const parcelType &p, const label facei, bool &keepParticle)
Post-face hook.
const word & name() const
Return name.
label findZoneID(const word &zoneName) const
Find zone index given a name.
stressControl lookup("compactNormalStress") >> compactNormalStress
const Boundary & boundaryField() const
Return const-reference to the boundary field.
A class for handling words, derived from string.
Records particle face quantities on used-specified face zone.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
const globalMeshData & globalData() const
Return parallel info.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Mesh data needed to do the Finite Volume discretisation.
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
const faceZoneMesh & faceZones() const
Return face zone mesh.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Selector class for relaxation factors, solver type and solution.
A subset of mesh faces organised as a primitive patch.
A patch is a list of labels that address the faces in the global face list.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Templated base class for dsmc cloud.
Templated cloud function object base class.
const word & name() const
Return name.
const Time & time() const
Return the top-level database.