33 template<
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);
56 template<
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())
130 template<
class CloudType>
133 const StandardWallInteraction<CloudType>& pim
138 interactionType_(pim.interactionType_),
141 nEscape_(pim.nEscape_),
142 massEscape_(pim.massEscape_),
143 nStick_(pim.nStick_),
144 massStick_(pim.massStick_),
145 injIdToIndex_(pim.injIdToIndex_)
151 template<
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 259 template<
class CloudType>
271 label lsd = nEscape_[patchi].size();
272 npe0[patchi].setSize(lsd,
Zero);
273 mpe0[patchi].setSize(lsd,
Zero);
274 nps0[patchi].setSize(lsd,
Zero);
275 mps0[patchi].setSize(lsd,
Zero);
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 Log_<<
" 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 Log_<<
" 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);
DSMCCloud< dsmcParcel > CloudType
virtual void info()
Write patch interaction info.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
scalar mu_
Restitution coefficient.
virtual void writeFileHeader(Ostream &os)
Output file header information.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< List< label > > nStick_
Number of parcels stuck to patches.
static wordList interactionTypeNames_
constexpr char nl
The newline '\n' character (0x0a)
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Apply velocity correction.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< List< scalar > > massStick_
Mass of parcels stuck to patches.
constexpr char tab
The tab '\t' character(0x09)
List< labelList > labelListList
List of labelList.
virtual void info()
Write patch interaction info.
Templated patch interaction model class.
PatchInteractionModel< CloudType >::interactionType interactionType_
Interaction type.
#define forAll(list, i)
Loop across all elements in list.
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()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
#define Log_
Report write to Foam::Info if the class log switch is true.
List< scalarList > scalarListList
List of scalarList.
A class for handling words, derived from Foam::string.
A cloud is a registry collection of lagrangian particles.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
errorManip< error > abort(error &err)
scalar e_
Elasticity coefficient.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
bool empty() const noexcept
True if the hash table is empty.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
List< List< scalar > > massEscape_
Mass of parcels escaped.
Map< label > injIdToIndex_
InjectorId to index map, when outputting escaped/stick/...
#define WarningInFunction
Report a warning using Foam::Warning.
StandardWallInteraction(const dictionary &dict, CloudType &cloud)
Construct from dictionary.
List< List< label > > nEscape_
Number of parcels escaped.
static void listCombineGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
List< label > labelList
A List of labels.
A patch is a list of labels that address the faces in the global face list.
Templated base class for dsmc cloud.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
static constexpr const zero Zero
Global zero (0)