definedHollowCone.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "definedHollowCone.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "mathematicalConstants.H"
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 defineTypeNameAndDebug(definedHollowConeInjector, 0);
00039
00040 addToRunTimeSelectionTable
00041 (
00042 injectorModel,
00043 definedHollowConeInjector,
00044 dictionary
00045 );
00046
00047
00048
00049
00050
00051 definedHollowConeInjector::definedHollowConeInjector
00052 (
00053 const dictionary& dict,
00054 spray& sm
00055 )
00056 :
00057 injectorModel(dict, sm),
00058 definedHollowConeDict_(dict.subDict(typeName + "Coeffs")),
00059 dropletPDF_
00060 (
00061 pdf::New
00062 (
00063 definedHollowConeDict_.subDict("dropletPDF"),
00064 sm.rndGen()
00065 )
00066 ),
00067 innerConeAngle_(definedHollowConeDict_.lookup("innerConeAngle")),
00068 outerConeAngle_(definedHollowConeDict_.lookup("outerConeAngle"))
00069 {
00070
00071
00072 forAll(innerConeAngle_, i)
00073 {
00074 innerConeAngle_[i][0] = sm.runTime().userTimeToTime(innerConeAngle_[i][0]);
00075 }
00076
00077 forAll(outerConeAngle_, i)
00078 {
00079 outerConeAngle_[i][0] = sm.runTime().userTimeToTime(outerConeAngle_[i][0]);
00080 }
00081
00082
00083 if (sm.injectors().size() != 1)
00084 {
00085 Info << "Warning!!!\n"
00086 << "definedHollowConeInjector::definedHollowConeInjector"
00087 << "(const dictionary& dict, spray& sm)\n"
00088 << "Same inner/outer cone angle profiles applied to each injector"
00089 << endl;
00090 }
00091
00092
00093 if (innerConeAngle_.empty())
00094 {
00095 FatalError << "definedHollowConeInjector::definedHollowConeInjector"
00096 << "(const dictionary& dict, spray& sm)\n"
00097 << "Number of entries in innerConeAngle must be greater than zero"
00098 << abort(FatalError);
00099 }
00100
00101
00102 if (outerConeAngle_.empty())
00103 {
00104 FatalError << "definedHollowConeInjector::definedHollowConeInjector"
00105 << "(const dictionary& dict, spray& sm)\n"
00106 << "Number of entries in outerConeAngle must be greater than zero"
00107 << abort(FatalError);
00108 }
00109
00110 scalar referencePressure = sm.p().average().value();
00111
00112 forAll(sm.injectors(), i)
00113 {
00114 sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
00115 }
00116
00117 }
00118
00119
00120
00121
00122 definedHollowConeInjector::~definedHollowConeInjector()
00123 {}
00124
00125
00126
00127
00128 scalar definedHollowConeInjector::d0
00129 (
00130 const label n,
00131 const scalar t
00132 ) const
00133 {
00134
00135
00136 return dropletPDF_->sample();
00137 }
00138
00139
00140 vector definedHollowConeInjector::direction
00141 (
00142 const label n,
00143 const label hole,
00144 const scalar t,
00145 const scalar d
00146 ) const
00147 {
00148
00149 const injectorType& it = injectors_[n].properties();
00150
00151
00152 scalar angleInner = it.getTableValue(innerConeAngle_, t);
00153 scalar angleOuter = it.getTableValue(outerConeAngle_, t);
00154
00155
00156 scalar angle = angleInner + rndGen_.scalar01()*(angleOuter-angleInner);
00157
00158 scalar alpha = sin(angle*mathematicalConstant::pi/360.0);
00159 scalar dcorr = cos(angle*mathematicalConstant::pi/360.0);
00160 scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
00161
00162
00163 vector normal = vector::zero;
00164
00165 if (sm_.twoD())
00166 {
00167 scalar reduce = 0.01;
00168
00169
00170
00171 beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi);
00172 beta += reduce*sm_.angleOfWedge();
00173 normal = alpha*
00174 (
00175 sm_.axisOfWedge()*cos(beta) +
00176 sm_.axisOfWedgeNormal()*sin(beta)
00177 );
00178 }
00179 else
00180 {
00181 normal = alpha*
00182 (
00183 injectors_[n].properties()->tan1(hole)*cos(beta) +
00184 injectors_[n].properties()->tan2(hole)*sin(beta)
00185 );
00186 }
00187
00188
00189 vector dir = dcorr*injectors_[n].properties()->direction(hole, t) + normal;
00190
00191 dir /= mag(dir);
00192
00193 return dir;
00194
00195 }
00196
00197 scalar definedHollowConeInjector::velocity
00198 (
00199 const label i,
00200 const scalar time
00201 ) const
00202 {
00203 const injectorType& it = sm_.injectors()[i].properties();
00204 if (it.pressureIndependentVelocity())
00205 {
00206 return it.getTableValue(it.velocityProfile(), time);
00207 }
00208 else
00209 {
00210 scalar Pref = sm_.ambientPressure();
00211 scalar Pinj = it.getTableValue(it.injectionPressureProfile(), time);
00212 scalar rho = sm_.fuels().rho(Pinj, it.T(time), it.X());
00213 scalar dp = max(0.0, Pinj - Pref);
00214 return sqrt(2.0*dp/rho);
00215 }
00216 }
00217
00218 scalar definedHollowConeInjector::averageVelocity
00219 (
00220 const label i
00221 ) const
00222 {
00223 const injectorType& it = sm_.injectors()[i].properties();
00224 scalar dt = it.teoi() - it.tsoi();
00225 return it.integrateTable(it.velocityProfile())/dt;
00226 }
00227
00228
00229
00230 }
00231
00232
Copyright © 2000-2009 OpenCFD Ltd