Go to the documentation of this file.
49 template<
class CloudType>
52 dispersionModel_.reset
61 patchInteractionModel_.reset
70 stochasticCollisionModel_.reset
79 surfaceFilmModel_.reset
120 solution_.integrationSchemes()
126 template<
class CloudType>
127 template<
class TrackCloudType>
130 TrackCloudType&
cloud,
136 if (solution_.steadyState())
142 evolveCloud(
cloud, td);
144 if (solution_.coupled())
153 evolveCloud(
cloud, td);
155 if (solution_.coupled())
157 cloud.scaleSources();
163 cloud.postEvolve(td);
165 if (solution_.steadyState())
167 cloud.restoreState();
172 template<
class CloudType>
175 if (!cellOccupancyPtr_)
177 cellOccupancyPtr_.reset
182 else if (cellOccupancyPtr_().size() != mesh_.nCells())
187 cellOccupancyPtr_().setSize(mesh_.nCells());
204 template<
class CloudType>
210 if (cellOccupancyPtr_)
212 buildCellOccupancy();
217 template<
class CloudType>
218 template<
class TrackCloudType>
221 TrackCloudType&
cloud,
225 if (solution_.coupled())
227 cloud.resetSourceTerms();
230 if (solution_.transient())
232 label preInjectionSize = this->size();
238 if (preInjectionSize != this->size())
240 updateCellOccupancy();
241 preInjectionSize = this->size();
244 injectors_.inject(
cloud, td);
250 stochasticCollision().update(td, solution_.trackTime());
256 injectors_.injectSteadyState(
cloud, td, solution_.trackTime());
258 td.part() = parcelType::trackingData::tpLinearTrack;
259 CloudType::move(
cloud, td, solution_.trackTime());
264 template<
class CloudType>
274 this->writePositions();
277 this->dispersion().cacheFields(
false);
279 this->patchInteraction().postEvolve();
281 forces_.cacheFields(
false);
283 functions_.postEvolve(td);
285 solution_.nextIter();
287 if (this->db().time().writeTime())
289 outputProperties_.writeObject
294 this->db().time().writeCompression()
300 if (this->dampingModel().active())
302 this->dampingModel().cacheFields(
false);
304 if (this->packingModel().active())
306 this->packingModel().cacheFields(
false);
311 template<
class CloudType>
314 CloudType::cloudReset(
c);
318 forces_.transfer(
c.forces_);
320 functions_.transfer(
c.functions_);
322 injectors_.transfer(
c.injectors_);
324 dispersionModel_.reset(
c.dispersionModel_.ptr());
325 patchInteractionModel_.reset(
c.patchInteractionModel_.ptr());
326 stochasticCollisionModel_.reset(
c.stochasticCollisionModel_.ptr());
327 surfaceFilmModel_.reset(
c.surfaceFilmModel_.ptr());
329 packingModel_.reset(
c.packingModel_.ptr());
330 dampingModel_.reset(
c.dampingModel_.ptr());
331 isotropyModel_.reset(
c.isotropyModel_.ptr());
333 UIntegrator_.reset(
c.UIntegrator_.ptr());
339 template<
class CloudType>
352 cloudCopyPtr_(nullptr),
377 solution_(mesh_, particleProperties_.subDict(
"solution")),
378 constProps_(particleProperties_),
381 particleProperties_.subOrEmptyDict
390 cellLengthScale_(
mag(
cbrt(mesh_.V()))),
400 subModelProperties_.subOrEmptyDict
411 particleProperties_.subOrEmptyDict(
"cloudFunctions"),
416 subModelProperties_.subOrEmptyDict(
"injectionModels"),
419 dispersionModel_(nullptr),
420 patchInteractionModel_(nullptr),
421 stochasticCollisionModel_(nullptr),
422 surfaceFilmModel_(nullptr),
424 packingModel_(nullptr),
425 dampingModel_(nullptr),
426 isotropyModel_(nullptr),
428 UIntegrator_(nullptr),
435 this->
name() +
":UTrans",
451 this->
name() +
":UCoeff",
462 if (solution_.active())
469 this->deleteLostParticles();
473 if (solution_.resetSourcesOnStartup())
480 template<
class CloudType>
489 cloudCopyPtr_(
nullptr),
491 particleProperties_(
c.particleProperties_),
492 outputProperties_(
c.outputProperties_),
493 solution_(
c.solution_),
494 constProps_(
c.constProps_),
495 subModelProperties_(
c.subModelProperties_),
496 rndGen_(
c.rndGen_,
true),
497 cellOccupancyPtr_(
nullptr),
498 cellLengthScale_(
c.cellLengthScale_),
503 pAmbient_(
c.pAmbient_),
505 functions_(
c.functions_),
506 injectors_(
c.injectors_),
507 dispersionModel_(
c.dispersionModel_->clone()),
508 patchInteractionModel_(
c.patchInteractionModel_->clone()),
509 stochasticCollisionModel_(
c.stochasticCollisionModel_->clone()),
510 surfaceFilmModel_(
c.surfaceFilmModel_->clone()),
512 packingModel_(
c.packingModel_->clone()),
513 dampingModel_(
c.dampingModel_->clone()),
514 isotropyModel_(
c.isotropyModel_->clone()),
516 UIntegrator_(
c.UIntegrator_->clone()),
523 this->
name() +
":UTrans",
552 template<
class CloudType>
562 cloudCopyPtr_(
nullptr),
569 mesh_.time().constant(),
580 name +
"OutputProperties",
581 mesh_.time().timeName(),
582 "uniform"/cloud::prefix/
name,
591 subModelProperties_(),
593 cellOccupancyPtr_(
nullptr),
594 cellLengthScale_(
c.cellLengthScale_),
599 pAmbient_(
c.pAmbient_),
600 forces_(*
this,
mesh),
603 dispersionModel_(
nullptr),
604 patchInteractionModel_(
nullptr),
605 stochasticCollisionModel_(
nullptr),
606 surfaceFilmModel_(
nullptr),
608 packingModel_(
nullptr),
609 dampingModel_(
nullptr),
610 isotropyModel_(
nullptr),
612 UIntegrator_(
nullptr),
620 template<
class CloudType>
624 const scalar lagrangianDt
628 if (constProps_.rho0() != -1)
630 parcel.rho() = constProps_.rho0();
635 template<
class CloudType>
639 const scalar lagrangianDt,
640 const bool fullyDescribed
643 const scalar carrierDt = mesh_.time().deltaTValue();
644 parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
646 if (parcel.typeId() == -1)
648 parcel.typeId() = constProps_.parcelTypeId();
651 if (parcel.rho() == -1)
654 <<
"The kinematic cloud needs rho0 in the constantProperties "
655 <<
" dictionary. " <<
nl
661 template<
class CloudType>
668 clone(this->
name() +
"Copy").ptr()
674 template<
class CloudType>
677 cloudReset(cloudCopyPtr_());
678 cloudCopyPtr_.clear();
682 template<
class CloudType>
685 UTrans().field() =
Zero;
686 UCoeff().field() = 0.0;
690 template<
class CloudType>
699 const scalar coeff = solution_.relaxCoeff(
name);
704 template<
class CloudType>
712 const scalar coeff = solution_.relaxCoeff(
name);
717 template<
class CloudType>
723 this->
relax(UTrans_(), cloudOldTime.
UTrans(),
"U");
724 this->
relax(UCoeff_(), cloudOldTime.
UCoeff(),
"U");
728 template<
class CloudType>
731 this->scale(UTrans_(),
"U");
732 this->scale(UCoeff_(),
"U");
736 template<
class CloudType>
744 label nGeometricD = mesh_.nGeometricD();
746 Info<<
"\nSolving" << nGeometricD <<
"-D cloud " << this->
name() <<
endl;
748 this->dispersion().cacheFields(
true);
749 forces_.cacheFields(
true);
751 pAmbient_ = constProps_.dict().template
752 getOrDefault<scalar>(
"pAmbient", pAmbient_);
754 if (this->dampingModel().active() || this->packingModel().active())
759 if (this->dampingModel().active())
761 this->dampingModel().cacheFields(
true);
763 if (this->packingModel().active())
765 this->packingModel().cacheFields(
true);
768 updateCellOccupancy();
770 functions_.preEvolve(td);
774 template<
class CloudType>
777 if (solution_.canEvolve())
785 template<
class CloudType>
786 template<
class TrackCloudType>
789 TrackCloudType&
cloud,
793 td.part() = parcelType::trackingData::tpLinearTrack;
794 CloudType::move(
cloud, td, solution_.trackTime());
796 if (isotropyModel_->active())
798 td.updateAverages(
cloud);
799 isotropyModel_->calculate();
802 updateCellOccupancy();
806 template<
class CloudType>
821 if (isA<wallPolyPatch>(pp))
823 const label patchi = pp.
index();
824 const label patchFacei = pp.
whichFace(
p.face());
830 if (U_.boundaryField()[patchi].fixesValue())
832 const vector Uw1(U_.boundaryField()[patchi][patchFacei]);
834 U_.oldTime().boundaryField()[patchi][patchFacei];
836 const scalar
f =
p.currentTimeFraction();
838 const vector Uw(Uw0 +
f*(Uw1 - Uw0));
842 Up = (nnw & Up) + Uw - (nnw & Uw);
848 template<
class CloudType>
851 updateCellOccupancy();
852 injectors_.updateMesh();
853 cellLengthScale_ =
mag(
cbrt(mesh_.V()));
857 template<
class CloudType>
866 template<
class CloudType>
869 const vector linearMomentum =
872 const scalar linearKineticEnergy =
877 const scalar particlePerParcel =
885 <<
" Current number of parcels = " << nTotParcel <<
nl
886 <<
" Current mass in system = "
888 <<
" Linear momentum = " << linearMomentum <<
nl
889 <<
" |Linear momentum| = " <<
mag(linearMomentum) <<
nl
890 <<
" Linear kinetic energy = " << linearKineticEnergy <<
nl
891 <<
" Average particle per parcel = " << particlePerParcel <<
nl;
893 injectors_.info(
Info);
895 this->patchInteraction().info(
Info);
897 if (this->packingModel().active())
901 if (this->db().time().writeTime())
906 const scalar alphaMin =
gMin(
alpha().primitiveField());
909 Info<<
" Min cell volume fraction = " << alphaMin <<
endl;
936 Info<<
" Min dense number of parcels = " << nMin <<
endl;
941 template<
class CloudType>
944 parcelType::readObjects(*
this, obr);
948 template<
class CloudType>
951 parcelType::writeObjects(*
this, obr);
int debug
Static debugging option.
void patchData(const parcelType &p, const polyPatch &pp, vector &normal, vector &Up) const
Calculate the patch normal and velocity to interact with,.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void scaleSources()
Apply scaling to (transient) cloud sources.
virtual void writeObjects(objectRegistry &obr) const
Write particle fields as objects into the obr registry.
const word cloudName(propsDict.get< word >("cloud"))
A class for handling words, derived from Foam::string.
void setModels()
Set cloud sub-models.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
const dimensionedScalar mu
Atomic mass unit.
A class for managing temporary objects.
Base class for dispersion modelling.
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimVelocity
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
void relaxSources(const KinematicCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
volScalarField::Internal & UCoeff()
Return coefficient for carrier phase U equation.
void storeState()
Store the current cloud state.
Ostream & endl(Ostream &os)
Add newline and flush stream.
volVectorField::Internal & UTrans()
Return reference to momentum source.
Base class for collisional damping models.
InfoProxy< IOobject > info() const
Return info proxy.
#define forAll(list, i)
Loop across all elements in list.
virtual void readObjects(const objectRegistry &obr)
Read particle fields from objects in the obr registry.
Registry of regIOobjects.
A class for handling keywords in dictionaries.
Virtual abstract base class for templated KinematicCloud.
void evolve()
Evolve the cloud.
Templated base class for kinematic cloud.
Templated patch interaction model class.
Templated stochastic collision model class.
const List< DynamicList< molecule * > > & cellOccupancy
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
Templated wall surface film model class.
messageStream Info
Information stream (stdout output on master, null elsewhere)
A patch is a list of labels that address the faces in the global face list.
regionModels::surfaceFilmModel & surfaceFilm
Wrapper around kinematic parcel types to add collision modelling.
The IOstreamOption is a simple container for options an IOstream can normally have.
DSMCCloud< dsmcParcel > CloudType
dimensionedScalar alphaMax("alphaMax", dimless/dimTime, laminarTransport)
Templated base class for dsmc cloud.
Base class for packing models.
Template class for intrusive linked lists.
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve.
reduce(hasMovingMesh, orOp< bool >())
Mesh data needed to do the Finite Volume discretisation.
const uniformDimensionedVectorField & g
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
label index() const noexcept
The index of this patch in the boundaryMesh.
errorManip< error > abort(error &err)
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
void resetSourceTerms()
Reset the cloud source terms.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
A cloud is a registry collection of lagrangian particles.
void solve(TrackCloudType &cloud, typename parcelType::trackingData &td)
Solve the cloud - calls all evolution functions.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label whichFace(const label l) const
Return label of face in patch from global face label.
void cloudReset(KinematicCloud< CloudType > &c)
Reset state of cloud.
Inter-processor communications stream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void updateMesh()
Update mesh.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
ParcelType::trackingData trackingData
Use base tracking data.
void relax(DimensionedField< Type, volMesh > &field, const DimensionedField< Type, volMesh > &field0, const word &name) const
Relax field.
Base cloud calls templated on particle type.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const dimensionedScalar c
Speed of light in a vacuum.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
void restoreState()
Reset the current cloud to the previously stored state.
void updateCellOccupancy()
Update (i.e. build) the cellOccupancy if it has.
void info()
Print cloud information.
void buildCellOccupancy()
Build the cellOccupancy.
Base class for collisional return-to-isotropy models.
Type gMin(const FieldField< Field, Type > &f)
dimensionedScalar cbrt(const dimensionedScalar &ds)
void evolveCloud(TrackCloudType &cloud, typename parcelType::trackingData &td)
Evolve the cloud.
constant condensation/saturation model.
Type gMax(const FieldField< Field, Type > &f)
void scale(DimensionedField< Type, volMesh > &field, const word &name) const
Scale field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
void postEvolve(const typename parcelType::trackingData &td)
Post-evolve.