1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
28 #include "atomizationModel.H"
29 #include "breakupModel.H"
30 #include "collisionModel.H"
31 #include "dispersionModel.H"
32 #include "dragModel.H"
33 #include "evaporationModel.H"
34 #include "heatTransferModel.H"
35 #include "injectorModel.H"
36 #include "wallModel.H"
38 #include "basicMultiComponentMixture.H"
40 #include "symmetryPolyPatch.H"
41 #include "wedgePolyPatch.H"
43 #include "unitConversion.H"
45 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
49 defineTemplateTypeNameAndDebug(Cloud<parcel>, 0);
50 defineTemplateTypeNameAndDebug(IOPtrList<injector>, 0);
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 const volVectorField& U,
58 const volScalarField& rho,
59 const volScalarField& p,
60 const volScalarField& T,
61 const basicMultiComponentMixture& composition,
62 const PtrList<gasThermoPhysics>& gasProperties,
64 const dimensionedVector& g,
68 Cloud<parcel>(U.mesh(), false), // suppress className checking on positions
70 time0_(runTime_.value()),
72 rndGen_(label(0), -1),
87 IOobject::MUST_READ_IF_MODIFIED,
92 ambientPressure_(p_.average().value()),
93 ambientTemperature_(T_.average().value()),
102 IOobject::MUST_READ_IF_MODIFIED,
105 injector::iNew(U.time())
109 atomizationModel::New
124 evaporationModel::New
131 heatTransferModel::New
173 liquidMixtureProperties::New
175 mesh_.lookupObject<dictionary>("thermophysicalProperties")
187 subCycles_(readLabel(sprayProperties_.lookup("subCycles"))),
189 gasProperties_(gasProperties),
190 composition_(composition),
192 liquidToGasIndex_(fuels_->components().size(), -1),
193 gasToLiquidIndex_(composition.Y().size(), -1),
194 isLiquidFuel_(composition.Y().size(), false),
197 axisOfSymmetry_(vector::zero),
198 axisOfWedge_(vector(0,0,0)),
199 axisOfWedgeNormal_(vector(0,0,0)),
202 interpolationSchemes_(sprayProperties_.subDict("interpolationSchemes")),
203 UInterpolator_(NULL),
204 rhoInterpolator_(NULL),
205 pInterpolator_(NULL),
206 TInterpolator_(NULL),
208 sms_(mesh_.nCells(), vector::zero),
209 shs_(mesh_.nCells(), 0.0),
210 srhos_(fuels_->components().size()),
212 totalInjectedLiquidMass_(0.0),
213 injectedLiquidKE_(0.0)
216 // create the evaporation source fields
219 srhos_.set(i, new scalarField(mesh_.nCells(), 0.0));
222 // Write some information about injection parameters
223 forAll(injectors_, i)
225 const injectorType& it = injectors_[i].properties();
227 scalar v = injection().averageVelocity(i);
229 scalar ip = it.integrateTable(it.injectionPressureProfile());
230 scalar dt = it.teoi() - it.tsoi();
231 Info<< "Average Velocity for injector " << i << ": " << v << " m/s"
232 << ", injection pressure = "
233 << 1.0e-5*ip/dt << " bar"
237 // Check if the case is 2D wedge
238 const polyBoundaryMesh& bMesh = mesh().boundaryMesh();
239 bool symPlaneExist = false;
240 bool wedgeExist = false;
244 // check for the type of boundary condition
245 forAll(bMesh, patchI)
247 if (isA<symmetryPolyPatch>(bMesh[patchI]))
249 symPlaneExist = true;
251 else if (isA<wedgePolyPatch>(bMesh[patchI]))
254 patches[n++] = patchI;
258 // if wedge exist we assume that this is a 2D run.
267 "spray::spray(const volVectorField& U, "
268 "const volScalarField& rho, const volScalarField& p, "
269 "const volScalarField& T, const combustionMixture& composition,"
270 "const PtrList<gasThermoPhsyics>& gaseousFuelProperties, "
271 "const dictionary& thermophysicalProperties, "
272 "const dimensionedScalar& g)"
273 ) << "spray::(...) only one wedgePolyPatch found. "
274 "Please check you BC-setup."
275 << abort(FatalError);
278 Info<< "Constructing two dimensional spray injection.";
280 vector v1 = bMesh[patches[0]].faceAreas()[0];
281 vector v2 = bMesh[patches[1]].faceAreas()[0];
284 axisOfSymmetry_ = v1 ^ v2;
285 axisOfSymmetry_ /= mag(axisOfSymmetry_);
287 // assuming that 'v2' is the 'front' face
288 axisOfWedge_ = axisOfSymmetry_ ^ v2;
289 axisOfWedge_ /= mag(axisOfWedge_);
291 axisOfWedgeNormal_ = axisOfSymmetry_ ^ axisOfWedge_;
292 axisOfWedgeNormal_ /= mag(axisOfWedgeNormal_);
294 scalar arcCos = (v1 & v2)/mag(v1);
295 angleOfWedge_ = constant::mathematical::pi - acos(arcCos);
297 Info<< "Calculated angle of wedge is "
298 << radToDeg(angleOfWedge_) << " deg."
305 angleOfWedge_ = constant::mathematical::pi;
306 Info<< "Constructing 180 deg three dimensional spray injection."
311 Info<< "Constructing three dimensional spray injection." << endl;
316 // find index mapping between liquid indeces and gas indeces
317 label Ns = composition_.Y().size();
319 forAll(fuels_->components(), i)
321 word liquidName(fuels_->components()[i]);
323 for (label j=0; j<Ns; j++)
325 word specieName(composition_.Y()[j].name());
327 if (specieName == liquidName)
329 liquidToGasIndex_[i] = j;
330 gasToLiquidIndex_[j] = i;
331 isLiquidFuel_[j] = true;
334 if (liquidToGasIndex_[i] == -1)
336 Info<< "In composition:" << endl;
337 for (label k=0; k<Ns; k++)
339 word specieName(composition_.Y()[k].name());
340 Info<< specieName << endl;
344 << "The liquid component " << liquidName
345 << " does not exist in the species composition.Y() list.\n"
346 << "(Probably not defined in <chem.inp>)"
347 << abort(FatalError);
353 parcel::readFields(*this);
358 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
360 Foam::spray::~spray()
364 // ************************************************************************* //