39 template<
class CloudType>
42 dispersionModel_.reset
51 patchInteractionModel_.reset
60 stochasticCollisionModel_.reset
69 surfaceFilmModel_.reset
83 solution_.integrationSchemes()
89 template<
class CloudType>
90 template<
class TrackData>
93 if (solution_.steadyState())
95 td.cloud().storeState();
97 td.cloud().preEvolve();
101 if (solution_.coupled())
103 td.cloud().relaxSources(td.cloud().cloudCopy());
108 td.cloud().preEvolve();
112 if (solution_.coupled())
114 td.cloud().scaleSources();
120 td.cloud().postEvolve();
122 if (solution_.steadyState())
124 td.cloud().restoreState();
129 template<
class CloudType>
132 if (cellOccupancyPtr_.empty())
134 cellOccupancyPtr_.reset
139 else if (cellOccupancyPtr_().size() != mesh_.nCells())
144 cellOccupancyPtr_().setSize(mesh_.nCells());
151 cellOccupancy[cO].
clear();
156 cellOccupancy[iter().cell()].
append(&iter());
161 template<
class CloudType>
167 if (cellOccupancyPtr_.valid())
169 buildCellOccupancy();
174 template<
class CloudType>
175 template<
class TrackData>
178 if (solution_.coupled())
180 td.cloud().resetSourceTerms();
183 if (solution_.transient())
185 label preInjectionSize = this->size();
191 if (preInjectionSize != this->size())
193 updateCellOccupancy();
194 preInjectionSize = this->size();
197 injectors_.inject(td);
202 td.cloud().motion(td);
204 stochasticCollision().update(solution_.trackTime());
210 injectors_.injectSteadyState(td, solution_.trackTime());
212 td.part() = TrackData::tpLinearTrack;
213 CloudType::move(td, solution_.trackTime());
218 template<
class CloudType>
225 this->writePositions();
228 this->dispersion().cacheFields(
false);
230 forces_.cacheFields(
false);
232 functions_.postEvolve();
234 solution_.nextIter();
236 if (this->db().time().writeTime())
238 outputProperties_.writeObject
241 IOstream::currentVersion,
242 this->db().time().writeCompression(),
249 template<
class CloudType>
252 CloudType::cloudReset(c);
273 template<
class CloudType>
276 const word& cloudName,
286 cloudCopyPtr_(
nullptr),
292 cloudName +
"Properties",
293 rho.
mesh().time().constant(),
295 IOobject::MUST_READ_IF_MODIFIED,
303 cloudName +
"OutputProperties",
304 mesh_.time().timeName(),
307 IOobject::READ_IF_PRESENT,
311 solution_(mesh_, particleProperties_.subDict(
"solution")),
312 constProps_(particleProperties_),
315 particleProperties_.subOrEmptyDict(
"subModels", solution_.active())
320 solution_.steadyState() ?
321 particleProperties_.lookupOrDefault<
label>(
"randomSampleSize", 100000)
325 cellLengthScale_(
mag(
cbrt(mesh_.V()))),
335 subModelProperties_.subOrEmptyDict
345 particleProperties_.subOrEmptyDict(
"cloudFunctions"),
350 subModelProperties_.subOrEmptyDict(
"injectionModels"),
353 dispersionModel_(
nullptr),
354 patchInteractionModel_(
nullptr),
355 stochasticCollisionModel_(
nullptr),
356 surfaceFilmModel_(
nullptr),
357 UIntegrator_(
nullptr),
364 this->
name() +
":UTrans",
367 IOobject::READ_IF_PRESENT,
380 this->
name() +
":UCoeff",
383 IOobject::READ_IF_PRESENT,
391 if (solution_.active())
398 this->deleteLostParticles();
402 if (solution_.resetSourcesOnStartup())
409 template<
class CloudType>
418 cloudCopyPtr_(
nullptr),
426 cellOccupancyPtr_(
nullptr),
447 this->
name() +
":UTrans",
476 template<
class CloudType>
486 cloudCopyPtr_(
nullptr),
504 name +
"OutputProperties",
505 mesh_.time().timeName(),
506 "uniform"/cloud::prefix/
name,
515 subModelProperties_(dictionary::null),
517 cellOccupancyPtr_(
nullptr),
524 forces_(*
this, mesh),
527 dispersionModel_(
nullptr),
528 patchInteractionModel_(
nullptr),
529 stochasticCollisionModel_(
nullptr),
530 surfaceFilmModel_(
nullptr),
531 UIntegrator_(
nullptr),
539 template<
class CloudType>
546 template<
class CloudType>
553 template<
class CloudType>
557 const scalar lagrangianDt
560 parcel.rho() = constProps_.rho0();
564 template<
class CloudType>
568 const scalar lagrangianDt,
569 const bool fullyDescribed
572 const scalar carrierDt = mesh_.time().deltaTValue();
573 parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
575 if (parcel.typeId() == -1)
577 parcel.typeId() = constProps_.parcelTypeId();
582 template<
class CloudType>
589 clone(this->
name() +
"Copy").ptr()
595 template<
class CloudType>
598 cloudReset(cloudCopyPtr_());
599 cloudCopyPtr_.clear();
603 template<
class CloudType>
606 UTrans().field() =
Zero;
607 UCoeff().field() = 0.0;
611 template<
class CloudType>
620 const scalar coeff = solution_.relaxCoeff(name);
621 field = field0 + coeff*(field - field0);
625 template<
class CloudType>
633 const scalar coeff = solution_.relaxCoeff(name);
638 template<
class CloudType>
644 this->
relax(UTrans_(), cloudOldTime.
UTrans(),
"U");
645 this->
relax(UCoeff_(), cloudOldTime.
UCoeff(),
"U");
649 template<
class CloudType>
652 this->scale(UTrans_(),
"U");
653 this->scale(UCoeff_(),
"U");
657 template<
class CloudType>
662 label nGeometricD = mesh_.nGeometricD();
664 Info<<
"\nSolving " << nGeometricD <<
"-D cloud " << this->
name() <<
endl;
666 this->dispersion().cacheFields(
true);
667 forces_.cacheFields(
true);
668 updateCellOccupancy();
670 pAmbient_ = constProps_.dict().template
671 lookupOrDefault<scalar>(
"pAmbient", pAmbient_);
673 functions_.preEvolve();
677 template<
class CloudType>
680 if (solution_.canEvolve())
682 typename parcelType::template
683 TrackingData<KinematicCloud<CloudType>> td(*
this);
690 template<
class CloudType>
691 template<
class TrackData>
694 td.part() = TrackData::tpLinearTrack;
695 CloudType::move(td, solution_.trackTime());
697 updateCellOccupancy();
701 template<
class CloudType>
716 if (isA<wallPolyPatch>(pp))
725 if (U_.boundaryField()[
patchi].fixesValue())
727 const vector Uw1 = U_.boundaryField()[
patchi][patchFacei];
729 U_.oldTime().boundaryField()[
patchi][patchFacei];
731 const scalar
f = p.currentTimeFraction();
733 const vector Uw = Uw0 + f*(Uw1 - Uw0);
737 Up = (nnw & Up) + Uw - (nnw & Uw);
743 template<
class CloudType>
746 updateCellOccupancy();
747 injectors_.updateMesh();
748 cellLengthScale_ =
mag(
cbrt(mesh_.V()));
752 template<
class CloudType>
761 template<
class CloudType>
764 vector linearMomentum = linearMomentumOfSystem();
767 scalar linearKineticEnergy = linearKineticEnergyOfSystem();
771 <<
" Current number of parcels = " 773 <<
" Current mass in system = " 775 <<
" Linear momentum = " 776 << linearMomentum <<
nl 777 <<
" |Linear momentum| = " 778 <<
mag(linearMomentum) <<
nl 779 <<
" Linear kinetic energy = " 780 << linearKineticEnergy <<
nl;
782 injectors_.info(
Info);
784 this->patchInteraction().info(
Info);
Template class for intrusive linked lists.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
DSMCCloud< dsmcParcel > CloudType
void scaleSources()
Apply scaling to (transient) cloud sources.
void setModels()
Set cloud sub-models.
const volVectorField & U_
Velocity [m/s].
void relaxSources(const KinematicCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
void storeState()
Store the current cloud state.
autoPtr< PatchInteractionModel< KinematicCloud< CloudType > > > patchInteractionModel_
Patch interaction model.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject *> &storedObjects)
Read the selected GeometricFields of the specified type.
InjectionModelList< KinematicCloud< CloudType > > injectors_
Injector models.
Cloud< basicKinematicCollidingParcel > ::particleType parcelType
Type of parcel the cloud was instantiated for.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual ~KinematicCloud()
Destructor.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
autoPtr< volVectorField::Internal > UTrans_
Momentum.
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void relax(DimensionedField< Type, volMesh > &field, const DimensionedField< Type, volMesh > &field0, const word &name) const
Relax field.
volVectorField::Internal & UTrans()
Return reference to momentum source.
void postEvolve()
Post-evolve.
const Time & time() const
Return the top-level database.
autoPtr< SurfaceFilmModel< KinematicCloud< CloudType > > > surfaceFilmModel_
Surface film model.
void updateCellOccupancy()
Update (i.e. build) the cellOccupancy if it has.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void buildCellOccupancy()
Build the cellOccupancy.
const volScalarField & rho_
Density [kg/m3].
Templated patch interaction model class.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
void updateMesh()
Update mesh.
const volScalarField & mu_
Dynamic viscosity [Pa.s].
volScalarField::Internal & UCoeff()
Return coefficient for carrier phase U equation.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
void resetSourceTerms()
Reset the cloud source terms.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
void append(const T &)
Append an element at the end of the list.
dimensionedScalar cbrt(const dimensionedScalar &ds)
scalar pAmbient_
Averaged ambient domain pressure.
const word & constant() const
Return constant name.
parcelType::constantProperties constProps_
Parcel constant properties.
const fvMesh & mesh_
References to the mesh and time databases.
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
const dictionary subModelProperties_
Sub-models dictionary.
Base cloud calls templated on particle type.
bool hasWallImpactDistance() const
Switch to specify if particles of the cloud can return.
const Mesh & mesh() const
Return mesh.
Templated wall surface film model class.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void evolveCloud(TrackData &td)
Evolve the cloud.
word name(const complex &)
Return a string representation of a complex.
void motion(TrackData &td)
Particle motion.
Virtual abstract base class for templated KinematicCloud.
cloudSolution solution_
Solution properties.
Templated base class for kinematic cloud.
void patchData(const parcelType &p, const polyPatch &pp, vector &normal, vector &Up) const
Calculate the patch normal and velocity to interact with,.
const List< DynamicList< molecule * > > & cellOccupancy
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void evolve()
Evolve the cloud.
IOdictionary particleProperties_
Dictionary of particle properties.
autoPtr< volScalarField::Internal > UCoeff_
Coefficient for carrier phase U equation.
Templated stochastic collision model class.
Mesh data needed to do the Finite Volume discretisation.
label index() const
Return the index of this patch in the boundaryMesh.
void info()
Print cloud information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
forceType forces_
Optional particle forces.
void restoreState()
Reset the current cloud to the previously stored state.
dimensioned< scalar > mag(const dimensioned< Type > &)
functionType functions_
Optional cloud function objects.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
void scale(DimensionedField< Type, volMesh > &field, const word &name) const
Scale field.
const word cloudName(propsDict.lookup("cloudName"))
filmModelType & surfaceFilm
void cloudReset(KinematicCloud< CloudType > &c)
Reset state of cloud.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
A patch is a list of labels that address the faces in the global face list.
autoPtr< DispersionModel< KinematicCloud< CloudType > > > dispersionModel_
Dispersion model.
IOdictionary outputProperties_
Dictionary of output properties.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const dimensionedVector & g_
Gravity.
void preEvolve()
Pre-evolve.
void solve(TrackData &td)
Solve the cloud - calls all evolution functions.
cachedRandom rndGen_
Random number generator - used by some injection routines.
autoPtr< StochasticCollisionModel< KinematicCloud< CloudType > > > stochasticCollisionModel_
Stochastic collision model.
label whichFace(const label l) const
Return label of face in patch from global face label.
autoPtr< vectorIntegrationScheme > UIntegrator_
Velocity integration.
const dimensionSet dimVelocity
scalarField cellLengthScale_
Cell length scale.