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 TrackData>
93 if (solution_.steadyState())
95 td.cloud().storeState();
97 td.cloud().preEvolve();
101 if (solution_.coupled())
103 td.cloud().relaxSources(td.cloud().cloudCopy());
108 td.cloud().preEvolve();
112 if (solution_.coupled())
114 td.cloud().scaleSources();
120 td.cloud().postEvolve();
122 if (solution_.steadyState())
124 td.cloud().restoreState();
129 template<
class CloudType>
132 if (cellOccupancyPtr_.empty())
134 cellOccupancyPtr_.reset
139 else if (cellOccupancyPtr_().size() != mesh_.nCells())
144 cellOccupancyPtr_().setSize(mesh_.nCells());
151 cellOccupancy[cO].
clear();
156 cellOccupancy[iter().cell()].
append(&iter());
161 template<
class CloudType>
167 if (cellOccupancyPtr_.valid())
169 buildCellOccupancy();
174 template<
class CloudType>
175 template<
class TrackData>
178 if (solution_.coupled())
180 td.cloud().resetSourceTerms();
183 if (solution_.transient())
185 label preInjectionSize = this->size();
191 if (preInjectionSize != this->size())
193 updateCellOccupancy();
194 preInjectionSize = this->size();
197 injectors_.inject(td);
202 td.cloud().motion(td);
204 stochasticCollision().update(solution_.trackTime());
210 injectors_.injectSteadyState(td, solution_.trackTime());
212 td.part() = TrackData::tpLinearTrack;
213 CloudType::move(td, solution_.trackTime());
218 template<
class CloudType>
225 this->writePositions();
228 this->dispersion().cacheFields(
false);
230 forces_.cacheFields(
false);
232 functions_.postEvolve();
234 solution_.nextIter();
236 if (this->db().time().writeTime())
238 outputProperties_.writeObject
241 IOstream::currentVersion,
242 this->db().time().writeCompression()
248 template<
class CloudType>
251 CloudType::cloudReset(c);
272 template<
class CloudType>
275 const word& cloudName,
291 cloudName +
"Properties",
292 rho.
mesh().time().constant(),
294 IOobject::MUST_READ_IF_MODIFIED,
302 cloudName +
"OutputProperties",
303 mesh_.time().timeName(),
306 IOobject::READ_IF_PRESENT,
310 solution_(mesh_, particleProperties_.subDict(
"solution")),
311 constProps_(particleProperties_),
314 particleProperties_.subOrEmptyDict(
"subModels", solution_.active())
319 solution_.steadyState() ?
320 particleProperties_.lookupOrDefault<
label>(
"randomSampleSize", 100000)
324 cellLengthScale_(
cbrt(mesh_.V())),
334 subModelProperties_.subOrEmptyDict
344 particleProperties_.subOrEmptyDict(
"cloudFunctions"),
349 subModelProperties_.subOrEmptyDict(
"injectionModels"),
352 dispersionModel_(NULL),
353 patchInteractionModel_(NULL),
354 stochasticCollisionModel_(NULL),
355 surfaceFilmModel_(NULL),
363 this->
name() +
":UTrans",
366 IOobject::READ_IF_PRESENT,
379 this->
name() +
":UCoeff",
382 IOobject::READ_IF_PRESENT,
390 if (solution_.active())
400 if (solution_.resetSourcesOnStartup())
407 template<
class CloudType>
424 cellOccupancyPtr_(NULL),
445 this->
name() +
":UTrans",
474 template<
class CloudType>
502 name +
"OutputProperties",
503 mesh_.time().timeName(),
504 "uniform"/cloud::prefix/
name,
513 subModelProperties_(dictionary::null),
515 cellOccupancyPtr_(NULL),
522 forces_(*
this, mesh),
525 dispersionModel_(NULL),
526 patchInteractionModel_(NULL),
527 stochasticCollisionModel_(NULL),
528 surfaceFilmModel_(NULL),
537 template<
class CloudType>
544 template<
class CloudType>
551 template<
class CloudType>
555 const scalar lagrangianDt
558 parcel.rho() = constProps_.rho0();
562 template<
class CloudType>
566 const scalar lagrangianDt,
567 const bool fullyDescribed
570 const scalar carrierDt = mesh_.time().deltaTValue();
571 parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
573 if (parcel.typeId() == -1)
575 parcel.typeId() = constProps_.parcelTypeId();
580 template<
class CloudType>
587 clone(this->
name() +
"Copy").ptr()
593 template<
class CloudType>
596 cloudReset(cloudCopyPtr_());
597 cloudCopyPtr_.clear();
601 template<
class CloudType>
604 UTrans().field() =
Zero;
605 UCoeff().field() = 0.0;
609 template<
class CloudType>
618 const scalar coeff = solution_.relaxCoeff(name);
619 field = field0 + coeff*(field - field0);
623 template<
class CloudType>
631 const scalar coeff = solution_.relaxCoeff(name);
636 template<
class CloudType>
642 this->
relax(UTrans_(), cloudOldTime.
UTrans(),
"U");
643 this->
relax(UCoeff_(), cloudOldTime.
UCoeff(),
"U");
647 template<
class CloudType>
650 this->scale(UTrans_(),
"U");
651 this->scale(UCoeff_(),
"U");
655 template<
class CloudType>
660 label nGeometricD = mesh_.nGeometricD();
662 Info<<
"\nSolving " << nGeometricD <<
"-D cloud " << this->
name() <<
endl;
664 this->dispersion().cacheFields(
true);
665 forces_.cacheFields(
true);
666 updateCellOccupancy();
668 pAmbient_ = constProps_.dict().template
669 lookupOrDefault<scalar>(
"pAmbient", pAmbient_);
671 functions_.preEvolve();
675 template<
class CloudType>
678 if (solution_.canEvolve())
680 typename parcelType::template
681 TrackingData<KinematicCloud<CloudType>> td(*
this);
688 template<
class CloudType>
689 template<
class TrackData>
692 td.part() = TrackData::tpLinearTrack;
693 CloudType::move(td, solution_.trackTime());
695 updateCellOccupancy();
699 template<
class CloudType>
704 const scalar trackFraction,
726 if (isA<wallPolyPatch>(pp))
737 vector U00 = U_.oldTime().boundaryField()[
patchi][patchFacei];
744 if (
mag(n00) > SMALL)
787 - (p.stepFraction()*trackFraction);
795 const vector& Cf = mesh_.faceCentres()[p.face()];
797 vector Cf00 = mesh_.faces()[p.face()].
centre(mesh_.oldPoints());
799 if (isA<wallPolyPatch>(pp))
801 Up = U00 + m*(U - U00);
805 Up = (Cf - Cf00)/mesh_.time().deltaTValue();
817 vector Cfi = Cf00 + m*(Cf - Cf00);
822 scalar magOmega =
mag(omega);
827 omega *=
Foam::asin(magOmega)/(magOmega*mesh_.time().deltaTValue());
833 - ((p.position() - Cfi) & nw)*nw
836 Up += (omega ^ facePos);
845 template<
class CloudType>
848 updateCellOccupancy();
849 injectors_.updateMesh();
850 cellLengthScale_ =
cbrt(mesh_.V());
854 template<
class CloudType>
867 template<
class CloudType>
870 vector linearMomentum = linearMomentumOfSystem();
873 scalar linearKineticEnergy = linearKineticEnergyOfSystem();
877 <<
" Current number of parcels = " 879 <<
" Current mass in system = " 881 <<
" Linear momentum = " 882 << linearMomentum <<
nl 883 <<
" |Linear momentum| = " 884 <<
mag(linearMomentum) <<
nl 885 <<
" Linear kinetic energy = " 886 << linearKineticEnergy <<
nl;
888 injectors_.info(
Info);
890 this->patchInteraction().info(
Info);
autoPtr< DimensionedField< vector, volMesh > > UTrans_
Momentum.
#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.
label whichFace(const label l) const
Return label of face in patch from global face label.
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 scale(DimensionedField< Type, volMesh > &field, const word &name) const
Scale field.
void storeState()
Store the current cloud state.
autoPtr< PatchInteractionModel< KinematicCloud< CloudType > > > patchInteractionModel_
Patch interaction model.
InjectionModelList< KinematicCloud< CloudType > > injectors_
Injector models.
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
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 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.
DimensionedField< vector, volMesh > & UTrans()
Return reference to momentum source.
void postEvolve()
Post-evolve.
const word cloudName(propsDict.lookup("cloudName"))
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
autoPtr< SurfaceFilmModel< KinematicCloud< CloudType > > > surfaceFilmModel_
Surface film model.
void relax(DimensionedField< Type, volMesh > &field, const DimensionedField< Type, volMesh > &field0, const word &name) const
Relax field.
void updateCellOccupancy()
Update (i.e. build) the cellOccupancy if it has.
dimensionedScalar asin(const dimensionedScalar &ds)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void buildCellOccupancy()
Build the cellOccupancy.
const volScalarField & rho_
Density [kg/m3].
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.
Templated patch interaction model class.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
void updateMesh()
Update mesh.
const volScalarField & mu_
Dynamic viscosity [Pa.s].
DimensionedField< scalar, volMesh > & 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...
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void resetSourceTerms()
Reset the cloud source terms.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
void append(const T &)
Append an element at the end of the list.
dimensionedScalar cbrt(const dimensionedScalar &ds)
scalar pAmbient_
Averaged ambient domain pressure.
triPointRef oldFaceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
parcelType::constantProperties constProps_
Parcel constant properties.
const fvMesh & mesh_
References to the mesh and time databases.
const word & constant() const
Return constant name.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
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.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Templated wall surface film model class.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void evolveCloud(TrackData &td)
Evolve the cloud.
word name(const complex &)
Return a string representation of a complex.
void motion(TrackData &td)
Particle motion.
Virtual abstract base class for templated KinematicCloud.
cloudSolution solution_
Solution properties.
Templated base class for kinematic cloud.
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.
const Mesh & mesh() const
Return mesh.
void patchData(const parcelType &p, const polyPatch &pp, const scalar trackFraction, const tetIndices &tetIs, 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.
void info()
Print cloud information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual bool hasWallImpactDistance() const
Switch to specify if particles of the cloud can return.
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.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
filmModelType & surfaceFilm
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(TrackData &td)
Solve the cloud - calls all evolution functions.
label index() const
Return the index of this patch in the boundaryMesh.
cachedRandom rndGen_
Random number generator - used by some injection routines.
autoPtr< StochasticCollisionModel< KinematicCloud< CloudType > > > stochasticCollisionModel_
Stochastic collision model.
autoPtr< DimensionedField< scalar, volMesh > > UCoeff_
Coefficient for carrier phase U equation.
const Time & time() const
Return the top-level database.
vector normal() const
Return vector normal.
autoPtr< vectorIntegrationScheme > UIntegrator_
Velocity integration.
const dimensionSet dimVelocity
scalarField cellLengthScale_
Cell length scale.