mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
overhauled injection mechanism
This commit is contained in:
@ -112,15 +112,13 @@ Foam::scalar Foam::KinematicCloud<ParcelType>::setNumberOfParticles
|
||||
{
|
||||
nP = pVolumeFraction*massTotal_/nParcels
|
||||
/(pRho*mathematicalConstant::pi/6.0*pow(pDiameter, 3));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case pbNumber:
|
||||
{
|
||||
nP = pVolumeFraction*massTotal_/(pRho*pVolume);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
nP = 0.0;
|
||||
@ -364,13 +362,10 @@ void Foam::KinematicCloud<ParcelType>::inject
|
||||
|
||||
scalar pRho = td.constProps().rho0();
|
||||
|
||||
this->injection().prepareForNextTimeStep(time0_, time);
|
||||
|
||||
// Number of parcels to introduce during this timestep
|
||||
const label nParcels = this->injection().nParcelsToInject
|
||||
(
|
||||
nInjections_,
|
||||
time0_,
|
||||
time
|
||||
);
|
||||
const label nParcels = this->injection().nParcels();
|
||||
|
||||
// Return if no parcels are required
|
||||
if (!nParcels)
|
||||
@ -380,15 +375,10 @@ void Foam::KinematicCloud<ParcelType>::inject
|
||||
}
|
||||
|
||||
// Volume of particles to introduce during this timestep
|
||||
scalar pVolume = this->injection().volume
|
||||
(
|
||||
time0_,
|
||||
time,
|
||||
this->meshInfo()
|
||||
);
|
||||
scalar pVolume = this->injection().volume();
|
||||
|
||||
// Volume fraction to introduce during this timestep
|
||||
scalar pVolumeFraction = this->injection().volumeFraction(time0_, time);
|
||||
scalar pVolumeFraction = this->injection().volumeFraction();
|
||||
|
||||
// Duration of injection period during this timestep
|
||||
scalar deltaT = min
|
||||
@ -419,8 +409,7 @@ void Foam::KinematicCloud<ParcelType>::inject
|
||||
(
|
||||
iParcel,
|
||||
timeInj,
|
||||
this->meshInfo(),
|
||||
rndGen_
|
||||
this->meshInfo()
|
||||
);
|
||||
|
||||
// Diameter of parcels
|
||||
@ -441,8 +430,7 @@ void Foam::KinematicCloud<ParcelType>::inject
|
||||
(
|
||||
iParcel,
|
||||
timeInj,
|
||||
this->meshInfo(),
|
||||
rndGen_
|
||||
this->meshInfo()
|
||||
);
|
||||
|
||||
// Determine the injection cell
|
||||
|
||||
@ -363,6 +363,9 @@ public:
|
||||
inline const InjectionModel<KinematicCloud<ParcelType> >&
|
||||
injection() const;
|
||||
|
||||
inline InjectionModel<KinematicCloud<ParcelType> >&
|
||||
injection();
|
||||
|
||||
//- Return reference to wall interaction model
|
||||
inline const WallInteractionModel<KinematicCloud<ParcelType> >&
|
||||
wallInteraction() const;
|
||||
|
||||
@ -139,6 +139,14 @@ Foam::KinematicCloud<ParcelType>::injection() const
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
|
||||
Foam::KinematicCloud<ParcelType>::injection()
|
||||
{
|
||||
return injectionModel_();
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::WallInteractionModel<Foam::KinematicCloud<ParcelType> >&
|
||||
Foam::KinematicCloud<ParcelType>::wallInteraction() const
|
||||
|
||||
@ -200,13 +200,10 @@ void Foam::ReactingCloud<ParcelType>::inject
|
||||
|
||||
scalar pRho = td.constProps().rho0();
|
||||
|
||||
this->injection().prepareForNextTimeStep(this->time0(), time);
|
||||
|
||||
// Number of parcels to introduce during this timestep
|
||||
const label nParcels = this->injection().nParcelsToInject
|
||||
(
|
||||
this->nInjections(),
|
||||
this->time0(),
|
||||
time
|
||||
);
|
||||
const label nParcels = this->injection().nParcels();
|
||||
|
||||
// Return if no parcels are required
|
||||
if (!nParcels)
|
||||
@ -216,19 +213,10 @@ void Foam::ReactingCloud<ParcelType>::inject
|
||||
}
|
||||
|
||||
// Volume of particles to introduce during this timestep
|
||||
scalar pVolume = this->injection().volume
|
||||
(
|
||||
this->time0(),
|
||||
time,
|
||||
this->meshInfo()
|
||||
);
|
||||
scalar pVolume = this->injection().volume();
|
||||
|
||||
// Volume fraction to introduce during this timestep
|
||||
scalar pVolumeFraction = this->injection().volumeFraction
|
||||
(
|
||||
this->time0(),
|
||||
time
|
||||
);
|
||||
scalar pVolumeFraction = this->injection().volumeFraction();
|
||||
|
||||
// Duration of injection period during this timestep
|
||||
scalar deltaT = min
|
||||
@ -259,8 +247,7 @@ void Foam::ReactingCloud<ParcelType>::inject
|
||||
(
|
||||
iParcel,
|
||||
timeInj,
|
||||
this->meshInfo(),
|
||||
this->rndGen()
|
||||
this->meshInfo()
|
||||
);
|
||||
|
||||
// Diameter of parcels
|
||||
|
||||
@ -27,6 +27,44 @@ License
|
||||
#include "ConeInjection.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ConeInjection<CloudType>::nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((time0 >= 0.0) && (time0 < duration_))
|
||||
{
|
||||
return round((time1 - time0)*parcelsPerSecond_);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ConeInjection<CloudType>::volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((time0 >= 0.0) && (time0 < duration_))
|
||||
{
|
||||
return volumeFlowRate_().integrate(time0, time1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -36,19 +74,20 @@ Foam::ConeInjection<CloudType>::ConeInjection
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner),
|
||||
coeffDict_(dict.subDict(typeName + "Coeffs")),
|
||||
SOI_(readScalar(coeffDict_.lookup("SOI"))),
|
||||
duration_(readScalar(coeffDict_.lookup("duration"))),
|
||||
position_(coeffDict_.lookup("position")),
|
||||
direction_(coeffDict_.lookup("direction")),
|
||||
parcelsPerSecond_(readScalar(coeffDict_.lookup("parcelsPerSecond"))),
|
||||
InjectionModel<CloudType>(dict, owner, typeName),
|
||||
duration_(readScalar(this->coeffDict().lookup("duration"))),
|
||||
position_(this->coeffDict().lookup("position")),
|
||||
direction_(this->coeffDict().lookup("direction")),
|
||||
parcelsPerSecond_
|
||||
(
|
||||
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
|
||||
),
|
||||
volumeFlowRate_
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"volumeFlowRate",
|
||||
coeffDict_
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
Umag_
|
||||
@ -56,7 +95,7 @@ Foam::ConeInjection<CloudType>::ConeInjection
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"Umag",
|
||||
coeffDict_
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
thetaInner_
|
||||
@ -64,7 +103,7 @@ Foam::ConeInjection<CloudType>::ConeInjection
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"thetaInner",
|
||||
coeffDict_
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
thetaOuter_
|
||||
@ -72,20 +111,19 @@ Foam::ConeInjection<CloudType>::ConeInjection
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"thetaOuter",
|
||||
coeffDict_
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
parcelPDF_
|
||||
(
|
||||
pdf::New
|
||||
(
|
||||
coeffDict_.subDict("parcelPDF"),
|
||||
this->coeffDict().subDict("parcelPDF"),
|
||||
owner.rndGen()
|
||||
)
|
||||
),
|
||||
tanVec1_(vector::zero),
|
||||
tanVec2_(vector::zero)
|
||||
// nParticlesPerParcel_(0.0)
|
||||
{
|
||||
// Normalise direction vector
|
||||
direction_ /= mag(direction_);
|
||||
@ -94,11 +132,9 @@ Foam::ConeInjection<CloudType>::ConeInjection
|
||||
vector tangent = vector::zero;
|
||||
scalar magTangent = 0.0;
|
||||
|
||||
Random rnd(label(0));
|
||||
|
||||
while (magTangent < SMALL)
|
||||
{
|
||||
vector v = rnd.vector01();
|
||||
vector v = this->owner().rndGen().vector01();
|
||||
|
||||
tangent = v - (v & direction_)*direction_;
|
||||
magTangent = mag(tangent);
|
||||
@ -107,8 +143,8 @@ Foam::ConeInjection<CloudType>::ConeInjection
|
||||
tanVec1_ = tangent/magTangent;
|
||||
tanVec2_ = direction_^tanVec1_;
|
||||
|
||||
Info<< "tanVec1_ = " << tanVec1_ << endl;
|
||||
Info<< "tanVec2_ = " << tanVec2_ << endl;
|
||||
// Set total volume to inject
|
||||
this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_);
|
||||
}
|
||||
|
||||
|
||||
@ -128,17 +164,10 @@ bool Foam::ConeInjection<CloudType>::active() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ConeInjection<CloudType>::timeStart() const
|
||||
{
|
||||
return SOI_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ConeInjection<CloudType>::timeEnd() const
|
||||
{
|
||||
return SOI_ + duration_;
|
||||
return this->SOI_ + duration_;
|
||||
}
|
||||
|
||||
|
||||
@ -147,9 +176,8 @@ Foam::vector Foam::ConeInjection<CloudType>::position
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random&
|
||||
) const
|
||||
const polyMeshInfo& meshInfo
|
||||
)
|
||||
{
|
||||
vector pos = position_;
|
||||
if (meshInfo.caseIs2d())
|
||||
@ -178,48 +206,39 @@ Foam::vector Foam::ConeInjection<CloudType>::position
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ConeInjection<CloudType>::nParcelsToInject
|
||||
Foam::vector Foam::ConeInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
)
|
||||
{
|
||||
scalar t0 = time0 - SOI_;
|
||||
scalar t1 = time1 - SOI_;
|
||||
const scalar deg2Rad = mathematicalConstant::pi/180.0;
|
||||
|
||||
return round((t1 - t0)*parcelsPerSecond_);
|
||||
}
|
||||
scalar t = time - this->SOI_;
|
||||
scalar ti = thetaInner_().value(t);
|
||||
scalar to = thetaOuter_().value(t);
|
||||
scalar coneAngle = this->owner().rndGen().scalar01()*(to - ti) + ti;
|
||||
|
||||
coneAngle *= deg2Rad;
|
||||
scalar alpha = sin(coneAngle);
|
||||
scalar dcorr = cos(coneAngle);
|
||||
scalar beta =
|
||||
2.0*mathematicalConstant::pi*this->owner().rndGen().scalar01();
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ConeInjection<CloudType>::volume
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1,
|
||||
const polyMeshInfo&
|
||||
) const
|
||||
{
|
||||
scalar t0 = time0 - SOI_;
|
||||
scalar t1 = time1 - SOI_;
|
||||
vector normal = alpha*(tanVec1_*cos(beta) + tanVec2_*sin(beta));
|
||||
vector dirVec = dcorr*direction_;
|
||||
dirVec += normal;
|
||||
|
||||
return volumeFlowRate_().integrate(t0, t1);
|
||||
}
|
||||
// Remove empty component of velocity for slab cases
|
||||
if (meshInfo.caseIs2dSlab())
|
||||
{
|
||||
dirVec.component(meshInfo.emptyComponent()) = 0.0;
|
||||
}
|
||||
|
||||
dirVec /= mag(dirVec);
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ConeInjection<CloudType>::volumeFraction
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
scalar t0 = time0 - SOI_;
|
||||
scalar t1 = time1 - SOI_;
|
||||
|
||||
return
|
||||
volumeFlowRate_().integrate(t0, t1)
|
||||
/volumeFlowRate_().integrate(SOI_, SOI_ + duration_);
|
||||
return Umag_().value(t)*dirVec;
|
||||
}
|
||||
|
||||
|
||||
@ -234,37 +253,4 @@ Foam::scalar Foam::ConeInjection<CloudType>::d0
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::vector Foam::ConeInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random& rndGen
|
||||
) const
|
||||
{
|
||||
const scalar deg2Rad = mathematicalConstant::pi/180.0;
|
||||
scalar t = time - SOI_;
|
||||
scalar ti = thetaInner_().value(t);
|
||||
scalar to = thetaOuter_().value(t);
|
||||
scalar coneAngle = deg2Rad*(rndGen.scalar01()*(to - ti) + ti);
|
||||
|
||||
scalar alpha = sin(coneAngle);
|
||||
scalar dcorr = cos(coneAngle);
|
||||
scalar beta = 2.0*mathematicalConstant::pi*rndGen.scalar01();
|
||||
|
||||
vector normal = alpha*(tanVec1_*cos(beta) + tanVec2_*sin(beta));
|
||||
vector dirVec = dcorr*direction_;
|
||||
dirVec += normal;
|
||||
if (meshInfo.caseIs2dSlab())
|
||||
{
|
||||
dirVec.component(meshInfo.emptyComponent()) = 0.0;
|
||||
}
|
||||
|
||||
dirVec /= mag(dirVec);
|
||||
|
||||
return Umag_().value(t)*dirVec;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -73,9 +73,6 @@ class ConeInjection
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
//- Start of injection [s]
|
||||
const scalar SOI_;
|
||||
|
||||
//- Injection duration [s]
|
||||
const scalar duration_;
|
||||
|
||||
@ -103,9 +100,6 @@ class ConeInjection
|
||||
//- Parcel size PDF to SOI model
|
||||
const autoPtr<pdf> parcelPDF_;
|
||||
|
||||
//- Number of particles represented by each parcel
|
||||
// scalar nParticlesPerParcel_;
|
||||
|
||||
|
||||
// Tangential vectors to the direction vector
|
||||
|
||||
@ -115,6 +109,25 @@ class ConeInjection
|
||||
//- Second tangential vector
|
||||
vector tanVec2_;
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
label nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
scalar volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -138,53 +151,37 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
scalar timeStart() const;
|
||||
|
||||
//- Return the end-of-injection time
|
||||
scalar timeEnd() const;
|
||||
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random&
|
||||
) const;
|
||||
|
||||
label nParcelsToInject
|
||||
(
|
||||
const label,
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
// Injection geometry
|
||||
|
||||
scalar volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const;
|
||||
//- Return the injection position
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar volumeFraction
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random& rndGen
|
||||
) const;
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -32,10 +32,17 @@ template<class CloudType>
|
||||
Foam::InjectionModel<CloudType>::InjectionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
owner_(owner)
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs")),
|
||||
SOI_(readScalar(coeffDict_.lookup("SOI"))),
|
||||
volumeTotal_(0.0),
|
||||
timeStep0_(0.0),
|
||||
nParcels_(0),
|
||||
volume_(0.0)
|
||||
{}
|
||||
|
||||
|
||||
@ -55,6 +62,13 @@ const CloudType& Foam::InjectionModel<CloudType>::owner() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
CloudType& Foam::InjectionModel<CloudType>::owner()
|
||||
{
|
||||
return owner_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary& Foam::InjectionModel<CloudType>::dict() const
|
||||
{
|
||||
@ -62,6 +76,89 @@ const Foam::dictionary& Foam::InjectionModel<CloudType>::dict() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary& Foam::InjectionModel<CloudType>::coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::scalar Foam::InjectionModel<CloudType>::timeStart() const
|
||||
{
|
||||
return SOI_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::scalar Foam::InjectionModel<CloudType>::volumeTotal() const
|
||||
{
|
||||
return volumeTotal_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::label Foam::InjectionModel<CloudType>::nParcels() const
|
||||
{
|
||||
return nParcels_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::scalar Foam::InjectionModel<CloudType>::volume() const
|
||||
{
|
||||
return volume_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::scalar Foam::InjectionModel<CloudType>::volumeFraction() const
|
||||
{
|
||||
return volume_/volumeTotal_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::InjectionModel<CloudType>::prepareForNextTimeStep
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
)
|
||||
{
|
||||
// Initialise values
|
||||
nParcels_ = 0;
|
||||
volume_ = 0.0;
|
||||
|
||||
// Return if not started injection event
|
||||
if (time1 < SOI_)
|
||||
{
|
||||
timeStep0_ = time1;
|
||||
return;
|
||||
}
|
||||
|
||||
// Make times relative to SOI
|
||||
scalar t0 = timeStep0_ - SOI_;
|
||||
scalar t1 = time1 - SOI_;
|
||||
|
||||
// Number of parcels to inject
|
||||
nParcels_ = nParcelsToInject(t0, t1);
|
||||
|
||||
// Volume of parcels to inject
|
||||
volume_ = volumeToInject(t0, t1);
|
||||
|
||||
// Hold previous time if no parcels, but non-zero volume fraction
|
||||
if ((nParcels_ == 0) && (volume_ > 0.0))
|
||||
{
|
||||
// hold value of timeStep0_
|
||||
}
|
||||
else
|
||||
{
|
||||
// advance value of timeStep0_
|
||||
timeStep0_ = time1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "NewInjectionModel.C"
|
||||
|
||||
@ -63,6 +63,52 @@ class InjectionModel
|
||||
// Reference to the owner cloud class
|
||||
CloudType& owner_;
|
||||
|
||||
//- The coefficients dictionary
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Global injection properties
|
||||
|
||||
//- Start of injection [s]
|
||||
scalar SOI_;
|
||||
|
||||
//- Total volume of parcels to introduce [m^3]
|
||||
// Initialised in the individual injection models
|
||||
scalar volumeTotal_;
|
||||
|
||||
|
||||
// Injection properties per Lagrangian time step
|
||||
|
||||
//- Time at start of injection time step [s]
|
||||
scalar timeStep0_;
|
||||
|
||||
//- Number of parcels to introduce []
|
||||
label nParcels_;
|
||||
|
||||
//- Volume of parcels to introduce [m^3]
|
||||
scalar volume_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
virtual label nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const = 0;
|
||||
|
||||
//- Volume of parcels to introduce over the time step
|
||||
virtual scalar volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const = 0;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -89,7 +135,8 @@ public:
|
||||
InjectionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
);
|
||||
|
||||
|
||||
@ -109,71 +156,80 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the owner cloud object
|
||||
//- Return const access the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
|
||||
//- Return non-const access the owner cloud object for manipulation
|
||||
CloudType& owner();
|
||||
|
||||
//- Return the dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
//- Return the coefficients dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
virtual bool active() const = 0;
|
||||
|
||||
//- Return the start-of-injection time
|
||||
virtual scalar timeStart() const = 0;
|
||||
|
||||
//- Return the end-of-injection time
|
||||
virtual scalar timeEnd() const = 0;
|
||||
// Global information
|
||||
|
||||
//- Return the injection position
|
||||
virtual vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random& rndGen
|
||||
) const = 0;
|
||||
//- Return the start-of-injection time
|
||||
const scalar timeStart() const;
|
||||
|
||||
//- Return the number of parcels to intruduce between two times
|
||||
virtual label nParcelsToInject
|
||||
(
|
||||
const label nInjections_,
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const = 0;
|
||||
//- Return the total volume to be injected across the event
|
||||
const scalar volumeTotal() const;
|
||||
|
||||
//- Return the volume of parcels to introduce between two times
|
||||
virtual scalar volume
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1,
|
||||
const polyMeshInfo& meshInfo
|
||||
) const = 0;
|
||||
//- Return the end-of-injection time
|
||||
virtual scalar timeEnd() const = 0;
|
||||
|
||||
//- Return the volume fraction to introduce between two times
|
||||
virtual scalar volumeFraction
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const = 0;
|
||||
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
virtual scalar d0
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time
|
||||
) const = 0;
|
||||
// Per Lagrangian time step properties
|
||||
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
virtual vector velocity
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random& rndGen
|
||||
) const = 0;
|
||||
//- Determine properties for next time step/injection interval
|
||||
void prepareForNextTimeStep
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
);
|
||||
|
||||
//- Return the number of parcels to introduce
|
||||
const label nParcels() const;
|
||||
|
||||
//- Return the volume of parcels to introduce
|
||||
const scalar volume() const;
|
||||
|
||||
//- Return the volume fraction to introduce
|
||||
const scalar volumeFraction() const;
|
||||
|
||||
|
||||
// Injection geometry
|
||||
|
||||
//- Return the injection position
|
||||
virtual vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
) = 0;
|
||||
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
virtual vector velocity
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
) = 0;
|
||||
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
virtual scalar d0
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -28,6 +28,45 @@ License
|
||||
|
||||
#include "ManualInjection.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ManualInjection<CloudType>::nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((0.0 >= time0) && (0.0 < time1))
|
||||
{
|
||||
return positions_.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
// All parcels introduced at SOI
|
||||
if ((0.0 >= time0) && (0.0 < time1))
|
||||
{
|
||||
return this->volumeTotal_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -37,10 +76,8 @@ Foam::ManualInjection<CloudType>::ManualInjection
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner),
|
||||
coeffDict_(dict.subDict(typeName + "Coeffs")),
|
||||
injectionTime_(readScalar(coeffDict_.lookup("injectionTime"))),
|
||||
positionsFile_(coeffDict_.lookup("positionsFile")),
|
||||
InjectionModel<CloudType>(dict, owner, typeName),
|
||||
positionsFile_(this->coeffDict().lookup("positionsFile")),
|
||||
positions_
|
||||
(
|
||||
IOobject
|
||||
@ -53,12 +90,12 @@ Foam::ManualInjection<CloudType>::ManualInjection
|
||||
)
|
||||
),
|
||||
diameters_(positions_.size()),
|
||||
U0_(coeffDict_.lookup("U0")),
|
||||
U0_(this->coeffDict().lookup("U0")),
|
||||
parcelPDF_
|
||||
(
|
||||
pdf::New
|
||||
(
|
||||
coeffDict_.subDict("parcelPDF"),
|
||||
this->coeffDict().subDict("parcelPDF"),
|
||||
owner.rndGen()
|
||||
)
|
||||
)
|
||||
@ -70,7 +107,7 @@ Foam::ManualInjection<CloudType>::ManualInjection
|
||||
}
|
||||
|
||||
// Determine volume of particles to inject
|
||||
volumeTotal_ = sum(pow(diameters_, 3))
|
||||
this->volumeTotal_ = sum(pow(diameters_, 3))
|
||||
*mathematicalConstant::pi/6.0;
|
||||
}
|
||||
|
||||
@ -91,13 +128,6 @@ bool Foam::ManualInjection<CloudType>::active() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::timeStart() const
|
||||
{
|
||||
return injectionTime_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::timeEnd() const
|
||||
{
|
||||
@ -111,9 +141,8 @@ Foam::vector Foam::ManualInjection<CloudType>::position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random&
|
||||
) const
|
||||
const polyMeshInfo& meshInfo
|
||||
)
|
||||
{
|
||||
vector pos = positions_[iParcel];
|
||||
if (meshInfo.caseIs2d())
|
||||
@ -142,53 +171,21 @@ Foam::vector Foam::ManualInjection<CloudType>::position
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ManualInjection<CloudType>::nParcelsToInject
|
||||
Foam::vector Foam::ManualInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((injectionTime_>=time0) && (injectionTime_<time1))
|
||||
{
|
||||
return positions_.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const
|
||||
const polyMeshInfo& meshInfo
|
||||
)
|
||||
{
|
||||
// Since all parcels are introduced at once, volume introduced in this time
|
||||
// interval = total mass
|
||||
return volumeTotal_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::volumeFraction
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((injectionTime_>=time0) && (injectionTime_<time1))
|
||||
vector vel = U0_;
|
||||
if (meshInfo.caseIs2dSlab())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
vel.component(meshInfo.emptyComponent()) =
|
||||
meshInfo.centrePoint().component(meshInfo.emptyComponent());
|
||||
}
|
||||
|
||||
return vel;
|
||||
}
|
||||
|
||||
|
||||
@ -203,24 +200,4 @@ Foam::scalar Foam::ManualInjection<CloudType>::d0
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::vector Foam::ManualInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random&
|
||||
) const
|
||||
{
|
||||
vector vel = U0_;
|
||||
if (meshInfo.caseIs2dSlab())
|
||||
{
|
||||
vel.component(meshInfo.emptyComponent()) =
|
||||
meshInfo.centrePoint().component(meshInfo.emptyComponent());
|
||||
}
|
||||
|
||||
return vel;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -68,9 +68,6 @@ class ManualInjection
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
//- Time to introduce parcels
|
||||
const scalar injectionTime_;
|
||||
|
||||
//- Name of file containing positions data
|
||||
const word positionsFile_;
|
||||
|
||||
@ -83,9 +80,6 @@ class ManualInjection
|
||||
//- Initial parcel velocity
|
||||
const vector U0_;
|
||||
|
||||
//- Total volume of parcels to introduce [m^3]
|
||||
scalar volumeTotal_;
|
||||
|
||||
//- Parcel size PDF model
|
||||
const autoPtr<pdf> parcelPDF_;
|
||||
|
||||
@ -93,6 +87,25 @@ class ManualInjection
|
||||
scalar nParticlesPerParcel_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
label nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
|
||||
//- Volume of parcels to introduce over the time step
|
||||
scalar volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -116,53 +129,37 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
scalar timeStart() const;
|
||||
|
||||
//- Return the end-of-injection time
|
||||
scalar timeEnd() const;
|
||||
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random&
|
||||
) const;
|
||||
|
||||
label nParcelsToInject
|
||||
(
|
||||
const label,
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
// Injection geometry
|
||||
|
||||
scalar volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const;
|
||||
//- Return the injection position
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar volumeFraction
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar d0
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random&
|
||||
) const;
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -29,6 +29,30 @@ License
|
||||
#include "NoInjection.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::NoInjection<CloudType>::nParcelsToInject
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::volumeToInject
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -38,7 +62,7 @@ Foam::NoInjection<CloudType>::NoInjection
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner)
|
||||
InjectionModel<CloudType>(dict, owner, typeName)
|
||||
{}
|
||||
|
||||
|
||||
@ -58,13 +82,6 @@ bool Foam::NoInjection<CloudType>::active() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::timeStart() const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::timeEnd() const
|
||||
{
|
||||
@ -77,46 +94,22 @@ Foam::vector Foam::NoInjection<CloudType>::position
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo&,
|
||||
Random&
|
||||
) const
|
||||
const polyMeshInfo&
|
||||
)
|
||||
{
|
||||
return vector::zero;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::NoInjection<CloudType>::nParcelsToInject
|
||||
Foam::vector Foam::NoInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const
|
||||
)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::volumeFraction
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return 0.0;
|
||||
return vector::zero;
|
||||
}
|
||||
|
||||
|
||||
@ -131,17 +124,4 @@ Foam::scalar Foam::NoInjection<CloudType>::d0
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::vector Foam::NoInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo&,
|
||||
Random&
|
||||
) const
|
||||
{
|
||||
return vector::zero;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -53,6 +53,25 @@ class NoInjection
|
||||
public InjectionModel<CloudType>
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
label nParcelsToInject
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
//- Volume of parcels to introduce over the time step
|
||||
scalar volumeToInject
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -76,53 +95,37 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
scalar timeStart() const;
|
||||
|
||||
//- Return the end-of-injection time
|
||||
scalar timeEnd() const;
|
||||
|
||||
vector position
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo&,
|
||||
Random&
|
||||
) const;
|
||||
|
||||
label nParcelsToInject
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
// Injection geometry
|
||||
|
||||
scalar volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const;
|
||||
//- Return the injection position
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar volumeFraction
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo&,
|
||||
Random&
|
||||
) const;
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user