33template<
class CloudType>
40 const word& patchName = mesh_.boundary()[patchi].name();
42 forAll(nEscape_[patchi], injectori)
45 this->writeTabbed(
os, patchName +
"_nEscape_" + suffix);
46 this->writeTabbed(
os, patchName +
"_massEscape_" + suffix);
47 this->writeTabbed(
os, patchName +
"_nStick_" + suffix);
48 this->writeTabbed(
os, patchName +
"_massStick_" + suffix);
56template<
class CloudType>
67 this->wordToInteractionType(this->coeffDict().getWord(
"type"))
72 massEscape_(nEscape_.size()),
73 nStick_(nEscape_.size()),
74 massStick_(nEscape_.size()),
77 const bool outputByInjectorId =
84 const word interactionTypeName(this->
coeffDict().getWord(
"type"));
87 <<
"Unknown interaction result type "
88 << interactionTypeName
105 label nInjectors = 0;
106 if (outputByInjectorId)
108 for (
const auto& inj :
cloud.injectors())
130template<
class CloudType>
138 interactionType_(pim.interactionType_),
141 nEscape_(pim.nEscape_),
142 massEscape_(pim.massEscape_),
143 nStick_(pim.nStick_),
144 massStick_(pim.massStick_),
145 injIdToIndex_(pim.injIdToIndex_)
151template<
class CloudType>
161 if (isA<wallPolyPatch>(pp))
167 ? injIdToIndex_.lookup(
p.typeId(), 0)
171 switch (interactionType_)
179 keepParticle =
false;
183 const scalar dm =
p.nParticle()*
p.mass();
185 nEscape_[pp.
index()][idx]++;
186 massEscape_[pp.
index()][idx] += dm;
195 const scalar dm =
p.nParticle()*
p.mass();
197 nStick_[pp.
index()][idx]++;
198 massStick_[pp.
index()][idx] += dm;
209 this->owner().patchData(
p, pp, nw, Up);
214 if (
mag(Up) > 0 &&
mag(
U) < this->Urmax())
217 <<
"Particle U the same as patch "
218 <<
" The particle has been removed" <<
nl <<
endl;
220 keepParticle =
false;
231 U -= (1.0 + e_)*Un*nw;
245 <<
"Unknown interaction type "
246 << this->interactionTypeToWord(interactionType_)
247 <<
"(" << interactionType_ <<
")" <<
endl
259template<
class CloudType>
271 label lsd = nEscape_[patchi].size();
278 this->getModelProperty(
"nEscape", npe0);
279 this->getModelProperty(
"massEscape", mpe0);
280 this->getModelProperty(
"nStick", nps0);
281 this->getModelProperty(
"massStick", mps0);
289 npe[i] = npe[i] + npe0[i];
296 mpe[i] = mpe[i] + mpe0[i];
303 nps[i] = nps[i] + nps0[i];
310 mps[i] = mps[i] + mps0[i];
313 if (injIdToIndex_.size())
317 labelList indexToInjector(injIdToIndex_.size());
320 indexToInjector[iter.val()] = iter.key();
325 forAll(mpe[patchi], indexi)
327 const word& patchName = mesh_.boundary()[patchi].name() ;
329 os <<
" Parcel fate: patch " << patchName
330 <<
" (number, mass)" <<
nl
331 <<
" - escape (injector " << indexToInjector[indexi]
332 <<
") = " << npe[patchi][indexi]
333 <<
", " << mpe[patchi][indexi] <<
nl
334 <<
" - stick (injector " << indexToInjector[indexi]
335 <<
") = " << nps[patchi][indexi]
336 <<
", " << mps[patchi][indexi] <<
nl;
339 <<
tab << npe[patchi][indexi] <<
tab << mpe[patchi][indexi]
340 <<
tab << nps[patchi][indexi] <<
tab << mps[patchi][indexi];
344 this->file() <<
endl;
350 const word& patchName = mesh_.boundary()[patchi].name();
352 os <<
" Parcel fate: patch (number, mass) "
355 << npe[patchi][0] <<
", " << mpe[patchi][0] <<
nl
357 << nps[patchi][0] <<
", " << mps[patchi][0] <<
nl;
360 <<
tab << npe[patchi][0] <<
tab << mpe[patchi][0]
361 <<
tab << nps[patchi][0] <<
tab << mps[patchi][0];
364 this->file() <<
endl;
367 if (this->writeTime())
369 this->setModelProperty(
"nEscape", npe);
370 this->setModelProperty(
"massEscape", mpe);
371 this->setModelProperty(
"nStick", nps);
372 this->setModelProperty(
"massStick", mps);
Templated base class for dsmc cloud.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
bool empty() const noexcept
True if the hash table is empty.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
void setSize(const label n)
Alias for resize()
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Templated patch interaction model class.
static wordList interactionTypeNames_
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
virtual void correct()
Solve the turbulence equations and correct the turbulence viscosity.
List< List< scalar > > massStick_
Mass of parcels stuck to patches.
List< List< label > > nStick_
Number of parcels stuck to patches.
scalar mu_
Restitution coefficient.
Map< label > injIdToIndex_
InjectorId to index map, when outputting escaped/stick/...
List< List< label > > nEscape_
Number of parcels escaped.
scalar e_
Elasticity coefficient.
virtual void writeFileHeader(Ostream &os)
Output file header information.
List< List< scalar > > massEscape_
Mass of parcels escaped.
PatchInteractionModel< CloudType >::interactionType interactionType_
Interaction type.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A cloud is a registry collection of lagrangian particles.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
InfoProxy< ensightCells > info() const
Return info proxy.
label index() const noexcept
The index of this patch in the boundaryMesh.
A patch is a list of labels that address the faces in the global face list.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const label nNonProcessor
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
constexpr char tab
The tab '\t' character(0x09)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.