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;
79 template<
class CloudType>
85 scalar timeNew = time.
value();
86 scalar timeElapsed = timeNew - timeOld_;
88 totalTime_ += timeElapsed;
90 const scalar
alpha = (totalTime_ - timeElapsed)/totalTime_;
91 const scalar
beta = timeElapsed/totalTime_;
93 forAll(faceZoneIDs_, zoneI)
95 massFlowRate_[zoneI] =
96 alpha*massFlowRate_[zoneI] + beta*mass_[zoneI]/timeElapsed;
97 massTotal_[zoneI] += mass_[zoneI];
100 const label proci = Pstream::myProcNo();
106 forAll(faceZoneIDs_, zoneI)
108 const word& zoneName = fzm[faceZoneIDs_[zoneI]].
name();
111 allProcMass[proci] = massTotal_[zoneI];
112 Pstream::gatherList(allProcMass);
113 zoneMassTotal[zoneI] =
114 ListListOps::combine<scalarList>
118 const scalar sumMassTotal =
sum(zoneMassTotal[zoneI]);
121 allProcMassFlowRate[proci] = massFlowRate_[zoneI];
122 Pstream::gatherList(allProcMassFlowRate);
123 zoneMassFlowRate[zoneI] =
124 ListListOps::combine<scalarList>
128 const scalar sumMassFlowRate =
sum(zoneMassFlowRate[zoneI]);
130 Info<<
" " << zoneName
131 <<
": total mass = " << sumMassTotal
132 <<
"; average mass flow rate = " << sumMassFlowRate
135 if (outputFilePtr_.set(zoneI))
137 OFstream& os = outputFilePtr_[zoneI];
138 os << time.
timeName() << token::TAB << sumMassTotal << token::TAB
139 << sumMassFlowRate<<
endl;
146 if (surfaceFormat_ !=
"none")
148 forAll(faceZoneIDs_, zoneI)
150 const faceZone& fZone = fzm[faceZoneIDs_[zoneI]];
157 fZone().meshPoints(),
158 fZone().meshPointMap(),
160 uniqueMeshPointLabels
165 allProcPoints[proci] = uniquePoints;
166 Pstream::gatherList(allProcPoints);
168 faceList faces(fZone().localFaces());
174 allProcFaces[proci] = faces;
175 Pstream::gatherList(allProcFaces);
177 if (Pstream::master())
181 ListListOps::combine<pointField>
189 ListListOps::combine<faceList>
200 this->coeffDict().subOrEmptyDict(
"formatOptions").
201 subOrEmptyDict(surfaceFormat_)
207 this->writeTimeDir(),
212 zoneMassTotal[zoneI],
218 this->writeTimeDir(),
223 zoneMassFlowRate[zoneI],
233 forAll(faceZoneIDs_, zoneI)
235 massFlowRate_[zoneI] = 0.0;
252 template<
class CloudType>
257 const word& modelName
262 surfaceFormat_(this->coeffDict().
lookup(
"surfaceFormat")),
263 resetOnWrite_(this->coeffDict().
lookup(
"resetOnWrite")),
268 log_(this->coeffDict().
lookup(
"log")),
270 timeOld_(owner.mesh().time().value())
273 mass_.setSize(faceZoneNames.
size());
274 massTotal_.setSize(faceZoneNames.
size());
275 massFlowRate_.setSize(faceZoneNames.
size());
277 outputFilePtr_.setSize(faceZoneNames.
size());
285 const word& zoneName = faceZoneNames[i];
292 massTotal_[i].setSize(fz.
size(), 0.0);
293 massFlowRate_[i].setSize(fz.
size(), 0.0);
296 Info<<
" " << zoneName <<
" faces: " << nFaces <<
nl;
298 scalar totArea = 0.0;
302 if (facei < owner.mesh().nInternalFaces())
304 totArea += magSf[fz[j]];
308 label bFacei = facei - owner.mesh().nInternalFaces();
315 || refCast<const coupledPolyPatch>(pp).owner()
325 makeLogFile(zoneName, i, nFaces, totArea);
329 faceZoneIDs_.transfer(zoneIDs);
335 template<
class CloudType>
342 faceZoneIDs_(pff.faceZoneIDs_),
343 surfaceFormat_(pff.surfaceFormat_),
344 resetOnWrite_(pff.resetOnWrite_),
345 totalTime_(pff.totalTime_),
347 massTotal_(pff.massTotal_),
348 massFlowRate_(pff.massFlowRate_),
357 template<
class CloudType>
364 template<
class CloudType>
370 || this->owner().
solution().
transient()
373 const faceZoneMesh& fzm = this->owner().mesh().faceZones();
377 const faceZone& fz = fzm[faceZoneIDs_[i]];
382 if (fz[j] == p.face())
391 mass_[i][
faceId] += p.mass()*p.nParticle();
#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.
const word & name() const
Return name.
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
void write()
Write post-processing info.
A list of keyword definitions, which are a keyword followed by any number of values (e...
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelList & patchID() const
Per boundary face label the patch index.
FacePostProcessing(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Base class for graphics format writing. Entry points are.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
const Time & time() const
Return the top-level database.
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)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
virtual const pointField & points() const
Return raw points.
virtual void postFace(const parcelType &p, bool &keepParticle)
Post-face hook.
stressControl lookup("compactNormalStress") >> compactNormalStress
label findZoneID(const word &zoneName) const
Find zone index given a name.
A class for handling words, derived from string.
Records particle face quantities on used-specified face zone.
const Type & value() const
Return const reference to value.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
const globalMeshData & globalData() const
Return parallel info.
const word & name() const
Return name.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Mesh data needed to do the Finite Volume discretisation.
dimensionedScalar beta("beta", dimless/dimTemperature, laminarTransport)
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.
label whichFace(const label l) const
Return label of face in patch from global face label.