37 template<
class CloudType>
44 const word& patchName = patchData_[patchi].patchName();
46 forAll(nEscape_[patchi], injectori)
49 this->
writeTabbed(os, patchName +
"_nEscape_" + suffix);
50 this->
writeTabbed(os, patchName +
"_massEscape_" + suffix);
51 this->
writeTabbed(os, patchName +
"_nStick_" + suffix);
52 this->
writeTabbed(os, patchName +
"_massStick_" + suffix);
56 this->
writeTabbed(os, patchName +
"_nRebound_" + suffix);
57 this->
writeTabbed(os, patchName +
"_massRebound_" + suffix);
58 this->
writeTabbed(os, patchName +
"_nSplash_" + suffix);
59 this->
writeTabbed(os, patchName +
"_massSplash_" + suffix);
66 template<
class CloudType>
69 const dictionary&
dict,
75 nEscape_(patchData_.size()),
76 massEscape_(nEscape_.size()),
77 nStick_(nEscape_.size()),
78 massStick_(nEscape_.size()),
79 nRebound_(nEscape_.size()),
80 massRebound_(nEscape_.size()),
81 nSplash_(nEscape_.size()),
82 massSplash_(nEscape_.size()),
83 writeFields_(this->
coeffDict().getOrDefault(
"writeFields",
false)),
87 massEscapePtr_(nullptr),
88 massStickPtr_(nullptr)
90 const bool outputByInjectorId
95 Info<<
" Interaction fields will be written to " 105 Info<<
" Interaction fields will not be written" <<
endl;
109 label nInjectors = 0;
110 if (outputByInjectorId)
112 for (
const auto& inj : cloud.injectors())
114 injIdToIndex_.insert(inj.injectorID(), nInjectors++);
124 hasBaiGosman_ = hasBaiGosmanPatch();
128 beiGosman_.initialise
130 localInteractionModels::parcelHasThermo
138 forAll(patchData_, patchi)
140 const word& interactionTypeName =
141 patchData_[patchi].interactionTypeName();
143 if (!patchData_[patchi].isBaiGosman())
150 const word& patchName = patchData_[patchi].patchName();
152 <<
"Unknown patch interaction type " 153 << interactionTypeName <<
" for patch " << patchName
154 <<
". Valid selections are:" 161 nEscape_[patchi].setSize(nInjectors,
Zero);
162 massEscape_[patchi].setSize(nInjectors,
Zero);
163 nStick_[patchi].setSize(nInjectors,
Zero);
164 massStick_[patchi].setSize(nInjectors,
Zero);
168 nRebound_[patchi].setSize(nInjectors,
Zero);
169 massRebound_[patchi].setSize(nInjectors,
Zero);
170 nSplash_[patchi].setSize(nInjectors,
Zero);
171 massSplash_[patchi].setSize(nInjectors,
Zero);
177 template<
class CloudType>
180 const LocalInteraction<CloudType>& pim
184 patchData_(pim.patchData_),
185 nEscape_(pim.nEscape_),
186 massEscape_(pim.massEscape_),
187 nStick_(pim.nStick_),
188 massStick_(pim.massStick_),
189 nRebound_(pim.nRebound_),
190 massRebound_(pim.massRebound_),
191 nSplash_(pim.nSplash_),
192 massSplash_(pim.massSplash_),
193 writeFields_(pim.writeFields_),
194 hasBaiGosman_(pim.hasBaiGosman_),
195 beiGosman_(pim.beiGosman_, *this),
196 injIdToIndex_(pim.injIdToIndex_),
197 massEscapePtr_(nullptr),
198 massStickPtr_(nullptr)
204 template<
class CloudType>
207 forAll(patchData_, patchi)
209 if (patchData_[patchi].isBaiGosman())
219 template<
class CloudType>
229 nEscape_[patchi][idx]++;
230 massEscape_[patchi][idx] += mass;
233 if (writeFields_ && facei >= 0)
240 template<
class CloudType>
248 const bool incrementCount
253 nStick_[patchi][idx]++;
256 massStick_[patchi][idx] += mass;
258 if (writeFields_ && facei >= 0)
265 template<
class CloudType>
273 nRebound_[patchi][idx]++;
274 massRebound_[patchi][idx] += mass;
278 template<
class CloudType>
286 nSplash_[patchi][idx]++;
287 massSplash_[patchi][idx] += mass;
293 template<
class CloudType>
319 return *massEscapePtr_;
323 template<
class CloudType>
337 mesh.time().timeName(),
349 return *massStickPtr_;
353 template<
class CloudType>
361 const label patchi = patchData_.applyToPatch(
pp.index());
371 ? injIdToIndex_.lookup(
p.typeId(), 0)
375 if (patchData_[patchi].isBaiGosman())
377 return beiGosman_.correct
394 patchData_[patchi].interactionTypeName()
405 keepParticle =
false;
409 const scalar dm =
p.mass()*
p.nParticle();
419 pp.whichFace(
p.face())
424 nEscape_[patchi][idx]++;
425 massEscape_[patchi][idx] += dm;
429 const label pI =
pp.index();
430 const label fI =
pp.whichFace(
p.face());
442 const scalar dm =
p.mass()*
p.nParticle();
452 pp.whichFace(
p.face())
457 nStick_[patchi][idx]++;
458 massStick_[patchi][idx] += dm;
462 const label pI =
pp.index();
463 const label fI =
pp.whichFace(
p.face());
477 this->
owner().patchData(p,
pp, nw, Up);
485 <<
"Particle U the same as patch " 486 <<
" The particle has been removed" <<
nl <<
endl;
488 keepParticle =
false;
499 U -= (1.0 + patchData_[patchi].e())*Un*nw;
502 U -= patchData_[patchi].mu()*Ut;
513 p.mass()*
p.nParticle()
522 <<
"Unknown interaction type " 523 << patchData_[patchi].interactionTypeName()
524 <<
"(" << it <<
") for patch " 525 << patchData_[patchi].patchName()
539 template<
class CloudType>
549 if (anyBaiGosman != allBaiGosman)
552 <<
"Inconsistent BaiGosman configuration across processors." 556 const label
nPatches = patchData_.size();
560 if (minPatches != maxPatches)
563 <<
"Inconsistent localInteraction patch counter dimensions " 564 <<
"across processors: min = " << minPatches
565 <<
", max = " << maxPatches
571 const label nInjectors = nEscape_[patchi].size();
572 const label minInjectors =
574 const label maxInjectors =
577 if (minInjectors != maxInjectors)
580 <<
"Inconsistent localInteraction injector counter " 581 <<
"dimensions across processors for patch entry " 582 << patchData_[patchi].patchName()
583 <<
": min = " << minInjectors
584 <<
", max = " << maxInjectors
600 forAll(patchData_, patchi)
602 label lsd = nEscape_[patchi].size();
603 npe0[patchi].setSize(lsd,
Zero);
604 mpe0[patchi].setSize(lsd,
Zero);
605 nps0[patchi].setSize(lsd,
Zero);
606 mps0[patchi].setSize(lsd,
Zero);
610 nRebound0[patchi].setSize(lsd,
Zero);
611 massRebound0[patchi].setSize(lsd,
Zero);
612 nSplash0[patchi].setSize(lsd,
Zero);
613 massSplash0[patchi].setSize(lsd,
Zero);
636 npe[i] = npe[i] + npe0[i];
643 mpe[i] = mpe[i] + mpe0[i];
650 nps[i] = nps[i] + nps0[i];
657 mps[i] = mps[i] + mps0[i];
670 nRebound[i] = nRebound[i] + nRebound0[i];
676 massRebound[i] = massRebound[i] + massRebound0[i];
682 nSplash[i] = nSplash[i] + nSplash0[i];
688 massSplash[i] = massSplash[i] + massSplash0[i];
692 if (injIdToIndex_.size())
696 labelList indexToInjector(injIdToIndex_.size());
699 indexToInjector[iter.val()] = iter.key();
702 forAll(patchData_, patchi)
704 forAll(mpe[patchi], indexi)
706 const word& patchName = patchData_[patchi].patchName();
708 Log_<<
" Parcel fate: patch " << patchName
709 <<
" (number, mass)" <<
nl 710 <<
" - escape (injector " << indexToInjector[indexi]
711 <<
" ) = " << npe[patchi][indexi]
712 <<
", " << mpe[patchi][indexi] <<
nl 713 <<
" - stick (injector " << indexToInjector[indexi]
714 <<
" ) = " << nps[patchi][indexi]
715 <<
", " << mps[patchi][indexi] <<
nl;
719 Log_<<
" - rebound (injector " 720 << indexToInjector[indexi]
721 <<
" ) = " << nRebound[patchi][indexi]
722 <<
", " << massRebound[patchi][indexi] <<
nl 723 <<
" - splash (injector " 724 << indexToInjector[indexi]
725 <<
" ) = " << nSplash[patchi][indexi]
726 <<
", " << massSplash[patchi][indexi] <<
nl;
733 forAll(patchData_, patchi)
735 const word& patchName = patchData_[patchi].patchName();
737 Log_<<
" Parcel fate: patch " << patchName
738 <<
" (number, mass)" <<
nl 740 << npe[patchi][0] <<
", " << mpe[patchi][0] <<
nl 742 << nps[patchi][0] <<
", " << mps[patchi][0] <<
nl;
746 Log_<<
" - rebound = " 747 << nRebound[patchi][0] <<
", " 748 << massRebound[patchi][0] <<
nl 750 << nSplash[patchi][0] <<
", " 751 << massSplash[patchi][0] <<
nl;
758 forAll(npe[patchi], injectori)
761 <<
tab << npe[patchi][injectori]
762 <<
tab << mpe[patchi][injectori]
763 <<
tab << nps[patchi][injectori]
764 <<
tab << mps[patchi][injectori];
769 <<
tab << nRebound[patchi][injectori]
770 <<
tab << massRebound[patchi][injectori]
771 <<
tab << nSplash[patchi][injectori]
772 <<
tab << massSplash[patchi][injectori];
Patch interaction specified on a patch-by-patch basis.
volScalarField & massEscape()
Return access to the massEscape field.
PatchInteractionModel(CloudType &owner)
Construct null from owner.
virtual OFstream & file()
Return access to the file (if only 1)
DSMCCloud< dsmcParcel > CloudType
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static wordList interactionTypeNames_
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
constexpr char tab
The tab '\t' character(0x09)
virtual void addToEscapedParcels(const scalar mass)
Add to escaped parcels.
const Time & time() const
Return the top-level database.
virtual bool writeTime() const
Flag to indicate when to write a property.
List< labelList > labelListList
List of labelList.
virtual void info()
Write patch interaction info.
Templated patch interaction model class.
const CloudType & owner() const
Return const access to the owner cloud.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
virtual void info()
Write patch interaction info.
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
#define Log_
Report write to Foam::Info if the class log switch is true.
void setModelProperty(const word &entryName, const Type &value)
Add generic property to the sub-model.
List< scalarList > scalarListList
List of scalarList.
A class for handling words, derived from Foam::string.
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
const scalar & Urmax() const
Return Urmax.
Reading is optional [identical to LAZY_READ].
LocalInteraction(const dictionary &dict, CloudType &owner)
Construct from dictionary.
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.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
errorManip< error > abort(error &err)
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
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...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
volScalarField & massStick()
Return access to the massStick field.
const fvMesh & mesh() const
Return reference to the mesh.
decomposeUsingBbs false
Use bounding boxes (default) or unique decomposition of triangles (i.e. do not duplicate triangles) ...
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
return returnReduce(nRefine-oldNRefine, sumOp< label >())
Automatically write from objectRegistry::writeObject()
virtual void writeFileHeader(Ostream &os)
Output file header information.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
virtual void writeFileHeader(Ostream &os)
Output file header information.
messageStream Info
Information stream (stdout output on master, null elsewhere)
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...
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
List< label > labelList
A List of labels.
A patch is a list of labels that address the faces in the global face list.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
static interactionType wordToInteractionType(const word &itWord)
Convert word to interaction result.
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Apply velocity correction.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
static const word beiGosmanTypeName
BaiGosman type keyword used in patch entries.
static constexpr const zero Zero
Global zero (0)
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.