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() != this->
mesh().nCells())
148 cellOccupancyPtr_().setSize(this->
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();
195 this->surfaceFilm().inject(cloud);
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,
288 const bool readFields
291 CloudType(cloudName, rho, U, mu, g,
false),
292 cloudCopyPtr_(
nullptr),
297 cloudName +
"Properties",
298 this->
mesh().time().constant(),
300 IOobject::MUST_READ_IF_MODIFIED,
308 cloudName +
"OutputProperties",
310 "uniform"/cloud::prefix/cloudName,
312 IOobject::READ_IF_PRESENT,
316 solution_(this->
mesh(), particleProperties_.subDict(
"solution")),
317 constProps_(particleProperties_),
320 particleProperties_.subOrEmptyDict(
"subModels",
true)
334 subModelProperties_.subOrEmptyDict
344 particleProperties_.subOrEmptyDict(
"cloudFunctions"),
349 subModelProperties_.subOrEmptyDict(
"injectionModels"),
352 dispersionModel_(
nullptr),
353 patchInteractionModel_(
nullptr),
354 stochasticCollisionModel_(
nullptr),
355 surfaceFilmModel_(
nullptr),
356 UIntegrator_(
nullptr),
363 this->
name() +
":UTrans",
366 IOobject::READ_IF_PRESENT,
379 this->
name() +
":UCoeff",
382 IOobject::READ_IF_PRESENT,
395 this->deleteLostParticles();
398 if (solution_.resetSourcesOnStartup())
405 template<
class CloudType>
408 const word& cloudName,
413 const bool readFields
420 template<
class CloudType>
428 cloudCopyPtr_(
nullptr),
435 cellOccupancyPtr_(
nullptr),
456 this->
name() +
":UTrans",
485 template<
class CloudType>
494 cloudCopyPtr_(
nullptr),
511 name +
"OutputProperties",
513 "uniform"/cloud::prefix/name,
522 subModelProperties_(dictionary::null),
524 cellOccupancyPtr_(
nullptr),
531 forces_(*
this, mesh),
534 dispersionModel_(
nullptr),
535 patchInteractionModel_(
nullptr),
536 stochasticCollisionModel_(
nullptr),
537 surfaceFilmModel_(
nullptr),
538 UIntegrator_(
nullptr),
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 = this->
mesh().time().deltaTValue();
573 parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
575 if (parcel.typeId() == -1)
577 parcel.typeId() = constProps_.parcelTypeId();
582 template<
class CloudType>
595 template<
class CloudType>
598 cloudReset(cloudCopyPtr_());
599 cloudCopyPtr_.clear();
603 template<
class CloudType>
606 UTransRef().field() =
Zero;
607 UCoeffRef().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>
649 template<
class CloudType>
652 this->scale(UTrans_(),
"U");
653 this->scale(UCoeff_(),
"U");
657 template<
class CloudType>
662 label nGeometricD = this->
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::trackingData td(*
this);
689 template<
class CloudType>
690 template<
class TrackCloudType>
693 TrackCloudType& cloud,
694 typename parcelType::trackingData& td
697 CloudType::move(cloud, td, solution_.trackTime());
699 updateCellOccupancy();
703 template<
class CloudType>
713 Up /= p.mesh().time().deltaTValue();
719 if (!this->
mesh().moving() && isA<wallPolyPatch>(pp))
728 if (U_.boundaryField()[
patchi].fixesValue())
730 const vector Uw1 = U_.boundaryField()[
patchi][patchFacei];
732 U_.oldTime().boundaryField()[
patchi][patchFacei];
734 const scalar
f = p.currentTimeFraction();
736 const vector Uw = Uw0 + f*(Uw1 - Uw0);
740 Up = (nnw & Up) + Uw - (nnw & Uw);
746 template<
class CloudType>
749 updateCellOccupancy();
750 injectors_.updateMesh();
755 template<
class CloudType>
764 template<
class CloudType>
767 vector linearMomentum = linearMomentumOfSystem();
770 scalar linearKineticEnergy = linearKineticEnergyOfSystem();
774 <<
" Current number of parcels = " 776 <<
" Current mass in system = " 778 <<
" Linear momentum = " 779 << linearMomentum <<
nl 780 <<
" |Linear momentum| = " 781 <<
mag(linearMomentum) <<
nl 782 <<
" Linear kinetic energy = " 783 << linearKineticEnergy <<
nl;
785 injectors_.info(
Info);
786 this->surfaceFilm().info(
Info);
787 this->patchInteraction().info(
Info);
autoPtr< StochasticCollisionModel< MomentumCloud< CloudType > > > stochasticCollisionModel_
Stochastic collision model.
const volVectorField & U_
Velocity [m/s].
void preEvolve()
Pre-evolve.
void scaleSources()
Apply scaling to (transient) cloud sources.
void updateCellOccupancy()
Update (i.e. build) the cellOccupancy if it has.
IOdictionary particleProperties_
Dictionary of particle properties.
#define forAll(list, i)
Loop across all elements in list.
virtual tmp< volScalarField > mu() const =0
Dynamic viscosity of mixture [kg/m/s].
void postEvolve()
Post-evolve.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void solve(TrackCloudType &cloud, typename parcelType::trackingData &td)
Solve the cloud - calls all evolution functions.
DSMCCloud< dsmcParcel > CloudType
void setModels()
Set cloud sub-models.
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.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
cloudSolution solution_
Solution properties.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
MomentumCloud(const word &cloudName, const volScalarField &rho, const volVectorField &U, const volScalarField &mu, const dimensionedVector &g, const bool readFields=true)
Construct given carrier fields.
void storeState()
Store the current cloud state.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
autoPtr< PatchInteractionModel< MomentumCloud< CloudType > > > patchInteractionModel_
Patch interaction model.
const Time & time() const
Return the top-level database.
void buildCellOccupancy()
Build the cellOccupancy.
void scale(DimensionedField< Type, volMesh > &field, const word &name) const
Scale field.
void resetSourceTerms()
Reset the cloud source terms.
Random rndGen_
Random number generator - used by some injection routines.
InjectionModelList< MomentumCloud< CloudType > > injectors_
Injector models.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
autoPtr< SurfaceFilmModel< MomentumCloud< CloudType > > > surfaceFilmModel_
Surface film model.
const dimensionedVector & g_
Gravity.
Templated patch interaction model class.
void info()
Print cloud information.
Templated base class for momentum cloud.
autoPtr< volScalarField::Internal > UCoeff_
Coefficient for carrier phase U equation.
const volScalarField & rho_
Density [kg/m^3].
void cloudReset(MomentumCloud< CloudType > &c)
Reset state of cloud.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
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.
parcelType::constantProperties constProps_
Parcel constant properties.
A class for handling words, derived from string.
Base-class for fluid thermodynamic properties.
forceType forces_
Optional particle forces.
void append(const T &)
Append an element at the end of the list.
void evolveCloud(TrackCloudType &cloud, typename parcelType::trackingData &td)
Evolve the cloud.
dimensionedScalar cbrt(const dimensionedScalar &ds)
const word & constant() const
Return constant name.
void relax(DimensionedField< Type, volMesh > &field, const DimensionedField< Type, volMesh > &field0, const word &name) const
Relax field.
autoPtr< DispersionModel< MomentumCloud< CloudType > > > dispersionModel_
Dispersion model.
const dictionary subModelProperties_
Sub-models dictionary.
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
IOdictionary outputProperties_
Dictionary of output properties.
Base cloud calls templated on particle type.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
autoPtr< integrationScheme > UIntegrator_
Velocity integration.
autoPtr< volVectorField::Internal > UTrans_
Momentum.
const dimensionSet dimVelocity
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
const volScalarField & mu_
Dynamic viscosity [Pa.s].
const dimensionSet dimMass
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
virtual ~MomentumCloud()
Destructor.
word name(const complex &)
Return a string representation of a complex.
void relaxSources(const MomentumCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
const List< DynamicList< molecule * > > & cellOccupancy
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void patchData(const parcelType &p, const polyPatch &pp, vector &normal, vector &Up) const
Calculate the patch normal and velocity to interact with,.
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.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
void updateMesh()
Update mesh.
A patch is a list of labels that address the faces in the global face list.
const dimensionedVector & g
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
scalarField cellLengthScale_
Cell length scale.
scalar pAmbient_
Averaged ambient domain pressure.
void restoreState()
Reset the current cloud to the previously stored state.
void evolve()
Evolve the cloud.
label whichFace(const label l) const
Return label of face in patch from global face label.
functionType functions_
Optional cloud function objects.