constInjector.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 "constInjector.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "mathematicalConstants.H"
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 defineTypeNameAndDebug(constInjector, 0);
00039
00040 addToRunTimeSelectionTable
00041 (
00042 injectorModel,
00043 constInjector,
00044 dictionary
00045 );
00046
00047
00048
00049
00050
00051 constInjector::constInjector
00052 (
00053 const dictionary& dict,
00054 spray& sm
00055 )
00056 :
00057 injectorModel(dict, sm),
00058 specDict_(dict.subDict(typeName + "Coeffs")),
00059 dropletNozzleDiameterRatio_(specDict_.lookup("dropletNozzleDiameterRatio")),
00060 sprayAngle_(specDict_.lookup("sprayAngle"))
00061 {
00062 if (sm.injectors().size() != dropletNozzleDiameterRatio_.size())
00063 {
00064 FatalError << "constInjector::constInjector"
00065 << "(const dictionary& dict, spray& sm)\n"
00066 << "Wrong number of entries in dropletNozzleDiameterRatio"
00067 << abort(FatalError);
00068 }
00069
00070 if (sm.injectors().size() != sprayAngle_.size())
00071 {
00072 FatalError << "constInjector::constInjector"
00073 << "(const dictionary& dict, spray& sm)\n"
00074 << "Wrong number of entries in sprayAngle"
00075 << abort(FatalError);
00076 }
00077
00078 scalar referencePressure = sm.p().average().value();
00079
00080
00081 forAll(sm.injectors(), i)
00082 {
00083 sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure);
00084 }
00085
00086 }
00087
00088
00089
00090
00091 constInjector::~constInjector()
00092 {}
00093
00094
00095
00096
00097 scalar constInjector::d0
00098 (
00099 const label n,
00100 const scalar
00101 ) const
00102 {
00103 return injectors_[n].properties()->d()*dropletNozzleDiameterRatio_[n];
00104 }
00105
00106
00107 vector constInjector::direction
00108 (
00109 const label n,
00110 const label hole,
00111 const scalar time,
00112 const scalar d
00113 ) const
00114 {
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 scalar angle = rndGen_.scalar01()*sprayAngle_[n]*mathematicalConstant::pi/360.0;
00132 scalar alpha = sin(angle);
00133 scalar dcorr = cos(angle);
00134
00135 scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01();
00136
00137
00138 vector normal = vector::zero;
00139
00140 if (sm_.twoD())
00141 {
00142 scalar reduce = 0.01;
00143
00144
00145 beta *= (1.0-2.0*reduce)*0.5*sm_.angleOfWedge()/mathematicalConstant::pi;
00146 beta += reduce*sm_.angleOfWedge();
00147
00148 normal = alpha*
00149 (
00150 sm_.axisOfWedge()*cos(beta) +
00151 sm_.axisOfWedgeNormal()*sin(beta)
00152 );
00153
00154 }
00155 else
00156 {
00157 normal = alpha*
00158 (
00159 injectors_[n].properties()->tan1(hole)*cos(beta) +
00160 injectors_[n].properties()->tan2(hole)*sin(beta)
00161 );
00162 }
00163
00164
00165 vector dir = dcorr*injectors_[n].properties()->direction(n, time) + normal;
00166 dir /= mag(dir);
00167
00168 return dir;
00169 }
00170
00171 scalar constInjector::velocity
00172 (
00173 const label i,
00174 const scalar time
00175 ) const
00176 {
00177 const injectorType& it = sm_.injectors()[i].properties();
00178 if (it.pressureIndependentVelocity())
00179 {
00180 return it.getTableValue(it.velocityProfile(), time);
00181 }
00182 else
00183 {
00184 scalar Pref = sm_.ambientPressure();
00185 scalar Pinj = it.getTableValue(it.injectionPressureProfile(), time);
00186 scalar rho = sm_.fuels().rho(Pinj, it.T(time), it.X());
00187 scalar dp = max(0.0, Pinj - Pref);
00188 return sqrt(2.0*dp/rho);
00189 }
00190 }
00191
00192 scalar constInjector::averageVelocity
00193 (
00194 const label i
00195 ) const
00196 {
00197 const injectorType& it = sm_.injectors()[i].properties();
00198 scalar dt = it.teoi() - it.tsoi();
00199
00200 return it.integrateTable(it.velocityProfile())/dt;
00201 }
00202
00203 }
00204
00205
Copyright © 2000-2009 OpenCFD Ltd