1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
29 #include "atomizationModel.H"
30 #include "breakupModel.H"
31 #include "collisionModel.H"
32 #include "dispersionModel.H"
33 #include "dragModel.H"
34 #include "evaporationModel.H"
35 #include "heatTransferModel.H"
36 #include "injectorModel.H"
37 #include "wallModel.H"
39 #include "basicMultiComponentMixture.H"
41 #include "symmetryPolyPatch.H"
42 #include "wedgePolyPatch.H"
44 #include "mathematicalConstants.H"
46 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
48 defineTemplateTypeNameAndDebug(IOPtrList<injector>, 0);
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 // Construct from components
55 const volVectorField& U,
56 const volScalarField& rho,
57 const volScalarField& p,
58 const volScalarField& T,
59 const basicMultiComponentMixture& composition,
60 const PtrList<gasThermoPhysics>& gasProperties,
62 const dimensionedVector& g
65 Cloud<parcel>(U.mesh(), false), // suppress className checking on positions
67 time0_(runTime_.value()),
89 ambientPressure_(p_.average().value()),
90 ambientTemperature_(T_.average().value()),
102 injector::iNew(U.time())
106 atomizationModel::New
121 evaporationModel::New
128 heatTransferModel::New
172 mesh_.lookupObject<dictionary>("thermophysicalProperties")
184 subCycles_(readLabel(sprayProperties_.lookup("subCycles"))),
186 gasProperties_(gasProperties),
187 composition_(composition),
189 liquidToGasIndex_(fuels_->components().size(), -1),
190 gasToLiquidIndex_(composition.Y().size(), -1),
191 isLiquidFuel_(composition.Y().size(), false),
194 axisOfSymmetry_(vector::zero),
195 axisOfWedge_(vector(0,0,0)),
196 axisOfWedgeNormal_(vector(0,0,0)),
199 interpolationSchemes_(sprayProperties_.subDict("interpolationSchemes")),
200 UInterpolator_(NULL),
201 rhoInterpolator_(NULL),
202 pInterpolator_(NULL),
203 TInterpolator_(NULL),
205 sms_(mesh_.nCells(), vector::zero),
206 shs_(mesh_.nCells(), 0.0),
207 srhos_(fuels_->components().size()),
209 totalInjectedLiquidMass_(0.0),
210 injectedLiquidKE_(0.0)
213 // create the evaporation source fields
216 srhos_.set(i, new scalarField(mesh_.nCells(), 0.0));
219 // Write some information about injection parameters
220 forAll(injectors_, i)
222 const injectorType& it = injectors_[i].properties();
224 scalar v = injection().averageVelocity(i);
226 scalar ip = it.integrateTable(it.injectionPressureProfile());
227 scalar dt = it.teoi() - it.tsoi();
228 Info<< "Average Velocity for injector " << i << ": " << v << " m/s"
229 << ", injection pressure = "
230 << 1.0e-5*ip/dt << " bar"
234 // Check if the case is 2D wedge
235 const polyBoundaryMesh& bMesh = mesh().boundaryMesh();
236 bool symPlaneExist = false;
237 bool wedgeExist = false;
241 // check for the type of boundary condition
242 forAll(bMesh, patchi)
244 if (isType<symmetryPolyPatch>(bMesh[patchi]))
246 symPlaneExist = true;
248 else if (isType<wedgePolyPatch>(bMesh[patchi]))
251 patches[n++] = patchi;
255 // if wedge exist we assume that this is a 2D run.
264 "spray::spray(const volVectorField& U, "
265 "const volScalarField& rho, const volScalarField& p, "
266 "const volScalarField& T, const combustionMixture& composition,"
267 "const PtrList<gasThermoPhsyics>& gaseousFuelProperties, "
268 "const dictionary& thermophysicalProperties, "
269 "const dimensionedScalar& g)"
270 ) << "spray::(...) only one wedgePolyPatch found. "
271 "Please check you BC-setup."
272 << abort(FatalError);
275 Info<< "Constructing two dimensional spray injection.";
277 vector v1 = bMesh[patches[0]].faceAreas()[0];
278 vector v2 = bMesh[patches[1]].faceAreas()[0];
281 axisOfSymmetry_ = v1 ^ v2;
282 axisOfSymmetry_ /= mag(axisOfSymmetry_);
284 // assuming that 'v2' is the 'front' face
285 axisOfWedge_ = axisOfSymmetry_ ^ v2;
286 axisOfWedge_ /= mag(axisOfWedge_);
288 axisOfWedgeNormal_ = axisOfSymmetry_ ^ axisOfWedge_;
289 axisOfWedgeNormal_ /= mag(axisOfWedgeNormal_);
291 scalar arcCos = (v1 & v2)/mag(v1);
292 angleOfWedge_ = mathematicalConstant::pi - acos(arcCos);
294 Info<< "Calculated angle of wedge is "
295 << angleOfWedge_*180/mathematicalConstant::pi << " deg."
302 angleOfWedge_ = mathematicalConstant::pi;
303 Info<< "Constructing 180 deg three dimensional spray injection."
308 Info<< "Constructing three dimensional spray injection." << endl;
313 // find index mapping between liquid indeces and gas indeces
314 label Ns = composition_.Y().size();
316 forAll(fuels_->components(), i)
318 word liquidName(fuels_->components()[i]);
320 for (label j=0; j<Ns; j++)
322 word specieName(composition_.Y()[j].name());
324 if (specieName == liquidName)
326 liquidToGasIndex_[i] = j;
327 gasToLiquidIndex_[j] = i;
328 isLiquidFuel_[j] = true;
331 if (liquidToGasIndex_[i] == -1)
333 Info << "In composition:" << endl;
334 for (label k=0; k<Ns; k++)
336 word specieName(composition_.Y()[k].name());
337 Info << specieName << endl;
341 "The liquid component " << liquidName
342 << " does not exist in the species composition.Y() list.\n"
343 << "(Probably not defined in <chem.inp>)"
344 << abort(FatalError);
348 parcel::readFields(*this);
352 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
354 Foam::spray::~spray()
358 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
360 void Foam::spray::writeFields() const
362 parcel::writeFields(*this);
366 // ************************************************************************* //