37 template<
class CloudType>
48 particleFluxAccumulators_()
58 if (isType<polyPatch>(patch))
68 this->
typeDict().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))
236 const face&
f = patch[pFI];
242 const vector& fC = patchFaceCentres[pFI];
244 scalar fA = patchMagFaceAreas[pFI];
256 scalar previousCumulativeSum = 0.0;
264 + previousCumulativeSum;
266 previousCumulativeSum = cTriAFracs[triI];
271 cTriAFracs.
last() = 1.0;
288 scalar faceTemperature = boundaryT[
patchi][pFI];
294 scalar& faceAccumulator = pFA[i][pFI];
306 faceAccumulator -= nI;
308 label typeId = moleculeTypeIds_[i];
310 scalar
mass =
cloud.constProps(typeId).mass();
312 for (
label i = 0; i < nI; i++)
320 label selectedTriI = -1;
326 if (cTriAFracs[triI] >= triSelection)
334 const tetIndices& faceTetIs = faceTets[selectedTriI];
340 scalar mostProbableSpeed
342 cloud.maxwellianMostProbableSpeed
349 scalar sCosTheta = (faceVelocity &
n)/mostProbableSpeed;
352 scalar uNormProbCoeffA =
353 sCosTheta +
sqrt(
sqr(sCosTheta) + 2.0);
355 scalar uNormProbCoeffB =
359 + sCosTheta*(sCosTheta -
sqrt(
sqr(sCosTheta) + 2.0))
363 scalar randomScaling = 3.0;
367 randomScaling =
mag(sCosTheta) + 1;
375 scalar uNormalThermal;
383 uNormal = uNormalThermal + sCosTheta;
391 P = 2.0*uNormal/uNormProbCoeffA
392 *
exp(uNormProbCoeffB -
sqr(uNormalThermal));
400 + (t1 & faceVelocity)*t1
401 + (t2 & faceVelocity)*t2
402 + mostProbableSpeed*uNormal*
n;
404 scalar Ei =
cloud.equipartitionInternalEnergy
407 cloud.constProps(typeId).internalDegreesOfFreedom()
428 if (nLocateBoundaryHits != 0)
431 <<
"Freestream inflow model for cloud " << this->owner().name()
432 <<
" did not accurately locate " << nLocateBoundaryHits
433 <<
" particles" <<
endl;
438 Info<<
" Particles inserted = "
439 << 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 & typeDict() const
Return the coefficients dictionary.
const polyMesh & poly() const
Access the poly mesh.
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.
Pre-declare related SubField type.
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.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
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.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
virtual const labelList & faceOwner() const
Return face owner.
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.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
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)
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
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)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
randomGenerator rndGen(653213)