36 public Tuple2<wordRe, dictionary>
75 template<
class CloudType>
83 patchInteractionTypes_
85 this->owner().mesh().boundaryMesh().size(),
88 patchEs_(this->owner().mesh().boundaryMesh().size(), NaN),
89 patchMus_(this->owner().mesh().boundaryMesh().size(), NaN),
90 nEscape_(this->owner().mesh().boundaryMesh().size(), 0),
91 massEscape_(this->owner().mesh().boundaryMesh().size(), scalar(0)),
92 nStick_(this->owner().mesh().boundaryMesh().size(), 0),
93 massStick_(this->owner().mesh().boundaryMesh().size(), scalar(0)),
94 writeFields_(this->coeffDict().lookupOrDefault(
"writeFields", false)),
95 massEscapePtr_(nullptr),
96 massStickPtr_(nullptr)
102 const word massEscapeName(this->
owner().
name() +
":massEscape");
103 const word massStickName(this->
owner().
name() +
":massStick");
105 Info<<
" Interaction fields will be written to " << massEscapeName
106 <<
" and " << massStickName <<
endl;
113 Info<<
" Interaction fields will not be written" <<
endl;
129 forAll(patchNameAndDicts, dicti)
134 patchNameAndDicts[dicti].
second()
140 wordList unspecifiedNonConstraintPatches;
145 const bool havePatchDict = patchesDict.
found(patchName);
147 const bool patchIsConstraint =
151 if (!havePatchDict && patchIsConstraint)
153 patchInteractionTypes_[
patchi] =
159 if (!havePatchDict && !patchIsConstraint)
169 if (havePatchDict && patchIsConstraint)
171 if (!patchDict.
found(
"patchType"))
173 patchInteractionTypes_[
patchi] =
183 <<
"Type " << patchType
184 <<
" specified for patch " << patchName
185 <<
" does not match the patch type "
197 <<
"Unknown patch interaction type "
198 << itName <<
" for patch " << patchName
199 <<
". Valid types are:"
204 patchInteractionTypes_[
patchi] = it;
214 if (!unspecifiedNonConstraintPatches.
empty())
217 <<
"No interaction type was specified for non-constraint patches: "
218 << unspecifiedNonConstraintPatches
224 template<
class CloudType>
231 patchInteractionTypes_(pim.patchInteractionTypes_),
232 patchEs_(pim.patchEs_),
233 patchMus_(pim.patchMus_),
234 nEscape_(pim.nEscape_),
235 massEscape_(pim.massEscape_),
236 nStick_(pim.nStick_),
237 massStick_(pim.massStick_),
238 writeFields_(pim.writeFields_),
239 massEscapePtr_(nullptr),
240 massStickPtr_(nullptr)
246 template<
class CloudType>
253 template<
class CloudType>
256 if (!massEscapePtr_.valid())
266 this->owner().
name() +
":massEscape",
278 return massEscapePtr_();
282 template<
class CloudType>
285 if (!massStickPtr_.valid())
295 this->owner().
name() +
":massStick",
307 return massStickPtr_();
311 template<
class CloudType>
321 if (isA<processorPolyPatch>(pp))
326 switch (patchInteractionTypes_[
patchi])
335 const scalar dm =
p.mass()*
p.nParticle();
337 keepParticle =
false;
341 massEscape_[
patchi] += dm;
346 massEscape().boundaryFieldRef()[
patchi][patchFacei] += dm;
354 const scalar dm =
p.mass()*
p.nParticle();
365 massStick().boundaryFieldRef()[
patchi][patchFacei] += dm;
377 this->owner().patchData(
p, pp, nw, Up);
382 const scalar Un =
p.U() & nw;
383 const vector Ut =
p.U() - Un*nw;
387 p.U() -= (1 + patchEs_[
patchi])*Un*nw;
408 template<
class CloudType>
419 this->getModelProperty(
"nEscape", npe0);
422 this->getModelProperty(
"massEscape", mpe0);
425 this->getModelProperty(
"nStick", nps0);
428 this->getModelProperty(
"massStick", mps0);
451 patchInteractionTypes_[
patchi]
455 os <<
" Parcel fate (number, mass) : patch "
456 << this->owner().mesh().boundaryMesh()[
patchi].
name() <<
nl
457 <<
" - escape = " << npe[
patchi]
459 <<
" - stick = " << nps[
patchi]
464 if (this->writeTime())
466 this->setModelProperty(
"nEscape", npe);
469 this->setModelProperty(
"massEscape", mpe);
470 massEscape_ = scalar(0);
472 this->setModelProperty(
"nStick", nps);
475 this->setModelProperty(
"massStick", mps);
476 massStick_ = scalar(0);
#define forAll(list, i)
Loop across all elements in list.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
const fvMesh & mesh() const
Return references to the mesh.
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual const fileName & name() const
Return the name of the stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
Patch interaction specified on a patch-by-patch basis.
virtual void info(Ostream &os)
Write patch interaction info to stream.
LocalInteraction(const dictionary &dict, CloudType &owner)
Construct from dictionary.
volScalarField & massStick()
Return access to the massStick field.
volScalarField & massEscape()
Return access to the massEscape field.
virtual ~LocalInteraction()
Destructor.
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Apply velocity correction.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Templated patch interaction model class.
static interactionType wordToInteractionType(const word &itWord)
Convert word to interaction result.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
A List obtained as a section of another List.
A 2-tuple for storing two objects of different types.
const Type2 & second() const
Return second.
const Type1 & first() const
Return first.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
label size() const
Return the number of elements in the UPtrList.
A cloud is a collection of lagrangian particles.
A list of keyword definitions, which are a keyword followed by any number of values (e....
void transfer(dictionary &)
Transfer the contents of the argument and annul the argument.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
void set(entry *)
Assign a new entry, overwrite any existing entry.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
const word & name() const
Return const reference to name.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const polyMesh & mesh() const
Return reference to polyMesh.
A class for handling keywords in dictionaries.
label index() const
Return the index of this patch in the boundaryMesh.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
label whichFace(const label l) const
Return label of face in patch from global face label.
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
A wordRe is a word, but can also have a regular expression for matching words.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
labelList second(const UList< labelPair > &p)
labelList first(const UList< labelPair > &p)
Istream & operator>>(Istream &, pistonPointEdgeData &)
const dimensionSet dimMass
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.