39 template<
class CloudType>
42 dispersionModel_.reset
51 patchInteractionModel_.reset
60 stochasticCollisionModel_.reset
83 solution_.integrationSchemes()
89 template<
class CloudType>
90 template<
class TrackCloudType>
93 TrackCloudType&
cloud,
94 typename parcelType::trackingData& td
97 this->changeTimeStep();
99 if (solution_.steadyState())
106 if (solution_.coupled())
108 cloud.resetSourceTerms();
111 if (solution_.transient())
113 label preInjectionSize = this->size();
115 this->surfaceFilm().inject(
cloud);
119 if (preInjectionSize != this->size())
121 updateCellOccupancy();
122 preInjectionSize = this->size();
125 injectors_.inject(
cloud, td);
131 stochasticCollision().update(td);
135 injectors_.injectSteadyState(
cloud, td);
137 CloudType::move(
cloud, td);
140 if (solution_.coupled() && solution_.transient())
142 cloud.scaleSources();
145 if (solution_.coupled() && solution_.steadyState())
154 if (solution_.steadyState())
156 cloud.restoreState();
161 template<
class CloudType>
164 if (cellOccupancyPtr_.empty())
166 cellOccupancyPtr_.reset
171 else if (cellOccupancyPtr_().size() != this->mesh().nCells())
176 cellOccupancyPtr_().setSize(this->mesh().nCells());
193 template<
class CloudType>
199 if (cellOccupancyPtr_.valid())
201 buildCellOccupancy();
206 template<
class CloudType>
213 this->writePositions();
216 this->dispersion().cacheFields(
false);
218 forces_.cacheFields(
false);
220 functions_.postEvolve();
222 solution_.nextIter();
224 if (this->db().time().writeTime())
226 outputProperties_.writeObject
229 IOstream::currentVersion,
230 this->db().time().writeCompression(),
237 template<
class CloudType>
240 CloudType::cloudReset(
c);
244 forces_.transfer(
c.forces_);
246 functions_.transfer(
c.functions_);
248 injectors_.transfer(
c.injectors_);
250 dispersionModel_.reset(
c.dispersionModel_.ptr());
251 patchInteractionModel_.reset(
c.patchInteractionModel_.ptr());
252 stochasticCollisionModel_.reset(
c.stochasticCollisionModel_.ptr());
253 filmModel_.reset(
c.filmModel_.ptr());
255 UIntegrator_.reset(
c.UIntegrator_.ptr());
261 template<
class CloudType>
273 cloudCopyPtr_(nullptr),
279 this->mesh().time().constant(),
290 this->mesh().time().
name(),
297 solution_(this->mesh(), particleProperties_.subDict(
"solution")),
298 constProps_(particleProperties_),
301 particleProperties_.subOrEmptyDict(
"subModels", true)
305 cellLengthScale_(
mag(
cbrt(this->mesh().V()))),
315 subModelProperties_.subOrEmptyDict
325 particleProperties_.subOrEmptyDict(
"cloudFunctions"),
330 subModelProperties_.subOrEmptyDict(
"injectionModels"),
333 dispersionModel_(nullptr),
334 patchInteractionModel_(nullptr),
335 stochasticCollisionModel_(nullptr),
337 UIntegrator_(nullptr),
344 this->
name() +
":UTrans",
345 this->db().time().
name(),
360 this->
name() +
":UCoeff",
361 this->db().time().
name(),
386 template<
class CloudType>
401 template<
class CloudType>
409 cloudCopyPtr_(nullptr),
410 particleProperties_(
c.particleProperties_),
411 outputProperties_(
c.outputProperties_),
412 solution_(
c.solution_),
413 constProps_(
c.constProps_),
414 subModelProperties_(
c.subModelProperties_),
416 cellOccupancyPtr_(nullptr),
417 cellLengthScale_(
c.cellLengthScale_),
422 pAmbient_(
c.pAmbient_),
424 functions_(
c.functions_),
425 injectors_(
c.injectors_),
426 dispersionModel_(
c.dispersionModel_->
clone()),
427 patchInteractionModel_(
c.patchInteractionModel_->
clone()),
428 stochasticCollisionModel_(
c.stochasticCollisionModel_->
clone()),
429 filmModel_(
c.filmModel_->
clone()),
430 UIntegrator_(
c.UIntegrator_->
clone()),
437 this->
name() +
":UTrans",
438 this->db().time().
name(),
454 this->db().time().
name(),
466 template<
class CloudType>
475 cloudCopyPtr_(nullptr),
481 mesh.time().constant(),
492 name +
"OutputProperties",
493 this->mesh().time().
name(),
505 cellOccupancyPtr_(nullptr),
506 cellLengthScale_(
c.cellLengthScale_),
511 pAmbient_(
c.pAmbient_),
512 forces_(*this, mesh),
515 dispersionModel_(nullptr),
516 patchInteractionModel_(nullptr),
517 stochasticCollisionModel_(nullptr),
519 UIntegrator_(nullptr),
527 template<
class CloudType>
534 template<
class CloudType>
540 parcel.rho() = constProps_.rho0();
544 template<
class CloudType>
548 const label injectori
551 if (parcel.typeId() == -1)
553 parcel.typeId() = constProps_.parcelTypeId();
558 template<
class CloudType>
571 template<
class CloudType>
574 cloudReset(cloudCopyPtr_());
575 cloudCopyPtr_.clear();
579 template<
class CloudType>
582 UTransRef().field() =
Zero;
583 UCoeffRef().field() = 0.0;
587 template<
class CloudType>
596 const scalar coeff = solution_.relaxCoeff(
name);
597 field = field0 + coeff*(field - field0);
601 template<
class CloudType>
609 const scalar coeff = solution_.relaxCoeff(
name);
614 template<
class CloudType>
625 template<
class CloudType>
628 this->scale(UTrans_(),
"U");
629 this->scale(UCoeff_(),
"U");
633 template<
class CloudType>
638 label nGeometricD = this->mesh().nGeometricD();
640 Info<<
nl <<
"Solving " << nGeometricD <<
"-D cloud " << this->
name()
643 this->dispersion().cacheFields(
true);
644 forces_.cacheFields(
true);
645 updateCellOccupancy();
647 pAmbient_ = constProps_.dict().template
648 lookupOrDefault<scalar>(
"pAmbient", pAmbient_);
650 functions_.preEvolve();
654 template<
class CloudType>
657 if (solution_.canEvolve())
659 typename parcelType::trackingData td(*
this);
666 template<
class CloudType>
667 template<
class TrackCloudType>
670 TrackCloudType&
cloud,
671 typename parcelType::trackingData& td
676 updateCellOccupancy();
680 template<
class CloudType>
689 p.patchData(this->mesh(), nw, Up);
690 Up /= this->mesh().time().deltaTValue();
696 if (!this->mesh().moving() && isA<wallPolyPatch>(pp))
705 if (U_.boundaryField()[
patchi].fixesValue())
707 const vector Uw1 = U_.boundaryField()[
patchi][patchFacei];
709 U_.oldTime().boundaryField()[
patchi][patchFacei];
711 const vector Uw = Uw0 +
p.stepFraction()*(Uw1 - Uw0);
715 Up = (nnw & Up) + Uw - (nnw & Uw);
721 template<
class CloudType>
726 updateCellOccupancy();
728 injectors_.topoChange();
730 cellLengthScale_ =
mag(
cbrt(this->mesh().V()));
734 template<
class CloudType>
739 updateCellOccupancy();
741 injectors_.topoChange();
743 cellLengthScale_ =
mag(
cbrt(this->mesh().V()));
747 template<
class CloudType>
752 updateCellOccupancy();
754 injectors_.topoChange();
756 cellLengthScale_ =
mag(
cbrt(this->mesh().V()));
760 template<
class CloudType>
763 vector linearMomentum = linearMomentumOfSystem();
766 scalar linearKineticEnergy = linearKineticEnergyOfSystem();
770 <<
" Current number of parcels = "
772 <<
" Current mass in system = "
774 <<
" Linear momentum = "
775 << linearMomentum <<
nl
776 <<
" |Linear momentum| = "
777 <<
mag(linearMomentum) <<
nl
778 <<
" Linear kinetic energy = "
779 << linearKineticEnergy <<
nl;
781 injectors_.info(
Info);
782 this->surfaceFilm().info(
Info);
783 this->patchInteraction().info(
Info);
#define forAll(list, i)
Loop across all elements in list.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
const List< DynamicList< molecule * > > & cellOccupancy
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
void deleteLostParticles()
Remove lost particles from cloud and delete.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
void move(TrackCloudType &cloud, typename ParticleType::trackingData &td)
Move the particles.
Templated base class for dsmc cloud.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
InfoProxy< IOobject > info() const
Return info proxy.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Templated base class for momentum cloud.
void postEvolve()
Post-evolve.
cloudSolution solution_
Solution properties.
autoPtr< volVectorField::Internal > UTrans_
Momentum.
void setModels()
Set cloud sub-models.
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
virtual ~MomentumCloud()
Destructor.
void scale(DimensionedField< Type, volMesh > &field, const word &name) const
Scale field.
void storeState()
Store the current cloud state.
void patchData(const parcelType &p, const polyPatch &pp, vector &normal, vector &Up) const
Calculate the patch normal and velocity to interact with,.
void relax(DimensionedField< Type, volMesh > &field, const DimensionedField< Type, volMesh > &field0, const word &name) const
Relax field.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
void scaleSources()
Apply scaling to (transient) cloud sources.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
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 updateCellOccupancy()
Update (i.e. build) the cellOccupancy if it has.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
void evolve()
Evolve the cloud.
void cloudReset(MomentumCloud< CloudType > &c)
Reset state of cloud.
void info()
Print cloud information.
void restoreState()
Reset the current cloud to the previously stored state.
void checkParcelProperties(parcelType &parcel, const label injectori)
Check parcel properties.
void preEvolve()
Pre-evolve.
void resetSourceTerms()
Reset the cloud source terms.
void buildCellOccupancy()
Build the cellOccupancy.
autoPtr< volScalarField::Internal > UCoeff_
Coefficient for carrier phase U equation.
void setParcelThermoProperties(parcelType &parcel)
Set parcel thermo properties.
void relaxSources(const MomentumCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
void solve(TrackCloudType &cloud, typename parcelType::trackingData &td)
Solve the cloud - calls all evolution functions.
Templated patch interaction model class.
Templated stochastic collision model class.
Templated wall surface film model class.
const Switch resetSourcesOnStartup() const
Return const access to the reset sources flag.
A cloud is a collection of lagrangian particles.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Base-class for fluid thermodynamic properties.
Mesh data needed to do the Finite Volume discretisation.
label index() const
Return the index of this patch in the boundaryMesh.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
A patch is a list of labels that address the faces in the global face list.
label whichFace(const label l) const
Return label of face in patch from global face label.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
const dimensionedScalar mu
Atomic mass unit.
const dimensionedScalar c
Speed of light in a vacuum.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensioned< scalar > mag(const dimensioned< Type > &)
const dimensionSet dimMass
const dimensionSet dimVelocity
dimensionedScalar cbrt(const dimensionedScalar &ds)
word name(const complex &)
Return a string representation of a complex.
SolverPerformance< Type > solve(fvMatrix< Type > &, const word &)
Solve returning the solution statistics given convergence tolerance.
const word cloudName(propsDict.lookup("cloudName"))