35 template<
class CloudType>
40 scalar& newVolumeFraction
45 newVolumeFraction = 0.0;
46 bool validInjection =
false;
52 return validInjection;
56 scalar t0 = timeStep0_ - SOI_;
57 scalar t1 = time - SOI_;
60 newParcels = this->parcelsToInject(t0, t1);
64 this->volumeToInject(t0, t1)
65 /(volumeTotal_ + rootVSmall);
67 if (newVolumeFraction > 0)
72 validInjection =
true;
78 validInjection =
false;
84 validInjection =
false;
87 return validInjection;
91 template<
class CloudType>
103 const vector p0 = position;
105 this->owner().mesh().findCellFacePt
135 celli = this->owner().mesh().findNearestCell(position);
139 position += small*(cellCentres[celli] - position);
141 this->owner().mesh().findCellFacePt
170 <<
"Cannot find parcel injection cell. " 171 <<
"Parcel position = " << p0 <<
nl 184 template<
class CloudType>
188 const scalar volumeFraction,
189 const scalar diameter,
194 switch (parcelBasis_)
198 scalar volumep =
pi/6.0*
pow3(diameter);
199 scalar volumeTot = massTotal_/
rho;
201 nP = volumeFraction*volumeTot/(parcels*volumep);
206 nP = massTotal_/(rho*volumeTotal_);
211 nP = nParticleFixed_;
218 <<
"Unknown parcelBasis type" <<
nl 227 template<
class CloudType>
230 const label parcelsAdded,
231 const scalar massAdded
236 if (allParcelsAdded > 0)
239 <<
"Cloud: " << this->owner().name()
240 <<
" injector: " << this->modelName() <<
nl 241 <<
" Added " << allParcelsAdded <<
" new parcels" <<
nl <<
endl;
245 parcelsAddedTotal_ += allParcelsAdded;
251 time0_ = this->owner().db().time().value();
260 template<
class CloudType>
267 massFlowRate_(owner.db().time(),
"massFlowRate"),
268 massInjected_(this->template getModelProperty<scalar>(
"massInjected")),
269 nInjections_(this->template getModelProperty<
label>(
"nInjections")),
272 this->template getModelProperty<scalar>(
"parcelsAddedTotal")
274 parcelBasis_(pbNumber),
275 nParticleFixed_(0.0),
277 timeStep0_(this->template getModelProperty<scalar>(
"timeStep0"))
281 template<
class CloudType>
286 const word& modelName,
287 const word& modelType
295 massInjected_(this->
template getModelProperty<scalar>(
"massInjected")),
296 nInjections_(this->
template getModelProperty<scalar>(
"nInjections")),
299 this->
template getModelProperty<scalar>(
"parcelsAddedTotal")
303 time0_(owner.db().time().value()),
304 timeStep0_(this->
template getModelProperty<scalar>(
"timeStep0"))
309 Info<<
" Constructing " << owner.mesh().nGeometricD() <<
"-D injection" 312 if (owner.solution().transient())
316 SOI_ = owner.db().time().userTimeToTime(
SOI_);
326 if (parcelBasisType ==
"mass")
330 else if (parcelBasisType ==
"number")
334 else if (parcelBasisType ==
"fixed")
338 Info<<
" Choosing nParticle to be a fixed value, massTotal " 339 <<
"variable now does not determine anything." 343 this->
coeffDict().template lookup<scalar>(
"nParticle");
348 <<
"parcelBasisType must be either 'number', 'mass' or 'fixed'" 354 template<
class CloudType>
377 template<
class CloudType>
384 template<
class CloudType>
389 template<
class CloudType>
406 template<
class CloudType>
407 template<
class TrackCloudType>
410 TrackCloudType& cloud,
411 typename CloudType::parcelType::trackingData& td
417 label parcelsAdded = 0;
418 scalar massAdded = 0.0;
419 label newParcels = 0;
420 scalar newVolumeFraction = 0.0;
424 const scalar trackTime = this->
owner().solution().trackTime();
428 const scalar deltaT =
435 for (
label parcelI = 0; parcelI < newParcels; parcelI++)
440 scalar timeInj =
time0_ + padTime + deltaT*parcelI/newParcels;
464 const scalar dt = time - timeInj;
473 cloud.setParcelThermoProperties(*pPtr, dt);
501 massAdded += pPtr->nParticle()*pPtr->mass();
503 if (pPtr->move(cloud, td, dt))
505 cloud.addParticle(pPtr);
520 template<
class CloudType>
521 template<
class TrackCloudType>
524 TrackCloudType& cloud,
525 typename CloudType::parcelType::trackingData& td,
526 const scalar trackTime
535 label parcelsAdded = 0;
536 scalar massAdded = 0.0;
542 for (
label parcelI = 0; parcelI < newParcels; parcelI++)
545 scalar newVolumeFraction = 1.0/scalar(newParcels);
575 cloud.setParcelThermoProperties(*pPtr, 0.0);
597 cloud.addParticle(pPtr);
599 massAdded += pPtr->nParticle()*pPtr->mass();
608 template<
class CloudType>
scalar massTotal_
Total mass to inject [kg].
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void injectSteadyState(TrackCloudType &cloud, typename CloudType::parcelType::trackingData &td, const scalar trackTime)
Main injection loop - steady-state.
scalar time0_
Continuous phase time at start of injection time step [s].
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual void postInjectCheck(const label parcelsAdded, const scalar massAdded)
Post injection checks.
virtual scalar averageParcelMass()
Return the average parcel mass over the injection period.
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Templated injection model class.
const Vector< label > & solutionD() const
Return the vector of solved-for directions in mesh.
CloudType::parcelType parcelType
Convenience typedef for parcelType.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
label parcelsAddedTotal_
Running counter of total number of parcels added.
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar SOI_
Start of injection [s].
Base class for cloud sub-models.
virtual void setProperties(const label parcelI, const label nParcels, const scalar time, parcelType &parcel)=0
Set the parcel properties.
void inject(TrackCloudType &cloud, typename CloudType::parcelType::trackingData &td)
Main injection loop.
virtual scalar timeEnd() const =0
Return the end-of-injection time.
virtual bool writeTime() const
Flag to indicate when to write a property.
const word & modelName() const
Return const access to the name of the sub-model.
const dictionary & dict() const
Return const access to the cloud dictionary.
virtual ~InjectionModel()
Destructor.
parcelBasis parcelBasis_
Parcel basis enumeration.
const CloudType & owner() const
Return const access to the owner cloud.
dimensionedScalar pos(const dimensionedScalar &ds)
scalar nParticleFixed_
nParticle to assign to parcels when the 'fixed' basis
label nInjections_
Number of injections counter.
void setModelProperty(const word &entryName, const Type &value)
Add generic property to the sub-model.
A class for handling words, derived from string.
virtual void info(Ostream &os)
Write injection info to stream.
virtual bool validInjection(const label parcelI)=0
Additional flag to identify whether or not injection of parcelI is.
const Type & value() const
Return const reference to value.
void reset(const dictionary &dict)
Reset entry by re-reading from dictionary.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
virtual bool findCellAtPosition(label &celli, label &tetFacei, label &tetPti, vector &position, bool errorOnNotFound=true)
Find the cell that contains the supplied position.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
InjectionModel(CloudType &owner)
Construct null from owner.
virtual void updateMesh()
Update mesh.
const word & modelType() const
Return const access to the sub-model type.
virtual Type value(const scalar x) const
Return value as a function of scalar x.
const Time & time() const
Return time.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
virtual void setPositionAndCell(const label parcelI, const label nParcels, const scalar time, vector &position, label &cellOwner, label &tetFacei, label &tetPti)=0
Set the injection position and owner cell, tetFace and tetPt.
virtual bool prepareForNextTimeStep(const scalar time, label &newParcels, scalar &newVolumeFraction)
Determine properties for next time step/injection interval.
const fvMesh & mesh() const
Return references to the mesh.
dimensionedScalar pow3(const dimensionedScalar &ds)
virtual scalar setNumberOfParticles(const label parcels, const scalar volumeFraction, const scalar diameter, const scalar rho)
Set number of particles to inject given parcel properties.
scalar massInjected_
Total mass injected to date [kg].
scalar timeStep0_
Time at start of injection time step [s].
TimeFunction1< scalar > massFlowRate_
Mass flow rate profile for steady calculations.
virtual bool fullyDescribed() const =0
Flag to identify whether model fully describes the parcel.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual label parcelsToInject(const scalar time0, const scalar time1)=0
Number of parcels to introduce relative to SOI.
Selector class for relaxation factors, solver type and solution.
Mesh consisting of general polyhedral cells.
scalar volumeTotal_
Total volume of particles introduced by this injector [m^3].
scalar timeStart() const
Return the start-of-injection time.
const objectRegistry & db() const
Return the local objectRegistry.
Templated base class for dsmc cloud.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.