Newer
Older
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "spray.H"
#include "atomizationModel.H"
#include "breakupModel.H"
#include "collisionModel.H"
#include "dispersionModel.H"
#include "dragModel.H"
#include "evaporationModel.H"
#include "heatTransferModel.H"
#include "injectorModel.H"
#include "wallModel.H"
Andrew Heather
committed
#include "basicMultiComponentMixture.H"
#include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebug(IOPtrList<injector>, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::spray::spray
(
const volVectorField& U,
const volScalarField& rho,
const volScalarField& p,
const volScalarField& T,
Andrew Heather
committed
const basicMultiComponentMixture& composition,
const PtrList<gasThermoPhysics>& gasProperties,
const dimensionedVector& g
Cloud<parcel>(U.mesh(), false), // suppress className checking on positions
runTime_(U.time()),
time0_(runTime_.value()),
mesh_(U.mesh()),
rndGen_(label(0)),
g_(g.value()),
U_(U),
rho_(rho),
p_(p),
T_(T),
sprayProperties_
(
IOobject
(
"sprayProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
ambientPressure_(p_.average().value()),
ambientTemperature_(T_.average().value()),
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
injectors_
(
IOobject
(
"injectorProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
),
injector::iNew(U.time())
),
atomization_
(
atomizationModel::New
(
sprayProperties_,
*this
)
),
drag_
(
dragModel::New
(
sprayProperties_
)
),
evaporation_
(
evaporationModel::New
(
sprayProperties_
)
),
heatTransfer_
(
heatTransferModel::New
(
sprayProperties_
)
),
wall_
(
wallModel::New
(
sprayProperties_,
U,
*this
)
),
breakupModel_
(
breakupModel::New
(
sprayProperties_,
*this
)
),
collisionModel_
(
collisionModel::New
(
sprayProperties_,
*this,
rndGen_
)
),
dispersionModel_
(
dispersionModel::New
(
sprayProperties_,
*this
)
),
fuels_
(
liquidMixture::New
(
mesh_.lookupObject<dictionary>("thermophysicalProperties")
)
),
injectorModel_
(
injectorModel::New
(
sprayProperties_,
*this
)
),
subCycles_(readLabel(sprayProperties_.lookup("subCycles"))),
gasProperties_(gasProperties),
composition_(composition),
liquidToGasIndex_(fuels_->components().size(), -1),
gasToLiquidIndex_(composition.Y().size(), -1),
isLiquidFuel_(composition.Y().size(), false),
twoD_(0),
axisOfSymmetry_(vector::zero),
axisOfWedge_(vector(0,0,0)),
axisOfWedgeNormal_(vector(0,0,0)),
angleOfWedge_(0.0),
interpolationSchemes_(sprayProperties_.subDict("interpolationSchemes")),
UInterpolator_(NULL),
rhoInterpolator_(NULL),
pInterpolator_(NULL),
TInterpolator_(NULL),
sms_(mesh_.nCells(), vector::zero),
shs_(mesh_.nCells(), 0.0),
srhos_(fuels_->components().size()),
totalInjectedLiquidMass_(0.0),
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
{
// create the evaporation source fields
forAll(srhos_, i)
{
srhos_.set(i, new scalarField(mesh_.nCells(), 0.0));
}
// Write some information about injection parameters
forAll(injectors_, i)
{
const injectorType& it = injectors_[i].properties();
scalar v = injection().averageVelocity(i);
scalar ip = it.integrateTable(it.injectionPressureProfile());
scalar dt = it.teoi() - it.tsoi();
Info<< "Average Velocity for injector " << i << ": " << v << " m/s"
<< ", injection pressure = "
<< 1.0e-5*ip/dt << " bar"
<< endl;
}
// Check if the case is 2D wedge
const polyBoundaryMesh& bMesh = mesh().boundaryMesh();
bool symPlaneExist = false;
bool wedgeExist = false;
label patches[2];
label n=0;
// check for the type of boundary condition
forAll(bMesh, patchi)
{
if (isType<symmetryPolyPatch>(bMesh[patchi]))
{
symPlaneExist = true;
}
else if (isType<wedgePolyPatch>(bMesh[patchi]))
{
wedgeExist = true;
patches[n++] = patchi;
}
}
// if wedge exist we assume that this is a 2D run.
twoD_ = wedgeExist;
if (twoD_)
{
if (n<2)
{
FatalErrorIn
(
"spray::spray(const volVectorField& U, "
"const volScalarField& rho, const volScalarField& p, "
"const volScalarField& T, const combustionMixture& composition,"
"const PtrList<gasThermoPhsyics>& gaseousFuelProperties, "
"const dictionary& thermophysicalProperties, "
"const dimensionedScalar& g)"
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
) << "spray::(...) only one wedgePolyPatch found. "
"Please check you BC-setup."
<< abort(FatalError);
}
Info<< "Constructing two dimensional spray injection.";
vector v1 = bMesh[patches[0]].faceAreas()[0];
vector v2 = bMesh[patches[1]].faceAreas()[0];
v1 /= mag(v1);
v2 /= mag(v2);
axisOfSymmetry_ = v1 ^ v2;
axisOfSymmetry_ /= mag(axisOfSymmetry_);
// assuming that 'v2' is the 'front' face
axisOfWedge_ = axisOfSymmetry_ ^ v2;
axisOfWedge_ /= mag(axisOfWedge_);
axisOfWedgeNormal_ = axisOfSymmetry_ ^ axisOfWedge_;
axisOfWedgeNormal_ /= mag(axisOfWedgeNormal_);
scalar arcCos = (v1 & v2)/mag(v1);
angleOfWedge_ = mathematicalConstant::pi - acos(arcCos);
Info<< "Calculated angle of wedge is "
<< angleOfWedge_*180/mathematicalConstant::pi << " deg."
<< endl;
}
else
{
if (symPlaneExist)
{
angleOfWedge_ = mathematicalConstant::pi;
Info<< "Constructing 180 deg three dimensional spray injection."
<< endl;
}
else
{
Info<< "Constructing three dimensional spray injection." << endl;
}
}
// find index mapping between liquid indeces and gas indeces
label Ns = composition_.Y().size();
forAll(fuels_->components(), i)
{
word liquidName(fuels_->components()[i]);
for (label j=0; j<Ns; j++)
{
word specieName(composition_.Y()[j].name());
if (specieName == liquidName)
{
liquidToGasIndex_[i] = j;
gasToLiquidIndex_[j] = i;
isLiquidFuel_[j] = true;
}
}
if (liquidToGasIndex_[i] == -1)
{
Info << "In composition:" << endl;
for (label k=0; k<Ns; k++)
{
word specieName(composition_.Y()[k].name());
Info << specieName << endl;
}
FatalError<<
"The liquid component " << liquidName
<< " does not exist in the species composition.Y() list.\n"
<< "(Probably not defined in <chem.inp>)"
<< abort(FatalError);
}
}
parcel::readFields(*this);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::spray::~spray()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::spray::writeFields() const
{
parcel::writeFields(*this);
}
// ************************************************************************* //