Go to the documentation of this file.
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());
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().outputTime())
238 outputProperties_.writeObject
241 IOstream::currentVersion,
242 this->db().time().writeCompression()
248 template<
class CloudType>
251 CloudType::cloudReset(
c);
255 forces_.transfer(
c.forces_);
257 functions_.transfer(
c.functions_);
259 injectors_.transfer(
c.injectors_);
261 dispersionModel_.reset(
c.dispersionModel_.ptr());
262 patchInteractionModel_.reset(
c.patchInteractionModel_.ptr());
263 stochasticCollisionModel_.reset(
c.stochasticCollisionModel_.ptr());
264 surfaceFilmModel_.reset(
c.surfaceFilmModel_.ptr());
266 UIntegrator_.reset(
c.UIntegrator_.ptr());
272 template<
class CloudType>
292 rho.mesh().time().constant(),
294 IOobject::MUST_READ_IF_MODIFIED,
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>
418 particleProperties_(
c.particleProperties_),
419 outputProperties_(
c.outputProperties_),
420 solution_(
c.solution_),
421 constProps_(
c.constProps_),
422 subModelProperties_(
c.subModelProperties_),
423 rndGen_(
c.rndGen_,
true),
424 cellOccupancyPtr_(NULL),
425 cellLengthScale_(
c.cellLengthScale_),
430 pAmbient_(
c.pAmbient_),
432 functions_(
c.functions_),
433 injectors_(
c.injectors_),
434 dispersionModel_(
c.dispersionModel_->clone()),
435 patchInteractionModel_(
c.patchInteractionModel_->clone()),
436 stochasticCollisionModel_(
c.stochasticCollisionModel_->clone()),
437 surfaceFilmModel_(
c.surfaceFilmModel_->clone()),
438 UIntegrator_(
c.UIntegrator_->clone()),
445 this->
name() +
":UTrans",
474 template<
class CloudType>
491 mesh.time().constant(),
502 name +
"OutputProperties",
503 mesh_.time().timeName(),
504 "uniform"/cloud::prefix/
name,
513 subModelProperties_(dictionary::null),
515 cellOccupancyPtr_(NULL),
516 cellLengthScale_(
c.cellLengthScale_),
521 pAmbient_(
c.pAmbient_),
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() = vector::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,
716 vector U = U_.boundaryField()[patchI][patchFaceI];
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);
DimensionedField< scalar, volMesh > & UCoeff()
Return coefficient for carrier phase U equation.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void scaleSources()
Apply scaling to (transient) cloud sources.
A class for handling words, derived from string.
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void setModels()
Set cloud sub-models.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const dimensionedScalar mu
Atomic mass unit.
#define forAll(list, i)
Loop across all elements in list.
const dimensionSet dimVelocity
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,.
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.
void storeState()
Store the current cloud state.
triPointRef oldFaceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
const dimensionedVector & g
Ostream & endl(Ostream &os)
Add newline and flush stream.
void solve(TrackData &td)
Solve the cloud - calls all evolution functions.
dimensioned< scalar > mag(const dimensioned< Type > &)
This function object reads fields from the time directories and adds them to the mesh database for fu...
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
void motion(TrackData &td)
Particle motion.
Virtual abstract base class for templated KinematicCloud.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void evolve()
Evolve the cloud.
Templated base class for kinematic cloud.
Templated patch interaction model class.
virtual bool hasWallImpactDistance() const
Switch to specify if particles of the cloud can return.
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.
Intrusive doubly-linked list.
vector normal() const
Return vector normal.
const List< DynamicList< molecule * > > & cellOccupancy
virtual ~KinematicCloud()
Destructor.
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the.
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
Templated wall surface film model class.
A patch is a list of labels that address the faces in the global face list.
DimensionedField< vector, volMesh > & UTrans()
Return reference to momentum source.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt > > &) const
Return *this (used for point which is a typedef to Vector<scalar>.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
DSMCCloud< dsmcParcel > CloudType
void evolveCloud(TrackData &td)
Evolve the cloud.
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
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 resetSourceTerms()
Reset the cloud source terms.
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
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.
void readFields(const boolList &haveMesh, const fvMesh &mesh, const autoPtr< fvMeshSubset > &subsetterPtr, IOobjectList &allObjects, PtrList< GeoField > &fields)
void relax(DimensionedField< Type, volMesh > &field, const DimensionedField< Type, volMesh > &field0, const word &name) const
Relax field.
Base cloud calls templated on particle type.
filmModelType & surfaceFilm
KinematicCloud(const KinematicCloud &)
Disallow default bitwise copy construct.
const word cloudName(propsDict.lookup("cloudName"))
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.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
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)
Generic GeometricField class.
label index() const
Return the index of this patch in the boundaryMesh.
dimensionedScalar asin(const dimensionedScalar &ds)
word name(const complex &)
Return a string representation of a complex.
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...