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