36 template<
class CloudType>
50 if (Pstream::master())
53 mkDir(this->writeTimeDir());
61 this->writeTimeDir()/(
type() +
'_' + zoneName +
".dat")
66 <<
"# Source : " <<
type() <<
nl 67 <<
"# Face zone : " << zoneName <<
nl 68 <<
"# Faces : " << nFaces <<
nl 69 <<
"# Area : " << totArea <<
nl 70 <<
"# Time" <<
tab <<
"nParcels" <<
tab <<
"mass" <<
endl;
78 template<
class CloudType>
81 const typename parcelType::trackingData&
td 84 Log_<< this->modelName() <<
" output:" <<
nl;
91 const word& zoneName = fzm[faceZoneIDs_[i]].
name();
96 Log_<<
" faceZone " << zoneName
97 <<
": removed " << zoneNParcels
98 <<
" parcels with mass " << zoneMass
106 template<
class CloudType>
109 const fvMesh&
mesh = this->owner().mesh();
110 const Time& time =
mesh.time();
113 List<scalar> allZoneMass(faceZoneIDs_.size(), 0.0);
114 List<label> allZoneNParcels(faceZoneIDs_.size(), 0);
118 allZoneMass[i] =
returnReduce(mass_[i], sumOp<scalar>());
119 allZoneNParcels[i] =
returnReduce(nParcels_[i], sumOp<label>());
121 if (outputFilePtr_.set(i))
123 OFstream&
os = outputFilePtr_[i];
124 os << time.timeName() << token::TAB
125 << allZoneNParcels[i] << token::TAB
126 << allZoneMass[i] <<
endl;
141 this->setModelProperty(
"mass", allZoneMass);
142 this->setModelProperty(
"nParcels", allZoneNParcels);
148 template<
class CloudType>
153 const word& modelName
160 typeId_(this->coeffDict().template getOrDefault<label>(
"parcelType", -1)),
161 logToFile_(this->coeffDict().getBool(
"log")),
162 resetOnWrite_(this->coeffDict().getBool(
"resetOnWrite")),
163 resetOnStart_(this->coeffDict().getBool(
"resetOnStart")),
177 outputFilePtr_.setSize(faceZoneNames.
size());
186 const word& zoneName = faceZoneNames[i];
187 label zonei = fzm.findZoneID(zoneName);
192 const faceZone& fz = fzm[zonei];
195 Info<<
" " << zoneName <<
" faces: " << nFaces <<
nl;
197 scalar totArea = 0.0;
198 for (
const label facei : fz)
202 totArea += magSf[facei];
206 const label patchi =
pbm.patchID(facei);
207 const polyPatch&
pp =
pbm[patchi];
211 !magSf.boundaryField()[patchi].coupled()
212 || refCast<const coupledPolyPatch>(
pp).
owner()
215 label localFacei =
pp.whichFace(facei);
216 totArea += magSf.boundaryField()[patchi][localFacei];
222 makeLogFile(zoneName, i, nFaces, totArea);
230 template<
class CloudType>
237 faceZoneIDs_(rpf.faceZoneIDs_),
238 nParcels_(rpf.nParcels_),
240 typeId_(rpf.typeId_),
241 logToFile_(rpf.logToFile_),
242 resetOnWrite_(rpf.resetOnWrite_),
243 resetOnStart_(rpf.resetOnStart_),
250 template<
class CloudType>
254 const typename parcelType::trackingData&
td 257 bool keepParticle =
true;
259 if ((typeId_ >= 0) && (
p.typeId() != typeId_))
267 this->owner().solution().output()
268 || this->owner().solution().transient()
275 const faceZone& fz = fzm[faceZoneIDs_[i]];
276 if (fz.found(
p.face()))
279 mass_[i] +=
p.mass()*
p.nParticle();
280 keepParticle =
false;
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
const labelIOList & zoneIDs
Removes parcels that hit user-specified face zone faces.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const word & name() const noexcept
Return the object name.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr char tab
The tab '\t' character(0x09)
Lookup type of boundary radiation properties.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
const CloudType & owner() const
Return const access to the owner cloud.
#define forAll(list, i)
Loop across all elements in list.
void setSize(const label n)
Alias for resize()
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
#define Log_
Report write to Foam::Info if the class log switch is true.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
label nInternalFaces() const noexcept
Number of internal faces.
bool getModelProperty(const word &entryName, Type &value) const
Retrieve generic property from the sub-model.
virtual void postEvolve(const typename parcelType::trackingData &td)
Post-evolve hook.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
RemoveParcels(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
#define DebugInfo
Report an information message using Foam::Info.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
virtual bool postFace(const parcelType &p, const typename parcelType::trackingData &td)
Post-face hook.
OBJstream os(runTime.globalPath()/outputName)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
const fvMesh & mesh() const
Return reference to the mesh.
Mesh data needed to do the Finite Volume discretisation.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
return returnReduce(nRefine-oldNRefine, sumOp< label >())
void write()
Write post-processing info.
messageStream Info
Information stream (stdout output on master, null elsewhere)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Templated base class for dsmc cloud.
Templated cloud function object base class.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())