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 = mfz[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 = mfz[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(),
208 zoneMassTotal[zoneI],
210 zoneMassFlowRate[zoneI]
219 forAll(faceZoneIDs_, zoneI)
221 massFlowRate_[zoneI] = 0.0;
238 template<
class CloudType>
243 const word& modelName
248 surfaceFormat_(this->coeffDict().
lookup(
"surfaceFormat")),
249 resetOnWrite_(this->coeffDict().
lookup(
"resetOnWrite")),
254 log_(this->coeffDict().
lookup(
"log")),
256 timeOld_(owner.mesh().time().value())
259 mass_.setSize(faceZoneNames.
size());
260 massTotal_.setSize(faceZoneNames.
size());
261 massFlowRate_.setSize(faceZoneNames.
size());
263 outputFilePtr_.setSize(faceZoneNames.
size());
271 const word& zoneName = faceZoneNames[i];
278 massTotal_[i].setSize(fz.
size(), 0.0);
279 massFlowRate_[i].setSize(fz.
size(), 0.0);
282 Info<<
" " << zoneName <<
" faces: " << nFaces <<
nl;
284 scalar totArea = 0.0;
288 if (facei < owner.mesh().nInternalFaces())
290 totArea += magSf[fz[j]];
294 label bFacei = facei - owner.mesh().nInternalFaces();
301 || refCast<const coupledPolyPatch>(pp).owner()
311 makeLogFile(zoneName, i, nFaces, totArea);
315 faceZoneIDs_.transfer(zoneIDs);
321 template<
class CloudType>
328 faceZoneIDs_(pff.faceZoneIDs_),
329 surfaceFormat_(pff.surfaceFormat_),
330 resetOnWrite_(pff.resetOnWrite_),
331 totalTime_(pff.totalTime_),
333 massTotal_(pff.massTotal_),
334 massFlowRate_(pff.massFlowRate_),
343 template<
class CloudType>
350 template<
class CloudType>
356 || this->owner().
solution().
transient()
363 const faceZone& fz = mfz[faceZoneIDs_[i]];
368 if (fz[j] == p.face())
377 mass_[i][
faceId] += p.mass()*p.nParticle();
label findZoneID(const word &zoneName) const
Find zone index given a name.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > 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.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
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...
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void size(const label)
Override size to be inconsistent with allocated storage.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
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.
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
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
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.
const meshFaceZones & faceZones() const
Return face zones.
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.
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.