Go to the documentation of this file.
33 template<
class CloudType>
37 { interactionType::STICK,
"stick" },
38 { interactionType::ESCAPE,
"escape" },
39 { interactionType::REBOUND,
"rebound" },
45 template<
class CloudType>
49 const label localZonei
52 if (!faceZoneBBs_[localZonei].contains(
p.position()))
58 if ((
p.d() > dMax_) || (
p.d() < dMin_))
67 template<
class CloudType>
70 const fvMesh&
mesh = this->owner().
mesh();
76 const label
nZones = faceZoneIDs_.size();
81 this->getModelProperty(
"nEscape", npe0);
82 this->getModelProperty(
"nStick", nps0);
83 this->getModelProperty(
"nRebound", npr0);
91 npe[i] = npe[i] + npe0[i];
92 nps[i] = nps[i] + nps0[i];
93 npr[i] = npr[i] + npr0[i];
100 const label zonei = faceZoneIDs_[i];
101 Info<<
" Zone : " << fzm[zonei].name() <<
nl
102 <<
" Escape : " << npe[i] <<
nl
103 <<
" Stick : " << nps[i] <<
nl
104 <<
" Rebound : " << npr[i] <<
nl;
106 if (this->writeToFile())
108 auto&
os = filePtrs_[i];
110 writeCurrentTime(
os);
113 os <<
tab << scalar(npe[i])
114 <<
tab << scalar(nps[i])
115 <<
tab << scalar(npr[i])
122 this->setModelProperty(
"nEscape", npe);
123 this->setModelProperty(
"nStick", nps);
124 this->setModelProperty(
"nRebound", npr);
126 nEscapeParticles_ =
Zero;
127 nStickParticles_ =
Zero;
128 nReboundParticles_ =
Zero;
134 template<
class CloudType>
139 const word& modelName
143 functionObjects::writeFile
152 faceZoneInteraction_(),
156 nReboundParticles_(),
157 dMin_(this->coeffDict().getOrDefault(
"dMin", -GREAT)),
158 dMax_(this->coeffDict().getOrDefault(
"dMax", GREAT))
165 filePtrs_.setSize(nameAndInteraction.size());
167 faceZoneBBs_.setSize(nameAndInteraction.size());
168 faceZoneInteraction_.
setSize(nameAndInteraction.size());
176 for (
const auto& zoneInfo : nameAndInteraction)
178 const word& zoneName = zoneInfo.first();
187 Info<<
" " << zoneName <<
" faces: " << nFaces <<
nl;
190 faceZoneInteraction_[nZone] =
194 auto& bb = faceZoneBBs_[nZone];
195 for (
const label facei : fz)
197 for (
const label fpi : faces[facei])
222 filePtrs_[nZone] <<
nl;
229 <<
"Unable to find faceZone " << zoneName
230 <<
" - removing" <<
endl;
235 filePtrs_.setSize(nZone);
236 faceZoneBBs_.setSize(nZone);
237 faceZoneInteraction_.
setSize(nZone);
244 template<
class CloudType>
251 functionObjects::writeFile(pfi),
252 faceZoneIDs_(pfi.faceZoneIDs_),
253 faceZoneBBs_(pfi.faceZoneBBs_),
255 nEscapeParticles_(pfi.nEscapeParticles_),
256 nStickParticles_(pfi.nStickParticles_),
257 nReboundParticles_(pfi.nReboundParticles_),
265 template<
class CloudType>
276 if (!processParticle(
p, i))
281 const label zonei = faceZoneIDs_[i];
283 const label localFacei = fzm[zonei].find(
p.face());
285 if (localFacei != -1)
287 const label facei = fzm[zonei][localFacei];
289 switch (faceZoneInteraction_[i])
291 case interactionType::ESCAPE:
293 keepParticle =
false;
294 ++nEscapeParticles_[i];
297 case interactionType::STICK:
299 auto& pRef =
const_cast<parcelType&
>(
p);
302 ++nStickParticles_[i];
305 case interactionType::REBOUND:
307 const face&
f = this->owner().
mesh().
faces()[facei];
308 const auto n =
f.unitNormal(this->owner().
mesh().
points());
310 auto& pRef =
const_cast<parcelType&
>(
p);
311 pRef.U() -= 2*
n*(pRef.U() &
n);
312 ++nReboundParticles_[i];
318 <<
"Unhandled enumeration "
319 << interactionTypeNames_[faceZoneInteraction_[i]]
List< label > labelList
A List of labels.
virtual const pointField & points() const
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
static constexpr const zero Zero
Ostream & endl(Ostream &os)
const CloudType & owner() const
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
const labelIOList & zoneIDs
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
A subset of mesh faces organised as a primitive patch.
const fvMesh & mesh() const
void setSize(const label n)
void transfer(List< T > &list)
const faceZoneMesh & faceZones() const noexcept
FaceInteraction(const dictionary &dict, CloudType &owner, const word &modelName)
virtual void postFace(const parcelType &p, bool &keepParticle)
Lookup type of boundary radiation properties.
Templated base class for dsmc cloud.
bool processParticle(const parcelType &p, const label localZonei)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
reduce(hasMovingMesh, orOp< bool >())
OBJstream os(runTime.globalPath()/outputName)
const dictionary & coeffDict() const
Mesh data needed to do the Finite Volume discretisation.
errorManip< error > abort(error &err)
label findZoneID(const word &zoneName) const
virtual const faceList & faces() const
#define FatalErrorInFunction
virtual void writeCommented(Ostream &os, const string &str) const
virtual autoPtr< OFstream > createFile(const word &name, scalar timeValue) const
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Face zone-based particle interactions.
Templated cloud function object base class.
fileName::Type type(const fileName &name, const bool followLink=true)
static const Enum< interactionType > interactionTypeNames_
Base class for writing single files from the function objects.
A face is a list of labels corresponding to mesh vertices.
virtual bool writeToFile() const
#define WarningInFunction
virtual void writeTabbed(Ostream &os, const string &str) const