Commit abb39204 authored by andy's avatar andy
Browse files

ENH: Extended spray cone nozzle injection

parent b6f71fd5
......@@ -30,6 +30,82 @@ License
using namespace Foam::constant;
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ConeNozzleInjection<CloudType>::setInjectionMethod()
{
word injectionMethodType = this->coeffDict().lookup("injectionMethod");
if (injectionMethodType == "disc")
{
injectionMethod_ = imDisc;
}
else if (injectionMethodType == "point")
{
injectionMethod_ = imPoint;
// Set/cache the injector cell
this->findCellAtPosition
(
injectorCell_,
tetFaceI_,
tetPtI_,
position_,
false
);
}
else
{
FatalErrorIn("Foam::InjectionModel<CloudType>::setInjectionMethod()")
<< "injectionMethod must be either 'point' or 'disc'"
<< exit(FatalError);
}
}
template<class CloudType>
void Foam::ConeNozzleInjection<CloudType>::setFlowType()
{
word flowType = this->coeffDict().lookup("flowType");
if (flowType == "constantVelocity")
{
this->coeffDict().lookup("UMag") >> UMag_;
flowType_ = ftConstantVelocity;
}
else if (flowType == "pressureDrivenVelocity")
{
Pinj_.reset
(
DataEntry<scalar>::New
(
"Pinj",
this->coeffDict()
).ptr()
);
flowType_ = ftPressureDrivenVelocity;
}
else if (flowType == "flowRateAndDischarge")
{
Cd_.reset
(
DataEntry<scalar>::New
(
"Cd",
this->coeffDict()
).ptr()
);
flowType_ = ftFlowRateAndDischarge;
}
else
{
FatalErrorIn("Foam::InjectionModel<CloudType>::setFlowType()")
<< "flowType must be either 'constantVelocity', "
<<"'pressureDrivenVelocity' or 'flowRateAndDischarge'"
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
......@@ -41,14 +117,9 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
:
InjectionModel<CloudType>(dict, owner, typeName),
injectionMethod_(imPoint),
outerNozzleDiameter_
(
readScalar(this->coeffDict().lookup("outerNozzleDiameter"))
),
innerNozzleDiameter_
(
readScalar(this->coeffDict().lookup("innerNozzleDiameter"))
),
flowType_(ftConstantVelocity),
outerDiameter_(readScalar(this->coeffDict().lookup("outerDiameter"))),
innerDiameter_(readScalar(this->coeffDict().lookup("innerDiameter"))),
duration_(readScalar(this->coeffDict().lookup("duration"))),
position_(this->coeffDict().lookup("position")),
injectorCell_(-1),
......@@ -67,14 +138,6 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
this->coeffDict()
)
),
Cd_
(
DataEntry<scalar>::New
(
"Cd",
this->coeffDict()
)
),
thetaInner_
(
DataEntry<scalar>::New
......@@ -101,9 +164,13 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
),
tanVec1_(vector::zero),
tanVec2_(vector::zero),
normal_(vector::zero)
normal_(vector::zero),
UMag_(0.0),
Cd_(NULL),
Pinj_(NULL)
{
if (innerNozzleDiameter_ >= outerNozzleDiameter_)
if (innerDiameter_ >= outerDiameter_)
{
FatalErrorIn
(
......@@ -116,38 +183,9 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
<< exit(FatalError);
}
word injectionMethodType = this->coeffDict().lookup("injectionMethod");
if (injectionMethodType == "disc")
{
injectionMethod_ = imDisc;
}
else if (injectionMethodType == "point")
{
injectionMethod_ = imPoint;
setInjectionMethod();
// Set/cache the injector cell
this->findCellAtPosition
(
injectorCell_,
tetFaceI_,
tetPtI_,
position_,
false
);
}
else
{
FatalErrorIn
(
"Foam::InjectionModel<CloudType>::InjectionModel"
"("
"const dictionary&, "
"CloudType&"
")"
)<< "injectionMethod must be either 'point' or 'disc'" << nl
<< exit(FatalError);
}
setFlowType();
cachedRandom& rndGen = this->owner().rndGen();
......@@ -182,21 +220,23 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
:
InjectionModel<CloudType>(im),
injectionMethod_(im.injectionMethod_),
outerNozzleDiameter_(im.outerNozzleDiameter_),
innerNozzleDiameter_(im.innerNozzleDiameter_),
outerDiameter_(im.outerDiameter_),
innerDiameter_(im.innerDiameter_),
duration_(im.duration_),
position_(im.position_),
injectorCell_(im.injectorCell_),
direction_(im.direction_),
parcelsPerSecond_(im.parcelsPerSecond_),
volumeFlowRate_(im.volumeFlowRate_().clone().ptr()),
Cd_(im.Cd_().clone().ptr()),
thetaInner_(im.thetaInner_().clone().ptr()),
thetaOuter_(im.thetaOuter_().clone().ptr()),
sizeDistribution_(im.sizeDistribution_().clone().ptr()),
tanVec1_(im.tanVec1_),
tanVec2_(im.tanVec1_),
normal_(im.normal_)
normal_(im.normal_),
UMag_(im.UMag_),
Cd_(im.Cd_().clone().ptr()),
Pinj_(im.Pinj_().clone().ptr())
{}
......@@ -283,8 +323,8 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
case imDisc:
{
scalar frac = rndGen.sample01<scalar>();
scalar dr = outerNozzleDiameter_ - innerNozzleDiameter_;
scalar r = 0.5*(innerNozzleDiameter_ + frac*dr);
scalar dr = outerDiameter_ - innerDiameter_;
scalar r = 0.5*(innerDiameter_ + frac*dr);
position = position_ + r*normal_;
this->findCellAtPosition
......@@ -344,13 +384,38 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties
dirVec += normal;
dirVec /= mag(dirVec);
scalar Ao = 0.25*mathematical::pi*outerNozzleDiameter_*outerNozzleDiameter_;
scalar Ai = 0.25*mathematical::pi*innerNozzleDiameter_*innerNozzleDiameter_;
scalar massFlowRate =
this->massTotal()*volumeFlowRate_().value(t)/this->volumeTotal();
scalar Umag = massFlowRate/(parcel.rho()*Cd_().value(t)*(Ao - Ai));
parcel.U() = Umag*dirVec;
switch (flowType_)
{
case ftConstantVelocity:
{
parcel.U() = UMag_*dirVec;
break;
}
case ftPressureDrivenVelocity:
{
scalar pAmbient = this->owner().pAmbient();
scalar rho = parcel.rho();
scalar UMag = ::sqrt(2.0*(Pinj_().value(t) - pAmbient)/rho);
parcel.U() = UMag*dirVec;
break;
}
case ftFlowRateAndDischarge:
{
scalar Ao = 0.25*mathematical::pi*outerDiameter_*outerDiameter_;
scalar Ai = 0.25*mathematical::pi*innerDiameter_*innerDiameter_;
scalar massFlowRate =
this->massTotal()
*volumeFlowRate_().value(t)
/this->volumeTotal();
scalar Umag = massFlowRate/(parcel.rho()*Cd_().value(t)*(Ao - Ai));
parcel.U() = Umag*dirVec;
break;
}
default:
{
}
}
// set particle diameter
parcel.d() = sizeDistribution_->sample();
......
......@@ -32,16 +32,18 @@ Description
- injector position
- direction (along injection axis)
- parcel flow rate
- discharge coefficient, Cd
- inner and outer cone angles
- Parcel diameters obtained by size distribution model
- Parcel velocity is calculated as:
U = V_dot/(A * Cd), where V_dot is the volume flow rate
Based on the old 'unitInjection' model
- Constant velocity
U = <specified by user>
- Pressure driven velocity
U = sqrt(2*(Pinj - Pamb)/rho)
- Flow rate and discharge
U = V_dot/(A*Cd)
SourceFiles
ConeNozzleInjection.C
......@@ -83,19 +85,30 @@ public:
imDisc
};
//- Flow type enumeration
enum flowType
{
ftConstantVelocity,
ftPressureDrivenVelocity,
ftFlowRateAndDischarge
};
private:
// Private data
//- point/disc injection method
//- Point/disc injection method
injectionMethod injectionMethod_;
//- Flow type
flowType flowType_;
//- Outer nozzle diameter [m]
const scalar outerNozzleDiameter_;
const scalar outerDiameter_;
//- Inner nozzle diameter [m]
const scalar innerNozzleDiameter_;
const scalar innerDiameter_;
//- Injection duration [s]
const scalar duration_;
......@@ -121,9 +134,6 @@ private:
//- Volume flow rate of parcels to introduce relative to SOI [m^3/s]
const autoPtr<DataEntry<scalar> > volumeFlowRate_;
//- Discharge coefficient, relative to SOI [m/s]
const autoPtr<DataEntry<scalar> > Cd_;
//- Inner cone angle relative to SOI [deg]
const autoPtr<DataEntry<scalar> > thetaInner_;
......@@ -146,6 +156,27 @@ private:
vector normal_;
// Velocity model coefficients
//- Constant velocity [m/s]
scalar UMag_;
//- Discharge coefficient, relative to SOI [m/s]
autoPtr<DataEntry<scalar> > Cd_;
//- Injection pressure [Pa]
autoPtr<DataEntry<scalar> > Pinj_;
// Private Member Functions
//- Set the injection type
void setInjectionMethod();
//- Set the injection flow type
void setFlowType();
public:
//- Runtime type information
......
......@@ -175,6 +175,18 @@ cloudFunctions
cycLeft_half1
);
}
facePostProcessing
{
surfaceFormat vtk;
resetOnWrite no;
log yes;
faceZones
(
cycLeft
);
}
}
......
......@@ -112,8 +112,9 @@ subModels
massTotal 6.0e-6;
parcelBasisType mass;
injectionMethod disc;
outerNozzleDiameter 1.9e-4;
innerNozzleDiameter 0;
flowType flowRateAndDischarge;
outerDiameter 1.9e-4;
innerDiameter 0;
duration 1.25e-3;
position ( 0 0.0995 0 );
direction ( 0 -1 0 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment