1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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 "mathematicalConstants.H"
45 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
47 defineTemplateTypeNameAndDebug(IOPtrList<injector>, 0);
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 // Construct from components
54 const volVectorField& U,
55 const volScalarField& rho,
56 const volScalarField& p,
57 const volScalarField& T,
58 const basicMultiComponentMixture& composition,
59 const PtrList<gasThermoPhysics>& gasProperties,
61 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 sprayIteration_(sprayProperties_.subDict("sprayIteration")),
185 sprayIterate_(readLabel(sprayIteration_.lookup("sprayIterate"))),
186 sprayRelaxFactor_(readScalar(sprayIteration_.lookup("sprayRelaxFactor"))),
189 readScalar(sprayIteration_.lookup("minimumParcelMass"))
192 subCycles_(readLabel(sprayProperties_.lookup("subCycles"))),
194 gasProperties_(gasProperties),
195 composition_(composition),
197 liquidToGasIndex_(fuels_->components().size(), -1),
198 gasToLiquidIndex_(composition.Y().size(), -1),
199 isLiquidFuel_(composition.Y().size(), false),
202 axisOfSymmetry_(vector::zero),
203 axisOfWedge_(vector(0,0,0)),
204 axisOfWedgeNormal_(vector(0,0,0)),
207 interpolationSchemes_(sprayProperties_.subDict("interpolationSchemes")),
208 UInterpolator_(NULL),
209 rhoInterpolator_(NULL),
210 pInterpolator_(NULL),
211 TInterpolator_(NULL),
213 sms_(mesh_.nCells(), vector::zero),
214 shs_(mesh_.nCells(), 0.0),
215 srhos_(fuels_->components().size()),
217 totalInjectedLiquidMass_(0.0),
218 injectedLiquidKE_(0.0)
221 // create the evaporation source fields
224 srhos_.set(i, new scalarField(mesh_.nCells(), 0.0));
227 // Write some information about injection parameters
228 forAll(injectors_, i)
230 const injectorType& it = injectors_[i].properties();
232 scalar v = injection().averageVelocity(i);
234 scalar ip = it.integrateTable(it.injectionPressureProfile());
235 scalar dt = it.teoi() - it.tsoi();
236 Info<< "Average Velocity for injector " << i << ": " << v << " m/s"
237 << ", injection pressure = "
238 << 1.0e-5*ip/dt << " bar"
242 // Check if the case is 2D wedge
243 const polyBoundaryMesh& bMesh = mesh().boundaryMesh();
244 bool symPlaneExist = false;
245 bool wedgeExist = false;
249 // check for the type of boundary condition
250 forAll(bMesh, patchi)
252 if (isA<symmetryPolyPatch>(bMesh[patchi]))
254 symPlaneExist = true;
256 else if (isA<wedgePolyPatch>(bMesh[patchi]))
259 patches[n++] = patchi;
263 // if wedge exist we assume that this is a 2D run.
272 "spray::spray(const volVectorField& U, "
273 "const volScalarField& rho, const volScalarField& p, "
274 "const volScalarField& T, const combustionMixture& composition,"
275 "const PtrList<gasThermoPhsyics>& gaseousFuelProperties, "
276 "const dictionary& thermophysicalProperties, "
277 "const dimensionedScalar& g)"
278 ) << "spray::(...) only one wedgePolyPatch found. "
279 "Please check you BC-setup."
280 << abort(FatalError);
283 Info<< "Constructing two dimensional spray injection.";
285 vector v1 = bMesh[patches[0]].faceAreas()[0];
286 vector v2 = bMesh[patches[1]].faceAreas()[0];
289 axisOfSymmetry_ = v1 ^ v2;
290 axisOfSymmetry_ /= mag(axisOfSymmetry_);
292 // assuming that 'v2' is the 'front' face
293 axisOfWedge_ = axisOfSymmetry_ ^ v2;
294 axisOfWedge_ /= mag(axisOfWedge_);
296 axisOfWedgeNormal_ = axisOfSymmetry_ ^ axisOfWedge_;
297 axisOfWedgeNormal_ /= mag(axisOfWedgeNormal_);
299 scalar arcCos = (v1 & v2)/mag(v1);
300 angleOfWedge_ = mathematicalConstant::pi - acos(arcCos);
302 Info<< "Calculated angle of wedge is "
303 << angleOfWedge_*180/mathematicalConstant::pi << " deg."
310 angleOfWedge_ = mathematicalConstant::pi;
311 Info<< "Constructing 180 deg three dimensional spray injection."
316 Info<< "Constructing three dimensional spray injection." << endl;
321 // find index mapping between liquid indeces and gas indeces
322 label Ns = composition_.Y().size();
324 forAll(fuels_->components(), i)
326 word liquidName(fuels_->components()[i]);
328 for (label j=0; j<Ns; j++)
330 word specieName(composition_.Y()[j].name());
332 if (specieName == liquidName)
334 liquidToGasIndex_[i] = j;
335 gasToLiquidIndex_[j] = i;
336 isLiquidFuel_[j] = true;
339 if (liquidToGasIndex_[i] == -1)
341 Info << "In composition:" << endl;
342 for (label k=0; k<Ns; k++)
344 word specieName(composition_.Y()[k].name());
345 Info << specieName << endl;
349 "The liquid component " << liquidName
350 << " does not exist in the species composition.Y() list.\n"
351 << "(Probably not defined in <chem.inp>)"
352 << abort(FatalError);
358 parcel::readFields(*this);
363 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
365 Foam::spray::~spray()
369 // ************************************************************************* //