Go to the documentation of this file.
43 template<
class CloudType>
46 dispersionModel_.reset
55 patchInteractionModel_.reset
64 stochasticCollisionModel_.reset
73 surfaceFilmModel_.reset
87 solution_.integrationSchemes()
93 template<
class CloudType>
94 template<
class TrackCloudType>
97 TrackCloudType&
cloud,
103 if (solution_.steadyState())
109 evolveCloud(
cloud, td);
111 if (solution_.coupled())
120 evolveCloud(
cloud, td);
122 if (solution_.coupled())
124 cloud.scaleSources();
132 if (solution_.steadyState())
134 cloud.restoreState();
139 template<
class CloudType>
142 if (cellOccupancyPtr_.empty())
144 cellOccupancyPtr_.reset
149 else if (cellOccupancyPtr_().size() != mesh_.nCells())
154 cellOccupancyPtr_().setSize(mesh_.nCells());
171 template<
class CloudType>
177 if (cellOccupancyPtr_.valid())
179 buildCellOccupancy();
184 template<
class CloudType>
185 template<
class TrackCloudType>
188 TrackCloudType&
cloud,
192 if (solution_.coupled())
194 cloud.resetSourceTerms();
197 if (solution_.transient())
199 label preInjectionSize = this->size();
205 if (preInjectionSize != this->size())
207 updateCellOccupancy();
208 preInjectionSize = this->size();
211 injectors_.inject(
cloud, td);
218 stochasticCollision().update(td, solution_.trackTime());
224 injectors_.injectSteadyState(
cloud, td, solution_.trackTime());
226 td.part() = parcelType::trackingData::tpLinearTrack;
227 CloudType::move(
cloud, td, solution_.trackTime());
232 template<
class CloudType>
239 this->writePositions();
242 this->dispersion().cacheFields(
false);
244 forces_.cacheFields(
false);
246 functions_.postEvolve();
248 solution_.nextIter();
250 if (this->db().time().writeTime())
252 outputProperties_.writeObject
255 IOstream::currentVersion,
256 this->db().time().writeCompression(),
263 template<
class CloudType>
266 CloudType::cloudReset(
c);
270 forces_.transfer(
c.forces_);
272 functions_.transfer(
c.functions_);
274 injectors_.transfer(
c.injectors_);
276 dispersionModel_.reset(
c.dispersionModel_.ptr());
277 patchInteractionModel_.reset(
c.patchInteractionModel_.ptr());
278 stochasticCollisionModel_.reset(
c.stochasticCollisionModel_.ptr());
279 surfaceFilmModel_.reset(
c.surfaceFilmModel_.ptr());
281 UIntegrator_.reset(
c.UIntegrator_.ptr());
287 template<
class CloudType>
300 cloudCopyPtr_(
nullptr),
307 rho.mesh().time().constant(),
309 IOobject::MUST_READ_IF_MODIFIED,
318 mesh_.time().timeName(),
321 IOobject::READ_IF_PRESENT,
325 solution_(mesh_, particleProperties_.subDict(
"solution")),
326 constProps_(particleProperties_),
329 particleProperties_.subOrEmptyDict
336 rndGen_(Pstream::myProcNo()),
338 cellLengthScale_(
mag(
cbrt(mesh_.V()))),
348 subModelProperties_.subOrEmptyDict
359 particleProperties_.subOrEmptyDict(
"cloudFunctions"),
364 subModelProperties_.subOrEmptyDict(
"injectionModels"),
367 dispersionModel_(
nullptr),
368 patchInteractionModel_(
nullptr),
369 stochasticCollisionModel_(
nullptr),
370 surfaceFilmModel_(
nullptr),
371 UIntegrator_(
nullptr),
378 this->
name() +
":UTrans",
381 IOobject::READ_IF_PRESENT,
394 this->
name() +
":UCoeff",
397 IOobject::READ_IF_PRESENT,
405 if (solution_.active())
412 this->deleteLostParticles();
416 if (solution_.resetSourcesOnStartup())
423 template<
class CloudType>
432 cloudCopyPtr_(
nullptr),
434 particleProperties_(
c.particleProperties_),
435 outputProperties_(
c.outputProperties_),
436 solution_(
c.solution_),
437 constProps_(
c.constProps_),
438 subModelProperties_(
c.subModelProperties_),
439 rndGen_(
c.rndGen_,
true),
440 cellOccupancyPtr_(
nullptr),
441 cellLengthScale_(
c.cellLengthScale_),
446 pAmbient_(
c.pAmbient_),
448 functions_(
c.functions_),
449 injectors_(
c.injectors_),
450 dispersionModel_(
c.dispersionModel_->clone()),
451 patchInteractionModel_(
c.patchInteractionModel_->clone()),
452 stochasticCollisionModel_(
c.stochasticCollisionModel_->clone()),
453 surfaceFilmModel_(
c.surfaceFilmModel_->clone()),
454 UIntegrator_(
c.UIntegrator_->clone()),
461 this->
name() +
":UTrans",
490 template<
class CloudType>
500 cloudCopyPtr_(
nullptr),
507 mesh.time().constant(),
518 name +
"OutputProperties",
519 mesh_.time().timeName(),
520 "uniform"/cloud::prefix/
name,
529 subModelProperties_(dictionary::null),
531 cellOccupancyPtr_(
nullptr),
532 cellLengthScale_(
c.cellLengthScale_),
537 pAmbient_(
c.pAmbient_),
538 forces_(*
this,
mesh),
541 dispersionModel_(
nullptr),
542 patchInteractionModel_(
nullptr),
543 stochasticCollisionModel_(
nullptr),
544 surfaceFilmModel_(
nullptr),
545 UIntegrator_(
nullptr),
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);
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())
689 template<
class CloudType>
690 template<
class TrackCloudType>
693 TrackCloudType&
cloud,
697 td.part() = parcelType::trackingData::tpLinearTrack;
698 CloudType::move(
cloud, td, solution_.trackTime());
700 updateCellOccupancy();
704 template<
class CloudType>
719 if (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();
751 cellLengthScale_ =
mag(
cbrt(mesh_.V()));
755 template<
class CloudType>
764 template<
class CloudType>
767 const vector linearMomentum =
770 const scalar linearKineticEnergy =
775 const scalar particlePerParcel =
783 <<
" Current number of parcels = " << nTotParcel <<
nl
784 <<
" Current mass in system = "
786 <<
" Linear momentum = " << linearMomentum <<
nl
787 <<
" |Linear momentum| = " <<
mag(linearMomentum) <<
nl
788 <<
" Linear kinetic energy = " << linearKineticEnergy <<
nl
789 <<
" Average particle per parcel = " << particlePerParcel <<
nl;
791 injectors_.info(
Info);
793 this->patchInteraction().info(
Info);
797 template<
class CloudType>
800 parcelType::readObjects(*
this, obr);
804 template<
class CloudType>
807 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.
Base class for dispersion modelling.
static constexpr const zero Zero
Global zero.
const dimensionSet dimVelocity
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
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.
InfoProxy< IOobject > info() const
Return info proxy.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
virtual void readObjects(const objectRegistry &obr)
Read particle fields from objects in the obr registry.
Registry of regIOobjects.
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
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 (uses stdout - output is on the master only)
A patch is a list of labels that address the faces in the global face list.
word name(const complex &c)
Return string representation of complex.
regionModels::surfaceFilmModel & surfaceFilm
Wrapper around kinematic parcel types to add collision modelling.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
DSMCCloud< dsmcParcel > CloudType
Template class for intrusive linked lists.
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
Mesh data needed to do the Finite Volume discretisation.
const uniformDimensionedVectorField & g
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
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.
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.
void postEvolve()
Post-evolve.
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.
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.
dimensionedScalar cbrt(const dimensionedScalar &ds)
void evolveCloud(TrackCloudType &cloud, typename parcelType::trackingData &td)
Evolve the cloud.
label index() const
The index of this patch in the boundaryMesh.
void preEvolve()
Pre-evolve.
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...