37 template<
class CloudType>
51 Info<<
"Creating output file." <<
endl;
54 if (Pstream::master())
57 mkDir(this->writeTimeDir());
65 this->writeTimeDir()/(
type() +
'_' + zoneName +
".dat")
70 <<
"# Source : " <<
type() <<
nl
71 <<
"# Face zone : " << zoneName <<
nl
72 <<
"# Faces : " << nFaces <<
nl
73 <<
"# Area : " << totArea <<
nl
74 <<
"# Time" <<
tab <<
"mass" <<
tab <<
"massFlowRate" <<
endl;
82 template<
class CloudType>
88 scalar timeNew = time.
value();
89 scalar timeElapsed = timeNew - timeOld_;
91 totalTime_ += timeElapsed;
93 const scalar
alpha = (totalTime_ - timeElapsed)/totalTime_;
94 const scalar
beta = timeElapsed/totalTime_;
96 forAll(faceZoneIDs_, zoneI)
98 massFlowRate_[zoneI] =
99 alpha*massFlowRate_[zoneI] +
beta*mass_[zoneI]/timeElapsed;
100 massTotal_[zoneI] += mass_[zoneI];
103 const label proci = Pstream::myProcNo();
109 forAll(faceZoneIDs_, zoneI)
111 const word& zoneName = fzm[faceZoneIDs_[zoneI]].name();
114 allProcMass[proci] = massTotal_[zoneI];
115 Pstream::gatherList(allProcMass);
116 zoneMassTotal[zoneI] =
117 ListListOps::combine<scalarList>
121 const scalar sumMassTotal =
sum(zoneMassTotal[zoneI]);
124 allProcMassFlowRate[proci] = massFlowRate_[zoneI];
125 Pstream::gatherList(allProcMassFlowRate);
126 zoneMassFlowRate[zoneI] =
127 ListListOps::combine<scalarList>
131 const scalar sumMassFlowRate =
sum(zoneMassFlowRate[zoneI]);
133 Info<<
" " << zoneName
134 <<
": total mass = " << sumMassTotal
135 <<
"; average mass flow rate = " << sumMassFlowRate
138 if (outputFilePtr_.set(zoneI))
140 OFstream& os = outputFilePtr_[zoneI];
141 os << time.
timeName() << token::TAB << sumMassTotal << token::TAB
142 << sumMassFlowRate<<
endl;
149 if (surfaceFormat_ !=
"none")
151 forAll(faceZoneIDs_, zoneI)
153 const faceZone& fZone = fzm[faceZoneIDs_[zoneI]];
158 mesh.globalData().mergePoints
160 fZone().meshPoints(),
161 fZone().meshPointMap(),
163 uniqueMeshPointLabels
168 allProcPoints[proci] = uniquePoints;
169 Pstream::gatherList(allProcPoints);
171 faceList faces(fZone().localFaces());
177 allProcFaces[proci] = faces;
178 Pstream::gatherList(allProcFaces);
180 if (Pstream::master())
184 ListListOps::combine<pointField>
192 ListListOps::combine<faceList>
201 this->coeffDict().subOrEmptyDict(
"formatOptions")
202 .subOrEmptyDict(surfaceFormat_)
214 (this->writeTimeDir() / fZone.
name()),
220 writer->
write(
"massFlowRate", 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().getBool(
"resetOnWrite")),
259 log_(this->coeffDict().getBool(
"log")),
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];
286 mass_[i].setSize(fz.size(), 0.0);
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;
299 totArea += magSf[fz[j]];
304 label patchi = pbm.
patchID()[bFacei];
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_),
341 totalTime_(pff.totalTime_),
343 massTotal_(pff.massTotal_),
344 massFlowRate_(pff.massFlowRate_),
352 template<
class CloudType>
358 || this->owner().
solution().
transient()
365 const faceZone& fz = fzm[faceZoneIDs_[i]];
370 if (fz[j] ==
p.face())
379 mass_[i][
faceId] +=
p.mass()*
p.nParticle();