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
00027 #include "SCOPELaminarFlameSpeed.H"
00028 #include "addToRunTimeSelectionTable.H"
00029
00030
00031
00032 namespace Foam
00033 {
00034 namespace laminarFlameSpeedModels
00035 {
00036 defineTypeNameAndDebug(SCOPE, 0);
00037
00038 addToRunTimeSelectionTable
00039 (
00040 laminarFlameSpeed,
00041 SCOPE,
00042 dictionary
00043 );
00044 }
00045 }
00046
00047
00048
00049
00050 Foam::laminarFlameSpeedModels::SCOPE::polynomial::polynomial
00051 (
00052 const dictionary& polyDict
00053 )
00054 :
00055 FixedList<scalar, 7>(polyDict.lookup("coefficients")),
00056 ll(readScalar(polyDict.lookup("lowerLimit"))),
00057 ul(readScalar(polyDict.lookup("upperLimit"))),
00058 llv(polyPhi(ll, *this)),
00059 ulv(polyPhi(ul, *this)),
00060 lu(0)
00061 {}
00062
00063
00064 Foam::laminarFlameSpeedModels::SCOPE::SCOPE
00065 (
00066 const dictionary& dict,
00067 const hhuCombustionThermo& ct
00068 )
00069 :
00070 laminarFlameSpeed(dict, ct),
00071
00072 coeffsDict_(dict.subDict(typeName + "Coeffs").subDict(fuel_)),
00073 LFL_(readScalar(coeffsDict_.lookup("lowerFlamabilityLimit"))),
00074 UFL_(readScalar(coeffsDict_.lookup("upperFlamabilityLimit"))),
00075 SuPolyL_(coeffsDict_.subDict("lowerSuPolynomial")),
00076 SuPolyU_(coeffsDict_.subDict("upperSuPolynomial")),
00077 Texp_(readScalar(coeffsDict_.lookup("Texp"))),
00078 pexp_(readScalar(coeffsDict_.lookup("pexp"))),
00079 MaPolyL_(coeffsDict_.subDict("lowerMaPolynomial")),
00080 MaPolyU_(coeffsDict_.subDict("upperMaPolynomial"))
00081 {
00082 SuPolyL_.ll = max(SuPolyL_.ll, LFL_) + SMALL;
00083 SuPolyU_.ul = min(SuPolyU_.ul, UFL_) - SMALL;
00084
00085 SuPolyL_.lu = 0.5*(SuPolyL_.ul + SuPolyU_.ll);
00086 SuPolyU_.lu = SuPolyL_.lu - SMALL;
00087
00088 MaPolyL_.lu = 0.5*(MaPolyL_.ul + MaPolyU_.ll);
00089 MaPolyU_.lu = MaPolyL_.lu - SMALL;
00090
00091 if (debug)
00092 {
00093 Info<< "phi Su (T = Tref, p = pref)" << endl;
00094 label n = 200;
00095 for (int i=0; i<n; i++)
00096 {
00097 scalar phi = (2.0*i)/n;
00098 Info<< phi << token::TAB << SuRef(phi) << endl;
00099 }
00100 }
00101 }
00102
00103
00104
00105
00106 Foam::laminarFlameSpeedModels::SCOPE::~SCOPE()
00107 {}
00108
00109
00110
00111
00112 inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::polyPhi
00113 (
00114 scalar phi,
00115 const polynomial& a
00116 )
00117 {
00118 scalar x = phi - 1.0;
00119
00120 return
00121 a[0]
00122 *(
00123 scalar(1)
00124 + x*(a[1] + x*(a[2] + x*(a[3] + x*(a[4] + x*(a[5] + x*a[6])))))
00125 );
00126 }
00127
00128
00129 inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::SuRef
00130 (
00131 scalar phi
00132 ) const
00133 {
00134 if (phi < LFL_ || phi > UFL_)
00135 {
00136
00137 return scalar(0);
00138 }
00139 else if (phi < SuPolyL_.ll)
00140 {
00141
00142
00143 return SuPolyL_.llv*(phi - LFL_)/(SuPolyL_.ll - LFL_);
00144 }
00145 else if (phi > SuPolyU_.ul)
00146 {
00147
00148
00149 return SuPolyU_.ulv*(UFL_ - phi)/(UFL_ - SuPolyU_.ul);
00150 }
00151 else if (phi < SuPolyL_.lu)
00152 {
00153
00154 return polyPhi(phi, SuPolyL_);
00155 }
00156 else if (phi > SuPolyU_.lu)
00157 {
00158
00159 return polyPhi(phi, SuPolyU_);
00160 }
00161 else
00162 {
00163 FatalErrorIn("laminarFlameSpeedModels::SCOPE::SuRef(scalar phi)")
00164 << "phi = " << phi
00165 << " cannot be handled by SCOPE function with the "
00166 "given coefficients"
00167 << exit(FatalError);
00168
00169 return scalar(0);
00170 }
00171 }
00172
00173
00174 inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::Ma
00175 (
00176 scalar phi
00177 ) const
00178 {
00179 if (phi < MaPolyL_.ll)
00180 {
00181
00182 return MaPolyL_.llv;
00183 }
00184 else if (phi > MaPolyU_.ul)
00185 {
00186
00187 return MaPolyU_.ulv;
00188 }
00189 else if (phi < SuPolyL_.lu)
00190 {
00191
00192 return polyPhi(phi, MaPolyL_);
00193 }
00194 else if (phi > SuPolyU_.lu)
00195 {
00196
00197 return polyPhi(phi, MaPolyU_);
00198 }
00199 else
00200 {
00201 FatalErrorIn("laminarFlameSpeedModels::SCOPE::Ma(scalar phi)")
00202 << "phi = " << phi
00203 << " cannot be handled by SCOPE function with the "
00204 "given coefficients"
00205 << exit(FatalError);
00206
00207 return scalar(0);
00208 }
00209 }
00210
00211
00212 inline Foam::scalar Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
00213 (
00214 scalar p,
00215 scalar Tu,
00216 scalar phi
00217 ) const
00218 {
00219 static const scalar Tref = 300.0;
00220 static const scalar pRef = 1.013e5;
00221
00222 return SuRef(phi)*pow((Tu/Tref), Texp_)*pow((p/pRef), pexp_);
00223 }
00224
00225
00226 Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
00227 (
00228 const volScalarField& p,
00229 const volScalarField& Tu,
00230 scalar phi
00231 ) const
00232 {
00233 tmp<volScalarField> tSu0
00234 (
00235 new volScalarField
00236 (
00237 IOobject
00238 (
00239 "Su0",
00240 p.time().timeName(),
00241 p.db(),
00242 IOobject::NO_READ,
00243 IOobject::NO_WRITE
00244 ),
00245 p.mesh(),
00246 dimensionedScalar("Su0", dimVelocity, 0.0)
00247 )
00248 );
00249
00250 volScalarField& Su0 = tSu0();
00251
00252 forAll(Su0, celli)
00253 {
00254 Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi);
00255 }
00256
00257 forAll(Su0.boundaryField(), patchi)
00258 {
00259 scalarField& Su0p = Su0.boundaryField()[patchi];
00260 const scalarField& pp = p.boundaryField()[patchi];
00261 const scalarField& Tup = Tu.boundaryField()[patchi];
00262
00263 forAll(Su0p, facei)
00264 {
00265 Su0p[facei] = Su0pTphi(pp[facei], Tup[facei], phi);
00266 }
00267 }
00268
00269 return tSu0;
00270 }
00271
00272
00273 Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
00274 (
00275 const volScalarField& p,
00276 const volScalarField& Tu,
00277 const volScalarField& phi
00278 ) const
00279 {
00280 tmp<volScalarField> tSu0
00281 (
00282 new volScalarField
00283 (
00284 IOobject
00285 (
00286 "Su0",
00287 p.time().timeName(),
00288 p.db(),
00289 IOobject::NO_READ,
00290 IOobject::NO_WRITE
00291 ),
00292 p.mesh(),
00293 dimensionedScalar("Su0", dimVelocity, 0.0)
00294 )
00295 );
00296
00297 volScalarField& Su0 = tSu0();
00298
00299 forAll(Su0, celli)
00300 {
00301 Su0[celli] = Su0pTphi(p[celli], Tu[celli], phi[celli]);
00302 }
00303
00304 forAll(Su0.boundaryField(), patchi)
00305 {
00306 scalarField& Su0p = Su0.boundaryField()[patchi];
00307 const scalarField& pp = p.boundaryField()[patchi];
00308 const scalarField& Tup = Tu.boundaryField()[patchi];
00309 const scalarField& phip = phi.boundaryField()[patchi];
00310
00311 forAll(Su0p, facei)
00312 {
00313 Su0p[facei] =
00314 Su0pTphi
00315 (
00316 pp[facei],
00317 Tup[facei],
00318 phip[facei]
00319 );
00320 }
00321 }
00322
00323 return tSu0;
00324 }
00325
00326
00327 Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Ma
00328 (
00329 const volScalarField& phi
00330 ) const
00331 {
00332 tmp<volScalarField> tMa
00333 (
00334 new volScalarField
00335 (
00336 IOobject
00337 (
00338 "Ma",
00339 phi.time().timeName(),
00340 phi.db(),
00341 IOobject::NO_READ,
00342 IOobject::NO_WRITE
00343 ),
00344 phi.mesh(),
00345 dimensionedScalar("Ma", dimless, 0.0)
00346 )
00347 );
00348
00349 volScalarField& ma = tMa();
00350
00351 forAll(ma, celli)
00352 {
00353 ma[celli] = Ma(phi[celli]);
00354 }
00355
00356 forAll(ma.boundaryField(), patchi)
00357 {
00358 scalarField& map = ma.boundaryField()[patchi];
00359 const scalarField& phip = phi.boundaryField()[patchi];
00360
00361 forAll(map, facei)
00362 {
00363 map[facei] = Ma(phip[facei]);
00364 }
00365 }
00366
00367 return tMa;
00368 }
00369
00370
00371 Foam::tmp<Foam::volScalarField>
00372 Foam::laminarFlameSpeedModels::SCOPE::Ma() const
00373 {
00374 if (hhuCombustionThermo_.composition().contains("ft"))
00375 {
00376 const volScalarField& ft = hhuCombustionThermo_.composition().Y("ft");
00377
00378 return Ma
00379 (
00380 dimensionedScalar
00381 (
00382 hhuCombustionThermo_.lookup("stoichiometricAirFuelMassRatio")
00383 )*ft/(scalar(1) - ft)
00384 );
00385 }
00386 else
00387 {
00388 const fvMesh& mesh = hhuCombustionThermo_.p().mesh();
00389
00390 return tmp<volScalarField>
00391 (
00392 new volScalarField
00393 (
00394 IOobject
00395 (
00396 "Ma",
00397 mesh.time().timeName(),
00398 mesh,
00399 IOobject::NO_READ,
00400 IOobject::NO_WRITE
00401 ),
00402 mesh,
00403 dimensionedScalar("Ma", dimless, Ma(equivalenceRatio_))
00404 )
00405 );
00406 }
00407 }
00408
00409
00410 Foam::tmp<Foam::volScalarField>
00411 Foam::laminarFlameSpeedModels::SCOPE::operator()() const
00412 {
00413 if (hhuCombustionThermo_.composition().contains("ft"))
00414 {
00415 const volScalarField& ft = hhuCombustionThermo_.composition().Y("ft");
00416
00417 return Su0pTphi
00418 (
00419 hhuCombustionThermo_.p(),
00420 hhuCombustionThermo_.Tu(),
00421 dimensionedScalar
00422 (
00423 hhuCombustionThermo_.lookup("stoichiometricAirFuelMassRatio")
00424 )*ft/(scalar(1) - ft)
00425 );
00426 }
00427 else
00428 {
00429 return Su0pTphi
00430 (
00431 hhuCombustionThermo_.p(),
00432 hhuCombustionThermo_.Tu(),
00433 equivalenceRatio_
00434 );
00435 }
00436 }
00437
00438
00439