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 "basicThermo.H"
00028 #include "fvMesh.H"
00029 #include "HashTable.H"
00030 #include "zeroGradientFvPatchFields.H"
00031 #include "fixedEnthalpyFvPatchScalarField.H"
00032 #include "gradientEnthalpyFvPatchScalarField.H"
00033 #include "mixedEnthalpyFvPatchScalarField.H"
00034 #include "fixedInternalEnergyFvPatchScalarField.H"
00035 #include "gradientInternalEnergyFvPatchScalarField.H"
00036 #include "mixedInternalEnergyFvPatchScalarField.H"
00037
00038
00039
00040 namespace Foam
00041 {
00042 defineTypeNameAndDebug(basicThermo, 0);
00043 }
00044
00045
00046
00047 Foam::wordList Foam::basicThermo::hBoundaryTypes()
00048 {
00049 const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
00050
00051 wordList hbt = tbf.types();
00052
00053 forAll(tbf, patchi)
00054 {
00055 if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
00056 {
00057 hbt[patchi] = fixedEnthalpyFvPatchScalarField::typeName;
00058 }
00059 else if
00060 (
00061 isA<zeroGradientFvPatchScalarField>(tbf[patchi])
00062 || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
00063 )
00064 {
00065 hbt[patchi] = gradientEnthalpyFvPatchScalarField::typeName;
00066 }
00067 else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
00068 {
00069 hbt[patchi] = mixedEnthalpyFvPatchScalarField::typeName;
00070 }
00071 }
00072
00073 return hbt;
00074 }
00075
00076
00077 void Foam::basicThermo::hBoundaryCorrection(volScalarField& h)
00078 {
00079 volScalarField::GeometricBoundaryField& hbf = h.boundaryField();
00080
00081 forAll(hbf, patchi)
00082 {
00083 if (isA<gradientEnthalpyFvPatchScalarField>(hbf[patchi]))
00084 {
00085 refCast<gradientEnthalpyFvPatchScalarField>(hbf[patchi]).gradient()
00086 = hbf[patchi].fvPatchField::snGrad();
00087 }
00088 else if (isA<mixedEnthalpyFvPatchScalarField>(hbf[patchi]))
00089 {
00090 refCast<mixedEnthalpyFvPatchScalarField>(hbf[patchi]).refGrad()
00091 = hbf[patchi].fvPatchField::snGrad();
00092 }
00093 }
00094 }
00095
00096
00097 Foam::wordList Foam::basicThermo::eBoundaryTypes()
00098 {
00099 const volScalarField::GeometricBoundaryField& tbf = T_.boundaryField();
00100
00101 wordList ebt = tbf.types();
00102
00103 forAll(tbf, patchi)
00104 {
00105 if (isA<fixedValueFvPatchScalarField>(tbf[patchi]))
00106 {
00107 ebt[patchi] = fixedInternalEnergyFvPatchScalarField::typeName;
00108 }
00109 else if
00110 (
00111 isA<zeroGradientFvPatchScalarField>(tbf[patchi])
00112 || isA<fixedGradientFvPatchScalarField>(tbf[patchi])
00113 )
00114 {
00115 ebt[patchi] = gradientInternalEnergyFvPatchScalarField::typeName;
00116 }
00117 else if (isA<mixedFvPatchScalarField>(tbf[patchi]))
00118 {
00119 ebt[patchi] = mixedInternalEnergyFvPatchScalarField::typeName;
00120 }
00121 }
00122
00123 return ebt;
00124 }
00125
00126
00127 void Foam::basicThermo::eBoundaryCorrection(volScalarField& e)
00128 {
00129 volScalarField::GeometricBoundaryField& ebf = e.boundaryField();
00130
00131 forAll(ebf, patchi)
00132 {
00133 if (isA<gradientInternalEnergyFvPatchScalarField>(ebf[patchi]))
00134 {
00135 refCast<gradientInternalEnergyFvPatchScalarField>(ebf[patchi])
00136 .gradient() = ebf[patchi].fvPatchField::snGrad();
00137 }
00138 else if (isA<mixedInternalEnergyFvPatchScalarField>(ebf[patchi]))
00139 {
00140 refCast<mixedInternalEnergyFvPatchScalarField>(ebf[patchi])
00141 .refGrad() = ebf[patchi].fvPatchField::snGrad();
00142 }
00143 }
00144 }
00145
00146
00147
00148 Foam::basicThermo::basicThermo(const fvMesh& mesh)
00149 :
00150 IOdictionary
00151 (
00152 IOobject
00153 (
00154 "thermophysicalProperties",
00155 mesh.time().constant(),
00156 mesh,
00157 IOobject::MUST_READ,
00158 IOobject::NO_WRITE
00159 )
00160 ),
00161
00162 p_
00163 (
00164 IOobject
00165 (
00166 "p",
00167 mesh.time().timeName(),
00168 mesh,
00169 IOobject::MUST_READ,
00170 IOobject::AUTO_WRITE
00171 ),
00172 mesh
00173 ),
00174
00175 psi_
00176 (
00177 IOobject
00178 (
00179 "psi",
00180 mesh.time().timeName(),
00181 mesh,
00182 IOobject::NO_READ,
00183 IOobject::NO_WRITE
00184 ),
00185 mesh,
00186 dimensionSet(0, -2, 2, 0, 0)
00187 ),
00188
00189 T_
00190 (
00191 IOobject
00192 (
00193 "T",
00194 mesh.time().timeName(),
00195 mesh,
00196 IOobject::MUST_READ,
00197 IOobject::AUTO_WRITE
00198 ),
00199 mesh
00200 ),
00201
00202 mu_
00203 (
00204 IOobject
00205 (
00206 "mu",
00207 mesh.time().timeName(),
00208 mesh,
00209 IOobject::NO_READ,
00210 IOobject::NO_WRITE
00211 ),
00212 mesh,
00213 dimensionSet(1, -1, -1, 0, 0)
00214 ),
00215
00216 alpha_
00217 (
00218 IOobject
00219 (
00220 "alpha",
00221 mesh.time().timeName(),
00222 mesh,
00223 IOobject::NO_READ,
00224 IOobject::NO_WRITE
00225 ),
00226 mesh,
00227 dimensionSet(1, -1, -1, 0, 0)
00228 )
00229 {}
00230
00231
00232
00233
00234 Foam::basicThermo::~basicThermo()
00235 {}
00236
00237
00238
00239
00240 Foam::volScalarField& Foam::basicThermo::p()
00241 {
00242 return p_;
00243 }
00244
00245
00246 const Foam::volScalarField& Foam::basicThermo::p() const
00247 {
00248 return p_;
00249 }
00250
00251
00252 const Foam::volScalarField& Foam::basicThermo::psi() const
00253 {
00254 return psi_;
00255 }
00256
00257
00258 Foam::volScalarField& Foam::basicThermo::h()
00259 {
00260 notImplemented("basicThermo::h()");
00261 return const_cast<volScalarField&>(volScalarField::null());
00262 }
00263
00264
00265 const Foam::volScalarField& Foam::basicThermo::h() const
00266 {
00267 notImplemented("basicThermo::h() const");
00268 return volScalarField::null();
00269 }
00270
00271
00272 Foam::tmp<Foam::scalarField> Foam::basicThermo::h
00273 (
00274 const scalarField& T,
00275 const labelList& cells
00276 ) const
00277 {
00278 notImplemented
00279 (
00280 "basicThermo::h"
00281 "(const scalarField& T, const labelList& cells) const"
00282 );
00283 return tmp<scalarField>(NULL);
00284 }
00285
00286
00287 Foam::tmp<Foam::scalarField> Foam::basicThermo::h
00288 (
00289 const scalarField& T,
00290 const label patchi
00291 ) const
00292 {
00293 notImplemented
00294 (
00295 "basicThermo::h"
00296 "(const scalarField& T, const label patchi) const"
00297 );
00298 return tmp<scalarField>(NULL);
00299 }
00300
00301
00302 Foam::volScalarField& Foam::basicThermo::e()
00303 {
00304 notImplemented("basicThermo::e()");
00305 return const_cast<volScalarField&>(volScalarField::null());
00306 }
00307
00308
00309 const Foam::volScalarField& Foam::basicThermo::e() const
00310 {
00311 notImplemented("basicThermo::e()");
00312 return volScalarField::null();
00313 }
00314
00315
00316 Foam::tmp<Foam::scalarField> Foam::basicThermo::e
00317 (
00318 const scalarField& T,
00319 const labelList& cells
00320 ) const
00321 {
00322 notImplemented
00323 (
00324 "basicThermo::e"
00325 "(const scalarField& T, const labelList& cells) const"
00326 );
00327 return tmp<scalarField>(NULL);
00328 }
00329
00330
00331 Foam::tmp<Foam::scalarField> Foam::basicThermo::e
00332 (
00333 const scalarField& T,
00334 const label patchi
00335 ) const
00336 {
00337 notImplemented
00338 (
00339 "basicThermo::e"
00340 "(const scalarField& T, const label patchi) const"
00341 );
00342 return tmp<scalarField>(NULL);
00343 }
00344
00345
00346 const Foam::volScalarField& Foam::basicThermo::T() const
00347 {
00348 return T_;
00349 }
00350
00351
00352 Foam::tmp<Foam::scalarField> Foam::basicThermo::Cp
00353 (
00354 const scalarField& T,
00355 const label patchi
00356 ) const
00357 {
00358 notImplemented
00359 (
00360 "basicThermo::Cp"
00361 "(const scalarField& T, const label patchi) const"
00362 );
00363 return tmp<scalarField>(NULL);
00364 }
00365
00366
00367 Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cp() const
00368 {
00369 notImplemented("basicThermo::Cp() const");
00370 return volScalarField::null();
00371 }
00372
00373
00374 Foam::tmp<Foam::scalarField> Foam::basicThermo::Cv
00375 (
00376 const scalarField& T,
00377 const label patchi
00378 ) const
00379 {
00380 notImplemented
00381 (
00382 "basicThermo::Cv"
00383 "(const scalarField& T, const label patchi) const"
00384 );
00385 return tmp<scalarField>(NULL);
00386 }
00387
00388
00389 Foam::tmp<Foam::volScalarField> Foam::basicThermo::Cv() const
00390 {
00391 notImplemented("basicThermo::Cv() const");
00392 return volScalarField::null();
00393 }
00394
00395
00396 const Foam::volScalarField& Foam::basicThermo::mu() const
00397 {
00398 return mu_;
00399 }
00400
00401
00402 const Foam::volScalarField& Foam::basicThermo::alpha() const
00403 {
00404 return alpha_;
00405 }
00406
00407
00408 bool Foam::basicThermo::read()
00409 {
00410 return regIOobject::read();
00411 }
00412
00413
00414