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 TrackCloudType>
93 TrackCloudType& cloud,
94 typename parcelType::trackingData& td
97 if (solution_.steadyState())
103 evolveCloud(cloud, td);
105 if (solution_.coupled())
107 cloud.relaxSources(cloud.cloudCopy());
114 evolveCloud(cloud, td);
116 if (solution_.coupled())
118 cloud.scaleSources();
126 if (solution_.steadyState())
128 cloud.restoreState();
133 template<
class CloudType>
136 if (cellOccupancyPtr_.empty())
138 cellOccupancyPtr_.reset
143 else if (cellOccupancyPtr_().size() != mesh_.nCells())
148 cellOccupancyPtr_().setSize(mesh_.nCells());
155 cellOccupancy[cO].
clear();
160 cellOccupancy[iter().cell()].
append(&iter());
165 template<
class CloudType>
171 if (cellOccupancyPtr_.valid())
173 buildCellOccupancy();
178 template<
class CloudType>
179 template<
class TrackCloudType>
182 TrackCloudType& cloud,
183 typename parcelType::trackingData& td
186 if (solution_.coupled())
188 cloud.resetSourceTerms();
191 if (solution_.transient())
193 label preInjectionSize = this->size();
199 if (preInjectionSize != this->size())
201 updateCellOccupancy();
202 preInjectionSize = this->size();
205 injectors_.inject(cloud, td);
210 cloud.motion(cloud, td);
212 stochasticCollision().update(td, solution_.trackTime());
218 injectors_.injectSteadyState(cloud, td, solution_.trackTime());
220 CloudType::move(cloud, td, solution_.trackTime());
225 template<
class CloudType>
232 this->writePositions();
235 this->dispersion().cacheFields(
false);
237 forces_.cacheFields(
false);
239 functions_.postEvolve();
241 solution_.nextIter();
243 if (this->db().time().writeTime())
245 outputProperties_.writeObject
248 IOstream::currentVersion,
249 this->db().time().writeCompression(),
256 template<
class CloudType>
259 CloudType::cloudReset(c);
280 template<
class CloudType>
283 const word& cloudName,
293 cloudCopyPtr_(
nullptr),
299 cloudName +
"Properties",
300 rho.
mesh().time().constant(),
302 IOobject::MUST_READ_IF_MODIFIED,
310 cloudName +
"OutputProperties",
311 mesh_.time().timeName(),
314 IOobject::READ_IF_PRESENT,
318 solution_(mesh_, particleProperties_.subDict(
"solution")),
319 constProps_(particleProperties_),
322 particleProperties_.subOrEmptyDict(
"subModels", solution_.active())
326 cellLengthScale_(
mag(
cbrt(mesh_.V()))),
336 subModelProperties_.subOrEmptyDict
346 particleProperties_.subOrEmptyDict(
"cloudFunctions"),
351 subModelProperties_.subOrEmptyDict(
"injectionModels"),
354 dispersionModel_(
nullptr),
355 patchInteractionModel_(
nullptr),
356 stochasticCollisionModel_(
nullptr),
357 surfaceFilmModel_(
nullptr),
358 UIntegrator_(
nullptr),
365 this->
name() +
":UTrans",
368 IOobject::READ_IF_PRESENT,
381 this->
name() +
":UCoeff",
384 IOobject::READ_IF_PRESENT,
392 if (solution_.active())
399 this->deleteLostParticles();
403 if (solution_.resetSourcesOnStartup())
410 template<
class CloudType>
419 cloudCopyPtr_(
nullptr),
427 cellOccupancyPtr_(
nullptr),
448 this->
name() +
":UTrans",
477 template<
class CloudType>
487 cloudCopyPtr_(
nullptr),
505 name +
"OutputProperties",
506 mesh_.time().timeName(),
507 "uniform"/cloud::prefix/
name,
516 subModelProperties_(dictionary::null),
518 cellOccupancyPtr_(
nullptr),
525 forces_(*
this, mesh),
528 dispersionModel_(
nullptr),
529 patchInteractionModel_(
nullptr),
530 stochasticCollisionModel_(
nullptr),
531 surfaceFilmModel_(
nullptr),
532 UIntegrator_(
nullptr),
540 template<
class CloudType>
547 template<
class CloudType>
551 const scalar lagrangianDt
554 parcel.rho() = constProps_.rho0();
558 template<
class CloudType>
562 const scalar lagrangianDt,
563 const bool fullyDescribed
566 const scalar carrierDt = mesh_.time().deltaTValue();
567 parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
569 if (parcel.typeId() == -1)
571 parcel.typeId() = constProps_.parcelTypeId();
576 template<
class CloudType>
589 template<
class CloudType>
592 cloudReset(cloudCopyPtr_());
593 cloudCopyPtr_.clear();
597 template<
class CloudType>
600 UTrans().field() =
Zero;
601 UCoeff().field() = 0.0;
605 template<
class CloudType>
614 const scalar coeff = solution_.relaxCoeff(name);
615 field = field0 + coeff*(field - field0);
619 template<
class CloudType>
627 const scalar coeff = solution_.relaxCoeff(name);
632 template<
class CloudType>
638 this->
relax(UTrans_(), cloudOldTime.
UTrans(),
"U");
639 this->
relax(UCoeff_(), cloudOldTime.
UCoeff(),
"U");
643 template<
class CloudType>
646 this->scale(UTrans_(),
"U");
647 this->scale(UCoeff_(),
"U");
651 template<
class CloudType>
656 label nGeometricD = mesh_.nGeometricD();
658 Info<<
"\nSolving " << nGeometricD <<
"-D cloud " << this->
name() <<
endl;
660 this->dispersion().cacheFields(
true);
661 forces_.cacheFields(
true);
662 updateCellOccupancy();
664 pAmbient_ = constProps_.dict().template
665 lookupOrDefault<scalar>(
"pAmbient", pAmbient_);
667 functions_.preEvolve();
671 template<
class CloudType>
674 if (solution_.canEvolve())
676 typename parcelType::trackingData td(*
this);
683 template<
class CloudType>
684 template<
class TrackCloudType>
687 TrackCloudType& cloud,
688 typename parcelType::trackingData& td
691 CloudType::move(cloud, td, solution_.trackTime());
693 updateCellOccupancy();
697 template<
class CloudType>
707 Up /= p.mesh().time().deltaTValue();
713 if (!mesh_.moving() && isA<wallPolyPatch>(pp))
722 if (U_.boundaryField()[
patchi].fixesValue())
724 const vector Uw1 = U_.boundaryField()[
patchi][patchFacei];
726 U_.oldTime().boundaryField()[
patchi][patchFacei];
728 const scalar
f = p.currentTimeFraction();
730 const vector Uw = Uw0 + f*(Uw1 - Uw0);
734 Up = (nnw & Up) + Uw - (nnw & Uw);
740 template<
class CloudType>
743 updateCellOccupancy();
744 injectors_.updateMesh();
745 cellLengthScale_ =
mag(
cbrt(mesh_.V()));
749 template<
class CloudType>
758 template<
class CloudType>
761 vector linearMomentum = linearMomentumOfSystem();
764 scalar linearKineticEnergy = linearKineticEnergyOfSystem();
768 <<
" Current number of parcels = " 770 <<
" Current mass in system = " 772 <<
" Linear momentum = " 773 << linearMomentum <<
nl 774 <<
" |Linear momentum| = " 775 <<
mag(linearMomentum) <<
nl 776 <<
" Linear kinetic energy = " 777 << linearKineticEnergy <<
nl;
779 injectors_.info(
Info);
781 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.
void evolveCloud(TrackCloudType &cloud, typename parcelType::trackingData &td)
Evolve the cloud.
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.
KinematicCloud(const word &cloudName, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g, bool readFields=true)
Construct given carrier gas fields.
autoPtr< SurfaceFilmModel< KinematicCloud< CloudType > > > surfaceFilmModel_
Surface film model.
Random rndGen_
Random number generator - used by some injection routines.
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/m^3].
Templated patch interaction model class.
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.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
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.
regionModels::surfaceFilmModel & surfaceFilm
const Mesh & mesh() const
Return mesh.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
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.
autoPtr< integrationScheme > UIntegrator_
Velocity integration.
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"))
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(TrackCloudType &cloud, typename parcelType::trackingData &td)
Solve the cloud - calls all evolution functions.
autoPtr< StochasticCollisionModel< KinematicCloud< CloudType > > > stochasticCollisionModel_
Stochastic collision model.
label whichFace(const label l) const
Return label of face in patch from global face label.
const dimensionSet dimVelocity
scalarField cellLengthScale_
Cell length scale.