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>
202 this->writeTimeDir(),
207 zoneMassTotal[zoneI],
213 this->writeTimeDir(),
218 zoneMassFlowRate[zoneI],
228 forAll(faceZoneIDs_, zoneI)
230 massFlowRate_[zoneI] = 0.0;
247 template<
class CloudType>
252 const word& modelName
257 surfaceFormat_(this->coeffDict().
lookup(
"surfaceFormat")),
258 resetOnWrite_(this->coeffDict().
lookup(
"resetOnWrite")),
263 log_(this->coeffDict().
lookup(
"log")),
265 timeOld_(owner.mesh().time().value())
268 mass_.setSize(faceZoneNames.
size());
269 massTotal_.setSize(faceZoneNames.
size());
270 massFlowRate_.setSize(faceZoneNames.
size());
272 outputFilePtr_.setSize(faceZoneNames.
size());
280 const word& zoneName = faceZoneNames[i];
287 massTotal_[i].setSize(fz.
size(), 0.0);
288 massFlowRate_[i].setSize(fz.
size(), 0.0);
291 Info<<
" " << zoneName <<
" faces: " << nFaces <<
nl;
293 scalar totArea = 0.0;
297 if (facei < owner.mesh().nInternalFaces())
299 totArea += magSf[fz[j]];
303 label bFacei = facei - owner.mesh().nInternalFaces();
310 || refCast<const coupledPolyPatch>(pp).owner()
320 makeLogFile(zoneName, i, nFaces, totArea);
324 faceZoneIDs_.transfer(zoneIDs);
330 template<
class CloudType>
337 faceZoneIDs_(pff.faceZoneIDs_),
338 surfaceFormat_(pff.surfaceFormat_),
339 resetOnWrite_(pff.resetOnWrite_),
340 totalTime_(pff.totalTime_),
342 massTotal_(pff.massTotal_),
343 massFlowRate_(pff.massFlowRate_),
352 template<
class CloudType>
359 template<
class CloudType>
365 || this->owner().
solution().
transient()
368 const faceZoneMesh& fzm = this->owner().mesh().faceZones();
372 const faceZone& fz = fzm[faceZoneIDs_[i]];
377 if (fz[j] == p.face())
386 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)
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.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
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.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
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.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
A patch is a list of labels that address the faces in the global face list.
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.