37 template<
class CloudType>
48 particleFluxAccumulators_()
58 if (isType<polyPatch>(patch))
68 this->
coeffDict().subDict(
"numberDensities")
74 particleFluxAccumulators_.setSize(patches_.
size());
94 numberDensitiesDict.
lookup<scalar>(molecules[i]);
98 if (moleculeTypeIds_[i] == -1)
101 <<
"typeId " << molecules[i] <<
"not defined in cloud." <<
nl
106 numberDensities_ /=
cloud.nParticle();
113 template<
class CloudType>
120 template<
class CloudType>
141 template<
class CloudType>
157 label particlesInserted = 0;
161 cloud.boundaryT().boundaryField()
166 cloud.boundaryU().boundaryField()
169 label nLocateBoundaryHits = 0;
185 label typeId = moleculeTypeIds_[i];
187 scalar mass =
cloud.constProps(typeId).mass();
192 <<
"Zero boundary temperature detected, check boundaryT "
193 <<
"condition." <<
nl
199 cloud.maxwellianMostProbableSpeed
223 exp(-
sqr(sCosTheta)) + sqrtPi*sCosTheta*(1 +
erf(sCosTheta))
233 const face&
f = patch[pFI];
253 scalar previousCumulativeSum = 0.0;
261 + previousCumulativeSum;
263 previousCumulativeSum = cTriAFracs[triI];
268 cTriAFracs.
last() = 1.0;
285 scalar faceTemperature = boundaryT[
patchi][pFI];
291 scalar& faceAccumulator = pFA[i][pFI];
303 faceAccumulator -= nI;
305 label typeId = moleculeTypeIds_[i];
307 scalar mass =
cloud.constProps(typeId).mass();
309 for (
label i = 0; i < nI; i++)
317 label selectedTriI = -1;
323 if (cTriAFracs[triI] >= triSelection)
331 const tetIndices& faceTetIs = faceTets[selectedTriI];
337 scalar mostProbableSpeed
339 cloud.maxwellianMostProbableSpeed
346 scalar sCosTheta = (faceVelocity &
n)/mostProbableSpeed;
349 scalar uNormProbCoeffA =
350 sCosTheta +
sqrt(
sqr(sCosTheta) + 2.0);
352 scalar uNormProbCoeffB =
356 + sCosTheta*(sCosTheta -
sqrt(
sqr(sCosTheta) + 2.0))
360 scalar randomScaling = 3.0;
364 randomScaling =
mag(sCosTheta) + 1;
372 scalar uNormalThermal;
380 uNormal = uNormalThermal + sCosTheta;
388 P = 2.0*uNormal/uNormProbCoeffA
389 *
exp(uNormProbCoeffB -
sqr(uNormalThermal));
397 + (t1 & faceVelocity)*t1
398 + (t2 & faceVelocity)*t2
399 + mostProbableSpeed*uNormal*
n;
401 scalar Ei =
cloud.equipartitionInternalEnergy
404 cloud.constProps(typeId).internalDegreesOfFreedom()
425 if (nLocateBoundaryHits != 0)
428 <<
"Freestream inflow model for cloud " << this->owner().name()
429 <<
" did not accurately locate " << nLocateBoundaryHits
430 <<
" particles" <<
endl;
435 Info<<
" Particles inserted = "
436 << particlesInserted <<
endl;
#define forAll(list, i)
Loop across all elements in list.
Templated base class for dsmc cloud.
virtual void topoChange()
Update following mesh change.
FreeStream(const dictionary &dict, CloudType &cloud)
Construct from dictionary.
virtual void inflow()
Introduce particles.
virtual ~FreeStream()
Destructor.
Generic GeometricBoundaryField class.
Templated inflow boundary model class.
const dictionary & coeffDict() const
Return the coefficients dictionary.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
scalar deltaTValue() const
Return time step value.
label size() const
Return the number of elements in the UList.
T & last()
Return the last element of the list.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
wordList toc() const
Return the table of contents.
Standard normal distribution. Not selectable.
virtual scalar sample() const
Sample the distribution.
A face is a list of labels corresponding to mesh vertices.
const Time & time() const
Return the top-level database.
Mesh object that implements searches within the local cells and faces.
static const meshSearch & New(const polyMesh &mesh, const pointInCellShapes=pointInCellShapes::tets)
Lookup or construct from mesh and cell decomposition option.
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.
Mesh consisting of general polyhedral cells.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
const vectorField::subField faceAreas() const
Return face areas.
label start() const
Return start label of this patch in the polyMesh face list.
const vectorField::subField faceCentres() const
Return face centres.
const scalarField::subField magFaceAreas() const
Return face area magnitudes.
scalar scalar01()
Return a scalar uniformly distributed between zero and one.
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
triPointRef faceTri(const polyMesh &mesh, const pointField &meshPoints) const
Return the geometry corresponding to the tri on the face for.
scalar mag() const
Return scalar magnitude.
Point randomPoint(randomGenerator &rndGen) const
Return a random point on the triangle from a uniform.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
dimensionedScalar exp(const dimensionedScalar &ds)
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.
errorManip< error > abort(error &err)
dimensionedScalar erf(const dimensionedScalar &ds)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
randomGenerator rndGen(653213)