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 <dieselSpray/spray.H>
00027
00028 #include <dieselSpray/atomizationModel.H>
00029 #include <dieselSpray/breakupModel.H>
00030 #include <dieselSpray/collisionModel.H>
00031 #include <dieselSpray/dispersionModel.H>
00032 #include <dieselSpray/dragModel.H>
00033 #include <dieselSpray/evaporationModel.H>
00034 #include <dieselSpray/heatTransferModel.H>
00035 #include <dieselSpray/injectorModel.H>
00036 #include <dieselSpray/wallModel.H>
00037
00038 #include <reactionThermophysicalModels/basicMultiComponentMixture.H>
00039
00040 #include <OpenFOAM/symmetryPolyPatch.H>
00041 #include <OpenFOAM/wedgePolyPatch.H>
00042
00043 #include <OpenFOAM/mathematicalConstants.H>
00044
00045
00046
00047 defineTemplateTypeNameAndDebug(IOPtrList<injector>, 0);
00048
00049
00050
00051
00052 Foam::spray::spray
00053 (
00054 const volVectorField& U,
00055 const volScalarField& rho,
00056 const volScalarField& p,
00057 const volScalarField& T,
00058 const basicMultiComponentMixture& composition,
00059 const PtrList<gasThermoPhysics>& gasProperties,
00060 const dictionary&,
00061 const dimensionedVector& g,
00062 bool readFields
00063 )
00064 :
00065 Cloud<parcel>(U.mesh(), false),
00066 runTime_(U.time()),
00067 time0_(runTime_.value()),
00068 mesh_(U.mesh()),
00069 rndGen_(label(0)),
00070 g_(g.value()),
00071
00072 U_(U),
00073 rho_(rho),
00074 p_(p),
00075 T_(T),
00076
00077 sprayProperties_
00078 (
00079 IOobject
00080 (
00081 "sprayProperties",
00082 U.time().constant(),
00083 U.db(),
00084 IOobject::MUST_READ,
00085 IOobject::NO_WRITE
00086 )
00087 ),
00088
00089 ambientPressure_(p_.average().value()),
00090 ambientTemperature_(T_.average().value()),
00091
00092 injectors_
00093 (
00094 IOobject
00095 (
00096 "injectorProperties",
00097 U.time().constant(),
00098 U.db(),
00099 IOobject::MUST_READ,
00100 IOobject::NO_WRITE
00101 ),
00102 injector::iNew(U.time())
00103 ),
00104 atomization_
00105 (
00106 atomizationModel::New
00107 (
00108 sprayProperties_,
00109 *this
00110 )
00111 ),
00112 drag_
00113 (
00114 dragModel::New
00115 (
00116 sprayProperties_
00117 )
00118 ),
00119 evaporation_
00120 (
00121 evaporationModel::New
00122 (
00123 sprayProperties_
00124 )
00125 ),
00126 heatTransfer_
00127 (
00128 heatTransferModel::New
00129 (
00130 sprayProperties_
00131 )
00132 ),
00133 wall_
00134 (
00135 wallModel::New
00136 (
00137 sprayProperties_,
00138 U,
00139 *this
00140 )
00141 ),
00142 breakupModel_
00143 (
00144 breakupModel::New
00145 (
00146 sprayProperties_,
00147 *this
00148 )
00149 ),
00150 collisionModel_
00151 (
00152 collisionModel::New
00153 (
00154 sprayProperties_,
00155 *this,
00156 rndGen_
00157 )
00158 ),
00159 dispersionModel_
00160 (
00161 dispersionModel::New
00162 (
00163 sprayProperties_,
00164 *this
00165 )
00166 ),
00167
00168 fuels_
00169 (
00170 liquidMixture::New
00171 (
00172 mesh_.lookupObject<dictionary>("thermophysicalProperties")
00173 )
00174 ),
00175 injectorModel_
00176 (
00177 injectorModel::New
00178 (
00179 sprayProperties_,
00180 *this
00181 )
00182 ),
00183
00184 subCycles_(readLabel(sprayProperties_.lookup("subCycles"))),
00185
00186 gasProperties_(gasProperties),
00187 composition_(composition),
00188
00189 liquidToGasIndex_(fuels_->components().size(), -1),
00190 gasToLiquidIndex_(composition.Y().size(), -1),
00191 isLiquidFuel_(composition.Y().size(), false),
00192
00193 twoD_(0),
00194 axisOfSymmetry_(vector::zero),
00195 axisOfWedge_(vector(0,0,0)),
00196 axisOfWedgeNormal_(vector(0,0,0)),
00197 angleOfWedge_(0.0),
00198
00199 interpolationSchemes_(sprayProperties_.subDict("interpolationSchemes")),
00200 UInterpolator_(NULL),
00201 rhoInterpolator_(NULL),
00202 pInterpolator_(NULL),
00203 TInterpolator_(NULL),
00204
00205 sms_(mesh_.nCells(), vector::zero),
00206 shs_(mesh_.nCells(), 0.0),
00207 srhos_(fuels_->components().size()),
00208
00209 totalInjectedLiquidMass_(0.0),
00210 injectedLiquidKE_(0.0)
00211
00212 {
00213
00214 forAll(srhos_, i)
00215 {
00216 srhos_.set(i, new scalarField(mesh_.nCells(), 0.0));
00217 }
00218
00219
00220 forAll(injectors_, i)
00221 {
00222 const injectorType& it = injectors_[i].properties();
00223
00224 scalar v = injection().averageVelocity(i);
00225
00226 scalar ip = it.integrateTable(it.injectionPressureProfile());
00227 scalar dt = it.teoi() - it.tsoi();
00228 Info<< "Average Velocity for injector " << i << ": " << v << " m/s"
00229 << ", injection pressure = "
00230 << 1.0e-5*ip/dt << " bar"
00231 << endl;
00232 }
00233
00234
00235 const polyBoundaryMesh& bMesh = mesh().boundaryMesh();
00236 bool symPlaneExist = false;
00237 bool wedgeExist = false;
00238 label patches[2];
00239 label n=0;
00240
00241
00242 forAll(bMesh, patchi)
00243 {
00244 if (isA<symmetryPolyPatch>(bMesh[patchi]))
00245 {
00246 symPlaneExist = true;
00247 }
00248 else if (isA<wedgePolyPatch>(bMesh[patchi]))
00249 {
00250 wedgeExist = true;
00251 patches[n++] = patchi;
00252 }
00253 }
00254
00255
00256 twoD_ = wedgeExist;
00257
00258 if (twoD_)
00259 {
00260 if (n<2)
00261 {
00262 FatalErrorIn
00263 (
00264 "spray::spray(const volVectorField& U, "
00265 "const volScalarField& rho, const volScalarField& p, "
00266 "const volScalarField& T, const combustionMixture& composition,"
00267 "const PtrList<gasThermoPhsyics>& gaseousFuelProperties, "
00268 "const dictionary& thermophysicalProperties, "
00269 "const dimensionedScalar& g)"
00270 ) << "spray::(...) only one wedgePolyPatch found. "
00271 "Please check you BC-setup."
00272 << abort(FatalError);
00273 }
00274
00275 Info<< "Constructing two dimensional spray injection.";
00276
00277 vector v1 = bMesh[patches[0]].faceAreas()[0];
00278 vector v2 = bMesh[patches[1]].faceAreas()[0];
00279 v1 /= mag(v1);
00280 v2 /= mag(v2);
00281 axisOfSymmetry_ = v1 ^ v2;
00282 axisOfSymmetry_ /= mag(axisOfSymmetry_);
00283
00284
00285 axisOfWedge_ = axisOfSymmetry_ ^ v2;
00286 axisOfWedge_ /= mag(axisOfWedge_);
00287
00288 axisOfWedgeNormal_ = axisOfSymmetry_ ^ axisOfWedge_;
00289 axisOfWedgeNormal_ /= mag(axisOfWedgeNormal_);
00290
00291 scalar arcCos = (v1 & v2)/mag(v1);
00292 angleOfWedge_ = mathematicalConstant::pi - acos(arcCos);
00293
00294 Info<< "Calculated angle of wedge is "
00295 << angleOfWedge_*180/mathematicalConstant::pi << " deg."
00296 << endl;
00297 }
00298 else
00299 {
00300 if (symPlaneExist)
00301 {
00302 angleOfWedge_ = mathematicalConstant::pi;
00303 Info<< "Constructing 180 deg three dimensional spray injection."
00304 << endl;
00305 }
00306 else
00307 {
00308 Info<< "Constructing three dimensional spray injection." << endl;
00309 }
00310
00311 }
00312
00313
00314 label Ns = composition_.Y().size();
00315
00316 forAll(fuels_->components(), i)
00317 {
00318 word liquidName(fuels_->components()[i]);
00319
00320 for (label j=0; j<Ns; j++)
00321 {
00322 word specieName(composition_.Y()[j].name());
00323
00324 if (specieName == liquidName)
00325 {
00326 liquidToGasIndex_[i] = j;
00327 gasToLiquidIndex_[j] = i;
00328 isLiquidFuel_[j] = true;
00329 }
00330 }
00331 if (liquidToGasIndex_[i] == -1)
00332 {
00333 Info << "In composition:" << endl;
00334 for (label k=0; k<Ns; k++)
00335 {
00336 word specieName(composition_.Y()[k].name());
00337 Info << specieName << endl;
00338 }
00339
00340 FatalError<<
00341 "The liquid component " << liquidName
00342 << " does not exist in the species composition.Y() list.\n"
00343 << "(Probably not defined in <chem.inp>)"
00344 << abort(FatalError);
00345 }
00346 }
00347
00348 if (readFields)
00349 {
00350 parcel::readFields(*this);
00351 }
00352 }
00353
00354
00355
00356
00357 Foam::spray::~spray()
00358 {}
00359
00360
00361