33template<
class CloudType>
40 const word& patchName =
mesh_.boundary()[patchi].name();
56template<
class CloudType>
63 PatchInteractionModel<CloudType>(
dict, cloud, typeName),
67 this->wordToInteractionType(this->coeffDict().getWord(
"type"))
71 nEscape_(mesh_.boundaryMesh().nNonProcessor()),
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>
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_),
151template<
class CloudType>
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();
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);
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const CloudType & owner() const
Return const access to the owner cloud.
virtual bool writeTime() const
Flag to indicate when to write a property.
void setSize(label n)
Alias for resize().
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const scalar & Urmax() const
Return Urmax.
static wordList interactionTypeNames_
PatchInteractionModel(CloudType &owner)
Construct null from owner.
virtual void info()
Write patch interaction info.
static interactionType wordToInteractionType(const word &itWord)
Convert word to interaction result.
virtual void writeFileHeader(Ostream &os)
Output file header information.
static word interactionTypeToWord(const interactionType &itEnum)
Convert interaction result to word.
static void listGather(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather (reduce) list elements, applying bop to each list element.
List< List< scalar > > massStick_
Mass of parcels stuck to patches.
List< List< label > > nStick_
Number of parcels stuck to patches.
StandardWallInteraction(const dictionary &dict, CloudType &cloud)
Construct from dictionary.
scalar mu_
The unity minus the 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 bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Apply velocity correction.
virtual void info()
Write patch interaction info.
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
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
virtual OFstream & file()
Return access to the file (if only 1).
A patch is a list of labels that address the faces in the global face list.
bool getModelProperty(const word &entryName, Type &value) const
Retrieve generic property from the sub-model.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
const dictionary & dict() const
Return const access to the cloud dictionary.
void setModelProperty(const word &entryName, const Type &value)
Add generic property to the sub-model.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define Log_
Report write to Foam::Info if the class log switch is true.
#define WarningInFunction
Report a warning using Foam::Warning.
List< scalarList > scalarListList
List of scalarList.
DSMCCloud< dsmcParcel > CloudType
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::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.