35 template<
class CloudType>
49 Info<<
"Creating output file." <<
endl;
52 if (Pstream::master())
55 mkDir(this->writeTimeDir());
63 this->writeTimeDir()/(
type() +
'_' + zoneName +
".dat")
68 <<
"# Source : " <<
type() <<
nl
69 <<
"# Face zone : " << zoneName <<
nl
70 <<
"# Faces : " << nFaces <<
nl
71 <<
"# Area : " << totArea <<
nl
72 <<
"# Time" <<
tab <<
"mass" <<
tab <<
"massFlowRate" <<
endl;
80 template<
class CloudType>
86 scalar timeNew = time.
value();
87 scalar timeElapsed = timeNew - timeOld_;
89 totalTime_ += timeElapsed;
91 const scalar
alpha = (totalTime_ - timeElapsed)/totalTime_;
92 const scalar beta = timeElapsed/totalTime_;
94 forAll(faceZoneIndices_, zoneI)
96 massFlowRate_[zoneI] =
97 alpha*massFlowRate_[zoneI] + beta*mass_[zoneI]/timeElapsed;
98 massTotal_[zoneI] += mass_[zoneI];
101 const label proci = Pstream::myProcNo();
107 forAll(faceZoneIndices_, zoneI)
109 const word& zoneName = mfz[faceZoneIndices_[zoneI]].
name();
112 allProcMass[proci] = massTotal_[zoneI];
113 Pstream::gatherList(allProcMass);
114 zoneMassTotal[zoneI] =
115 ListListOps::combine<scalarList>
119 const scalar sumMassTotal =
sum(zoneMassTotal[zoneI]);
122 allProcMassFlowRate[proci] = massFlowRate_[zoneI];
123 Pstream::gatherList(allProcMassFlowRate);
124 zoneMassFlowRate[zoneI] =
125 ListListOps::combine<scalarList>
129 const scalar sumMassFlowRate =
sum(zoneMassFlowRate[zoneI]);
131 Info<<
" " << zoneName
132 <<
": total mass = " << sumMassTotal
133 <<
"; average mass flow rate = " << sumMassFlowRate
136 if (outputFilePtr_.set(zoneI))
138 OFstream& os = outputFilePtr_[zoneI];
139 os << time.
name() << token::TAB << sumMassTotal << token::TAB
140 << sumMassFlowRate<<
endl;
147 if (surfaceFormat_ !=
"none")
149 forAll(faceZoneIndices_, zoneI)
151 const faceZone& fZone = mfz[faceZoneIndices_[zoneI]];
161 uniqueMeshPointLabels
166 allProcPoints[proci] = uniquePoints;
167 Pstream::gatherList(allProcPoints);
175 allProcFaces[proci] = faces;
176 Pstream::gatherList(allProcFaces);
178 if (Pstream::master())
182 ListListOps::combine<pointField>
190 ListListOps::combine<faceList>
203 this->writeTimeDir(),
209 zoneMassTotal[zoneI],
211 zoneMassFlowRate[zoneI]
220 forAll(faceZoneIndices_, zoneI)
222 massFlowRate_[zoneI] = 0.0;
239 template<
class CloudType>
244 const word& modelName
249 surfaceFormat_(this->coeffDict().lookup(
"surfaceFormat")),
250 resetOnWrite_(this->coeffDict().lookup(
"resetOnWrite")),
255 log_(this->coeffDict().lookup(
"log")),
257 timeOld_(owner.mesh().time().value())
264 outputFilePtr_.setSize(faceZoneNames.
size());
272 const word& zoneName = faceZoneNames[i];
283 Info<<
" " << zoneName <<
" faces: " << nFaces <<
nl;
285 scalar totArea = 0.0;
291 totArea += magSf[fz[j]];
302 || refCast<const coupledPolyPatch>(pp).owner()
312 makeLogFile(zoneName, i, nFaces, totArea);
322 template<
class CloudType>
329 faceZoneIndices_(pff.faceZoneIndices_),
330 surfaceFormat_(pff.surfaceFormat_),
331 resetOnWrite_(pff.resetOnWrite_),
332 totalTime_(pff.totalTime_),
334 massTotal_(pff.massTotal_),
335 massFlowRate_(pff.massFlowRate_),
344 template<
class CloudType>
351 template<
class CloudType>
357 || this->owner().
solution().
transient()
362 forAll(faceZoneIndices_, i)
364 const faceZone& fz = mfz[faceZoneIndices_[i]];
369 if (fz[j] ==
p.face())
378 mass_[i][
faceId] +=
p.mass()*
p.nParticle();
385 template<
class CloudType>
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
Templated cloud function object base class.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
const fvMesh & mesh() const
Return references to the mesh.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Records particle face quantities on used-specified face zone.
virtual void postPatch(const parcelType &p, const polyPatch &pp)
Post-patch hook.
virtual void preFace(const parcelType &p)
Post-face hook.
void write()
Write post-processing info.
virtual ~FacePostProcessing()
Destructor.
FacePostProcessing(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const word & name() const
Return name.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
label findIndex(const word &key) const
Return the index of the given the key or -1 if not found.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const MeshType & mesh() const
Return the mesh reference.
const word & name() const
Return name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keyword definitions, which are a keyword followed by any number of values (e....
const Type & value() const
Return const reference to value.
const word & name() const
Return const reference to name.
A subset of mesh faces organised as a primitive patch.
const primitiveFacePatch & patch() const
Return reference to primitive patch.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
const polyMesh & mesh() const
Return reference to polyMesh.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
const labelList & patchIndices() const
Boundary face patch indices.
const globalMeshData & globalData() const
Return parallel info.
const faceZoneList & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
label whichFace(const label l) const
Return label of face in patch from global face label.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
label nInternalFaces() const
Selector class for relaxation factors, solver type and solution.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
A class for handling words, derived from string.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
void inplaceRenumber(const labelUList &oldToNew, ListType &)
Inplace renumber the values of a list.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.