coding updates/corrections - second pass

This commit is contained in:
andy
2009-03-20 17:39:46 +00:00
parent 4b2f7812e8
commit c70964d155
22 changed files with 456 additions and 547 deletions

View File

@ -1,4 +1,3 @@
/* Radiation constants */
radiationConstants/radiationConstants.C
@ -31,6 +30,7 @@ submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionE
/* Boundary conditions */
derivedFvPatchFields/MarshakRadiation/MarshakRadiationMixedFvPatchScalarField.C
derivedFvPatchFields/MarshakRadiationFixedT/MarshakRadiationFixedTMixedFvPatchScalarField.C
derivedFvPatchFields/GreyDiffusiveRadiation/GreyDiffusiveRadiationMixedFvPatchScalarField.C
derivedFvPatchFields/WideBandDiffusiveRadiation/WideBandDiffusiveRadiationMixedFvPatchScalarField.C
derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C
derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libradiation

View File

@ -29,7 +29,6 @@ License
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "radiationModel.H"
#include "fvDOM.H"
#include "radiationConstants.H"
#include "mathematicalConstants.H"
@ -47,9 +46,8 @@ greyDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(p, iF),
TName_("undefinedT"),
emissivity_(0.0),
myRayIndex_(0),
myWaveLengthIndex_(0),
myRayIsInit_(-1),
rayId_(0),
wavelengthId_(0),
qr_(0)
{
refValue() = 0.0;
@ -71,9 +69,8 @@ greyDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(ptf, p, iF, mapper),
TName_(ptf.TName_),
emissivity_(ptf.emissivity_),
myRayIndex_(ptf.myRayIndex_),
myWaveLengthIndex_(ptf.myWaveLengthIndex_),
myRayIsInit_(ptf.myRayIsInit_),
rayId_(ptf.rayId_),
wavelengthId_(ptf.wavelengthId_),
qr_(ptf.qr_)
{}
@ -89,9 +86,8 @@ greyDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(p, iF),
TName_(dict.lookup("T")),
emissivity_(readScalar(dict.lookup("emissivity"))),
myRayIndex_(0),
myWaveLengthIndex_(0),
myRayIsInit_(-1),
rayId_(-1),
wavelengthId_(-1),
qr_(0)
{
const scalarField& Tp =
@ -126,9 +122,8 @@ greyDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(ptf),
TName_(ptf.TName_),
emissivity_(ptf.emissivity_),
myRayIndex_(ptf.myRayIndex_),
myWaveLengthIndex_(ptf.myWaveLengthIndex_),
myRayIsInit_(ptf.myRayIsInit_),
rayId_(ptf.rayId_),
wavelengthId_(ptf.wavelengthId_),
qr_(ptf.qr_)
{}
@ -143,9 +138,8 @@ greyDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(ptf, iF),
TName_(ptf.TName_),
emissivity_(ptf.emissivity_),
myRayIndex_(ptf.myRayIndex_),
myWaveLengthIndex_(ptf.myWaveLengthIndex_),
myRayIsInit_(ptf.myRayIsInit_),
rayId_(ptf.rayId_),
wavelengthId_(ptf.wavelengthId_),
qr_(ptf.qr_)
{}
@ -158,9 +152,8 @@ void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::autoMap
const fvPatchFieldMapper& m
)
{
scalarField::autoMap(m);
qr_.automap(m);
mixedFvPatchScalarField::autoMap(m);
qr_.autoMap(m);
}
@ -190,32 +183,28 @@ updateCoeffs()
const scalarField& Tp =
patch().lookupPatchField<volScalarField, scalar>(TName_);
const radiationModel& rad =
db().lookupObject<radiationModel>("radiationProperties");
const fvDOM& dom = db().lookupObject<fvDOM>("radiationProperties");
const fvDOM& dom = refCast<const fvDOM>(rad);
const label patchI = patch().index();
const label patchi = patch().index();
if (dom.lambdaj() == 1)
if (dom.nLambda() == 1)
{
if (myRayIsInit_ == -1)
if (rayId_ == -1)
{
for (label i=0; i < Dom.Ni() ; i++)
for (label rayI=0; rayI < dom.nRay(); rayI++)
{
for (label j=0; j < dom.lambdaj() ; j++)
for (label lambdaI=0; lambdaI < dom.nLambda(); lambdaI++)
{
const volScalarField& radiationField =
dom.RadIntRayiLambdaj(i,j);
dom.IRayWave(rayI, lambdaI);
if
(
&(radiationField.internalField())
== &dimensionedInternalField()
)
{
myRayIndex_ = i;
myWaveLengthIndex_ = j;
myRayIsInit_ = 0.0;
rayId_ = rayI;
wavelengthId_ = lambdaI;
break;
}
}
@ -234,41 +223,38 @@ updateCoeffs()
<< exit(FatalError);
}
scalarField& Iw = *this;
vectorField n = patch().Sf()/patch().magSf();
scalarField& Iw = *this;
radiativeIntensityRay& ray =
const_cast<radiativeIntensityRay&>(dom.IRay(rayId_));
qr_ = Iw*(-n & dom.RadIntRay(myRayIndex_).Di());
dom.RadIntRay(myRayIndex_).add(qr_,patchi);
ray.Qr().boundaryField()[patchI] += Iw*(-n & ray.dAve());
forAll(Iw, faceI)
{
scalar Ir = 0.0;
for (label i=0; i < dom.Ni(); i++)
for (label rayI=0; rayI < dom.nRay(); rayI++)
{
const vector& si = dom.RadIntRay(i).Si();
const vector& d = dom.IRay(rayI).d();
const scalarField& Iface = dom.RadIntRay(i).Ilambdaj
(
myWaveLengthIndex_
).boundaryField()[patch().index()];
const scalarField& Iface =
dom.IRay(rayI).IWave
(
wavelengthId_
).boundaryField()[patchI];
scalar InOut = -n[faceI] & si;
if (InOut < 0.) // qin into the wall
if ((-n[faceI] & d) < 0.0) // qin into the wall
{
const vector& di = dom.RadIntRay(i).Di();
Ir += Iface[faceI]*mag(n[faceI] & di);
const vector& dAve = dom.IRay(rayI).dAve();
Ir += Iface[faceI]*mag(n[faceI] & dAve);
}
}
const vector& mySi = dom.RadIntRay(myRayIndex_).Si();
const vector& d = dom.IRay(rayId_).d();
scalar InOut = -n[faceI] & mySi;
if (InOut > 0.) //direction out of the wall
if ((-n[faceI] & d) > 0.) //direction out of the wall
{
refGrad()[faceI] = 0.0;
valueFraction()[faceI] = 1.0;
@ -280,7 +266,7 @@ updateCoeffs()
/mathematicalConstant::pi;
}
else if (InOut < 0.) //direction into the wall
else //direction into the wall
{
valueFraction()[faceI] = 0.0;
refGrad()[faceI] = 0.0;

View File

@ -60,14 +60,11 @@ class greyDiffusiveRadiationMixedFvPatchScalarField
//- Emissivity
scalar emissivity_;
//- Direction index
label myRayIndex_;
//- Ray index
label rayId_;
//- Direction index
label myWaveLengthIndex_;
//- Initialise ray flag
label myRayIsInit_;
//- Wavelength index
label wavelengthId_;
//- Radiative heat flux on walls
scalarField qr_;

View File

@ -24,12 +24,11 @@ License
\*---------------------------------------------------------------------------*/
#include "WideBandDiffusiveRadiationMixedFvPatchScalarField.H"
#include "wideBandDiffusiveRadiationMixedFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "radiationModel.H"
#include "fvDOM.H"
#include "wideBandAbsorptionEmission.H"
#include "radiationConstants.H"
@ -45,11 +44,10 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
TName_("undefined"),
TName_("undefinedT"),
emissivity_(0.0),
myRayIndex_(0),
myWaveLengthIndex_(0),
myRayIsInit_(-1),
rayId_(0),
wavelengthId_(0),
qr_(p.size(), 0.0)
{
refValue() = 0.0;
@ -71,9 +69,8 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(ptf, p, iF, mapper),
TName_(ptf.TName_),
emissivity_(ptf.emissivity_),
myRayIndex_(ptf.myRayIndex_),
myWaveLengthIndex_(ptf.myWaveLengthIndex_),
myRayIsInit_(ptf.myRayIsInit_),
rayId_(ptf.rayId_),
wavelengthId_(ptf.wavelengthId_),
qr_(ptf.qr_)
{}
@ -89,9 +86,8 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(p, iF),
TName_(dict.lookup("T")),
emissivity_(readScalar(dict.lookup("emissivity"))),
myRayIndex_(0),
myWaveLengthIndex_(0),
myRayIsInit_(-1),
rayId_(0),
wavelengthId_(0),
qr_(p.size(), 0.0)
{
const scalarField& Tp =
@ -125,9 +121,8 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(ptf),
TName_(ptf.TName_),
emissivity_(ptf.emissivity_),
myRayIndex_(ptf.myRayIndex_),
myWaveLengthIndex_(ptf.myWaveLengthIndex_),
myRayIsInit_(ptf.myRayIsInit_),
rayId_(ptf.rayId_),
wavelengthId_(ptf.wavelengthId_),
qr_(ptf.qr_)
{}
@ -142,9 +137,8 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField
mixedFvPatchScalarField(ptf, iF),
TName_(ptf.TName_),
emissivity_(ptf.emissivity_),
myRayIndex_(ptf.myRayIndex_),
myWaveLengthIndex_(ptf.myWaveLengthIndex_),
myRayIsInit_(ptf.myRayIsInit_),
rayId_(ptf.rayId_),
wavelengthId_(ptf.wavelengthId_),
qr_(ptf.qr_)
{}
@ -156,9 +150,8 @@ void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::autoMap
const fvPatchFieldMapper& m
)
{
scalarField::autoMap(m);
qr_.automap(m);
mixedFvPatchScalarField::autoMap(m);
qr_.autoMap(m);
}
@ -185,32 +178,28 @@ updateCoeffs()
return;
}
const radiationModel& rad =
db().lookupObject<radiationModel>("radiationProperties");
const fvDOM& dom = db().lookupObject<fvDOM>("radiationProperties");
const fvDOM& dom(refCast<const fvDOM>(rad));
const label patchI = patch().index();
const label patchi = patch().index();
if (dom.lambdaj() > 1)
if (dom.nLambda() > 1)
{
if (myRayIsInit_ == -1)
if (rayId_ == -1)
{
for (label i=0; i < dom.Ni() ; i++)
for (label rayI=0; rayI < dom.nRay(); rayI++)
{
for (label j=0; j < dom.lambdaj() ; j++)
for (label lambdaI=0; lambdaI < dom.nLambda(); lambdaI++)
{
const volScalarField& radiationField =
dom.RadIntRayiLambdaj(i,j);
dom.IRayWave(rayI, lambdaI);
if
(
&(radiationField.internalField())
==&dimensionedInternalField()
)
{
myRayIndex_ = i;
myWaveLengthIndex_ = j;
myRayIsInit_ = 0.;
rayId_ = rayI;
wavelengthId_ = lambdaI;
break;
}
}
@ -225,58 +214,55 @@ updateCoeffs()
"wideBandDiffusiveRadiationMixedFvPatchScalarField::"
"updateCoeffs"
) << " a Non-grey boundary condition is used with a grey"
<< "absorption model"
<< exit(FatalError);
<< "absorption model" << nl << exit(FatalError);
}
scalarField& Iw = *this;
vectorField n = patch().Sf()/patch().magSf();
scalarField& Iw = *this;
radiativeIntensityRay& ray =
const_cast<radiativeIntensityRay&>(dom.IRay(rayId_));
qr_ = Iw*(-n & dom.RadIntRay(myRayIndex_).Di());
dom.RadIntRay(myRayIndex_).add(qr_,patchi);
ray.Qr().boundaryField()[patchI] += Iw*(-n & ray.dAve());
const scalarField Eb =
dom.blackBody().bj(myWaveLengthIndex_).boundaryField()[patchi];
dom.blackBody().bj(wavelengthId_).boundaryField()[patchI];
forAll(Iw, faceI)
{
scalar Ir = 0.0;
for(label i=0; i < dom.Ni(); i++)
for (label rayI=0; rayI < dom.nRay(); rayI++)
{
const vector& si = dom.RadIntRay(i).Si();
const vector& d = dom.IRay(rayI).d();
const scalarField& Iface = dom.RadIntRay(i).Ilambdaj
(
myWaveLengthIndex_
).boundaryField()[patch().index()];
const scalarField& Iface =
dom.IRay(rayI).IWave
(
wavelengthId_
).boundaryField()[patchI];
scalar InOut = -n[faceI] & si;
if (InOut < 0.) // qin into the wall
if ((-n[faceI] & d) < 0.0) // qin into the wall
{
const vector& di = dom.RadIntRay(i).Di();
Ir = Ir + Iface[faceI]*mag(n[faceI] & di);
const vector& dAve = dom.IRay(rayI).dAve();
Ir = Ir + Iface[faceI]*mag(n[faceI] & dAve);
}
}
const vector& mySi = dom.RadIntRay(myRayIndex_).Si();
const vector& d = dom.IRay(rayId_).d();
scalar InOut = -n[faceI] & mySi;
if (InOut > 0.) //direction out of the wall
if ((-n[faceI] & d) > 0.0) //direction out of the wall
{
refGrad()[faceI] = 0.0;
valueFraction()[faceI] = 1.0;
refValue()[faceI] =
(
Ir*(1.0 - emissivity_)
+ emissivity_* Eb[faceI]
+ emissivity_*Eb[faceI]
)
/mathematicalConstant::pi;
}
else if (InOut < 0.) //direction into the wall
else //direction into the wall
{
valueFraction()[faceI] = 0.0;
refGrad()[faceI] = 0.0;

View File

@ -60,14 +60,11 @@ class wideBandDiffusiveRadiationMixedFvPatchScalarField
//- Emissivity
scalar emissivity_;
//- Direction index
label myRayIndex_;
//- Ray index
label rayId_;
//- Direction index
label myWaveLengthIndex_;
//- Init ray flag
label myRayIsInit_;
//- Wavelength index
label wavelengthId_;
//- Radiative heat flux on walls.
scalarField qr_;

View File

@ -31,29 +31,28 @@ License
Foam::radiation::blackBodyEmission::blackBodyEmission
(
const fileName& fn,
const fileName& name,
const word& instance,
label lambdaj,
label nLambda,
const volScalarField& T
)
:
blackBodyEmissiveTable_(fn, instance, T.mesh()),
blackBodyEmissiveTable_(name, instance, T.mesh()),
C1_("C1",dimensionSet(1, 4, 3, 0, 0, 0, 0), 3.7419e-16),
C2_("C2",dimensionSet(0, 1, 0, 1, 0, 0, 0), 14.388e-6),
bj_(0),
bj_(nLambda),
T_(T)
{
bj_.setSize(lambdaj);
for (label i=0; i < lambdaj; i++)
forAll(bj_, lambdaI)
{
bj_.set
(
i,
lambdaI,
new volScalarField
(
IOobject
(
"bj_" + Foam::name(i) ,
"bj_" + Foam::name(lambdaI) ,
T.mesh().time().timeName(),
T.mesh(),
IOobject::NO_READ,
@ -80,7 +79,7 @@ Foam::scalar Foam::radiation::blackBodyEmission::flambdaT
const scalar lambdaT
) const
{
return blackBodyEmissiveTable_.LookUp(lambdaT*1.0e6)[1];
return blackBodyEmissiveTable_.lookUp(lambdaT*1.0e6)[1];
}
@ -114,7 +113,7 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT
}
else
{
forAll(T,i)
forAll(T, i)
{
scalar T1 = flambdaT(band[1]*T[i]);
scalar T2 = flambdaT(band[0]*T[i]);
@ -133,11 +132,11 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT
void Foam::radiation::blackBodyEmission::correct
(
label j,
const label lambdaI,
const Vector2D<scalar>& band
)
{
bj_[j] = EbDeltaLambdaT(T_, band);
bj_[lambdaI] = EbDeltaLambdaT(T_, band);
}

View File

@ -26,12 +26,11 @@ Class
Foam::radiation::blackBodyEmission
Description
Class Black Body Emission Intensity.
Class black body emission
SourceFiles
blackBodyEmission.C
\*---------------------------------------------------------------------------*/
#ifndef blackModyEmission_H
@ -50,28 +49,35 @@ namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class blackBodyEmission Declaration
Class blackBodyEmission Declaration
\*---------------------------------------------------------------------------*/
class blackBodyEmission
{
// Private data
mutable interpolationLookUpTable<scalar> blackBodyEmissiveTable_;
scalar flambdaT(const scalar lambdaT) const;
//- Constant C1
const dimensionedScalar C1_;
//- Constant C2
const dimensionedScalar C2_;
// Ptr List for enregy black body emission
// Ptr List for black body emission energy field for each wavelength
PtrList<volScalarField> bj_;
// Reference to the temperature field
const volScalarField& T_;
// Private member functions
scalar flambdaT(const scalar lambdaT) const;
public:
// Constructors
@ -95,9 +101,9 @@ public:
// Access
//- Black body spectrum
inline const volScalarField& bj(label i) const
inline const volScalarField& bj(const label lambdaI) const
{
return bj_[i];
return bj_[lambdaI];
}
//- Spectral emission for the black body at T and lambda
@ -121,7 +127,7 @@ public:
// Edit
// Update black body emission
void correct(label j, const Vector2D<scalar>& band);
void correct(const label lambdaI, const Vector2D<scalar>& band);
};

View File

@ -98,7 +98,6 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
mesh_,
dimensionedScalar("a", dimless/dimLength, 0.0)
),
aj_(0),
e_
(
IOobject
@ -125,27 +124,35 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
mesh_,
dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0.0)
),
Ntheta_(readLabel(radiationModelCoeffs_.lookup("Ntheta"))),
Nphi_(readLabel(radiationModelCoeffs_.lookup("Nphi"))),
Ni_(0),
lambdaj_(absorptionEmission_->nBands()),
blackBody_(fileName("blackBodyEmissivePower"), "constant", lambdaj_, T)
nTheta_(readLabel(coeffs_.lookup("nTheta"))),
nPhi_(readLabel(coeffs_.lookup("nPhi"))),
nRay_(0),
nLambda_(absorptionEmission_->nBands()),
aj_(nLambda_),
blackBody_
(
fileName("blackBodyEmissivePower"),
mesh_.time().constant(),
nLambda_,
T
),
IRay_(0),
convergence_(coeffs_.lookupOrDefault<scalar>("convergence", 0.0))
{
aj_.setSize(lambdaj_);
if (mesh_.nSolutionD() == 3) //3D
{
RadIntRay_.setSize(4.0*Nphi_*Ntheta_);
Ni_ = 4.0*Nphi_*Ntheta_;
scalar deltaPhi = mathematicalConstant::pi/(2.0*Nphi_);
scalar deltaTheta = mathematicalConstant::pi/Ntheta_;
IRay_.setSize(4*nPhi_*nTheta_);
nRay_ = 4.0*nPhi_*nTheta_;
scalar deltaPhi = mathematicalConstant::pi/(2.0*nPhi_);
scalar deltaTheta = mathematicalConstant::pi/nTheta_;
label i = 0;
for (label n = 1 ; n <= Ntheta_ ; n++)
for (label n = 1; n <= nTheta_; n++)
{
for (label m = 1 ; m <= 4*Nphi_ ; m++)
for (label m = 1; m <= 4*nPhi_; m++)
{
scalar thetai = (2.0*n - 1.0)*deltaTheta/2.0;
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
RadIntRay_.set
IRay_.set
(
i,
new radiativeIntensityRay
@ -154,7 +161,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
thetai,
deltaPhi,
deltaTheta,
lambdaj_,
nLambda_,
mesh_,
absorptionEmission_,
blackBody_
@ -170,14 +177,14 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
{
scalar thetai = mathematicalConstant::pi/2.0;
scalar deltaTheta = mathematicalConstant::pi;
RadIntRay_.setSize(4.0*Nphi_);
Ni_ = 4.0*Nphi_;
scalar deltaPhi = mathematicalConstant::pi/(2.0*Nphi_);
IRay_.setSize(4*nPhi_);
nRay_ = 4.0*nPhi_;
scalar deltaPhi = mathematicalConstant::pi/(2.0*nPhi_);
label i = 0;
for (label m = 1 ; m <= 4*Nphi_ ; m++)
for (label m = 1; m <= 4*nPhi_; m++)
{
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
RadIntRay_.set
IRay_.set
(
i,
new radiativeIntensityRay
@ -186,7 +193,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
thetai,
deltaPhi,
deltaTheta,
lambdaj_,
nLambda_,
mesh_,
absorptionEmission_,
blackBody_
@ -199,14 +206,14 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
{
scalar thetai = mathematicalConstant::pi/2.0;
scalar deltaTheta = mathematicalConstant::pi;
RadIntRay_.setSize(2);
Ni_ = 2.0;
IRay_.setSize(2);
nRay_ = 2.0;
scalar deltaPhi = mathematicalConstant::pi;
label i = 0;
for (label m = 1 ; m <= 2 ; m++)
for (label m = 1; m <= 2; m++)
{
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
RadIntRay_.set
IRay_.set
(
i,
new radiativeIntensityRay
@ -215,7 +222,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
thetai,
deltaPhi,
deltaTheta,
lambdaj_,
nLambda_,
mesh_,
absorptionEmission_,
blackBody_
@ -228,25 +235,26 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
}
// Construct absorption for wave length
for(label i=0; i < lambdaj_; i++)
// Construct absorption field for each wavelength
forAll(aj_, lambdaI)
{
volScalarField* volPtr= new volScalarField
aj_.set
(
IOobject
lambdaI,
new volScalarField
(
"aj_" + Foam::name(i) ,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
a_
IOobject
(
"aj_" + Foam::name(lambdaI) ,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
a_
)
);
aj_.set(i, volPtr);
}
}
@ -264,6 +272,9 @@ bool Foam::radiation::fvDOM::read()
{
// nothing to read
// coeffs_.lookup("nTheta") >> nTheta_;
// coeffs_.lookup("nPhi") >> nPhi_;
return true;
}
else
@ -286,22 +297,20 @@ void Foam::radiation::fvDOM::correct()
updateBlackBodyEmission();
scalar maxResidual = 0;
scalar convergenceCriterion = 0;
radiationModelCoeffs_.readIfPresent("convergence", convergenceCriterion);
label radIter = 0;
do
{
radIter ++;
for (label i = 0; i < Ni_; i++)
forAll(IRay_, rayI)
{
maxResidual = 0;
scalar maxBandResidual = RadIntRay_[i].correct(this);
maxResidual = 0.0;
scalar maxBandResidual = IRay_[rayI].correct(this);
maxResidual = max(maxBandResidual, maxResidual);
}
Info << "Radiation solver Iter: " << radIter << endl;
} while(maxResidual > convergenceCriterion);
} while(maxResidual > convergence_);
updateG();
@ -311,7 +320,6 @@ void Foam::radiation::fvDOM::correct()
Foam::tmp<Foam::volScalarField> Foam::radiation::fvDOM::Rp() const
{
return tmp<volScalarField>
(
new volScalarField
@ -348,24 +356,23 @@ Foam::radiation::fvDOM::Ru() const
void Foam::radiation::fvDOM::updateBlackBodyEmission()
{
for (label j=0; j < lambdaj_; j++)
for (label j=0; j < nLambda_; j++)
{
blackBody_.correct(j, absorptionEmission_->bands(j));
blackBody_.correct(j, absorptionEmission_->bands(j));
}
}
void Foam::radiation::fvDOM::updateG()
{
G_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
Qr_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
for (label i = 0; i < Ni_; i++)
forAll(IRay_, rayI)
{
RadIntRay_[i].addIntensity();
G_ += RadIntRay_[i].I()* RadIntRay_[i].omegai();
Qr_ += RadIntRay_[i].Qri();
IRay_[rayI].addIntensity();
G_ += IRay_[rayI].I()*IRay_[rayI].omega();
Qr_ += IRay_[rayI].Qr();
}
}

View File

@ -82,38 +82,41 @@ class fvDOM
//- Incident radiation [W/m2]
volScalarField G_;
//- Total Radiative heat flux [W/m2]
//- Total radiative heat flux [W/m2]
volScalarField Qr_;
//- Total Absorption coefficient [1/m]
//- Total absorption coefficient [1/m]
volScalarField a_;
//- wavelength total Absorption coefficient [1/m]
PtrList<volScalarField> aj_;
//- Total Emission coefficient [1/m]
//- Total emission coefficient [1/m]
volScalarField e_;
//- Emission contribution [Kg/m/s^3]
volScalarField E_;
//- Number of solid angles in theta
label Ntheta_;
label nTheta_;
//- Number of solid angles in phi
label Nphi_ ;
label nPhi_ ;
//- Total number of directions
label Ni_;
//- Total number of rays (1 per direction)
label nRay_;
//- Number of wavelength bands
label lambdaj_;
label nLambda_;
//- Black Body
//- Wavelength total absorption coefficient [1/m]
PtrList<volScalarField> aj_;
//- Black body
blackBodyEmission blackBody_;
//- List of Pointers to RadiativeIntensityRay
PtrList<radiativeIntensityRay> RadIntRay_;
//- List of pointers to radiative intensity rays
PtrList<radiativeIntensityRay> IRay_;
//- Convergence criterion
scalar convergence_;
// Private member functions
@ -127,8 +130,8 @@ class fvDOM
//- Update Absorption Coefficients
// void updateAbsorptionCoeffs(void);
//- Update Black Body Emissiom
void updateBlackBodyEmission(void);
//- Update nlack body emission
void updateBlackBodyEmission();
public:
@ -148,7 +151,7 @@ public:
fvDOM(const volScalarField& T);
// Destructor
//- Destructor
virtual ~fvDOM();
@ -174,42 +177,42 @@ public:
// Access
//- Ray intensity in i direction
inline const radiativeIntensityRay& RadIntRay(label i) const;
//- Ray intensity for rayI
inline const radiativeIntensityRay& IRay(const label rayI) const;
//- Ray intensity in i direction and j band-width
inline const volScalarField& RadIntRayiLambdaj
//- Ray intensity for rayI and lambda bandwidth
inline const volScalarField& IRayWave
(
const label i,
const label j
const label rayI,
const label lambdaI
) const;
//- Number of angles in theta
inline label Ntheta() const;
inline label nTheta() const;
//- Number of angles in phi
inline label Nphi() const;
inline label nPhi() const;
//- Number of directions
inline label Ni() const;
//- Number of rays
inline label nRay() const;
//- Number of wavelengths
inline label lambdaj() const;
inline label nLambda() const;
// Const access to a
// Const access to total absorption coefficient
inline const volScalarField& a() const;
// Const access to aj
inline const volScalarField& aj(label i) const;
// Const access to wavelength total absorption coefficient
inline const volScalarField& aj(const label lambdaI) const;
// Const access to G
// Const access to incident radiation field
inline const volScalarField& G() const;
// Const access to Qr
// Const access to total radiative heat flux field
inline const volScalarField& Qr() const;
// Const access to blackBody
virtual const blackBodyEmission& blackBody() const;
// Const access to black body
inline const blackBodyEmission& blackBody() const;
};

View File

@ -25,43 +25,44 @@ License
\*---------------------------------------------------------------------------*/
inline const Foam::radiation::radiativeIntensityRay&
Foam::radiation::fvDOM::RadIntRay(label i) const
Foam::radiation::fvDOM::IRay(const label rayI) const
{
return RadIntRay_[i];
return IRay_[rayI];
}
inline const Foam::volScalarField& Foam::radiation::fvDOM::RadIntRayiLambdaj
inline const Foam::volScalarField&
Foam::radiation::fvDOM::IRayWave
(
const label i,
const label j
const label rayI,
const label lambdaI
) const
{
return RadIntRay_[i].Ilambdaj(j);
return IRay_[rayI].IWave(lambdaI);
}
inline Foam::label Foam::radiation::fvDOM::Ntheta() const
inline Foam::label Foam::radiation::fvDOM::nTheta() const
{
return Ntheta_;
return nTheta_;
}
inline Foam::label Foam::radiation::fvDOM::Nphi() const
inline Foam::label Foam::radiation::fvDOM::nPhi() const
{
return Nphi_;
return nPhi_;
}
inline Foam::label Foam::radiation::fvDOM::Ni() const
inline Foam::label Foam::radiation::fvDOM::nRay() const
{
return Ni_;
return nRay_;
}
inline Foam::label Foam::radiation::fvDOM::lambdaj() const
inline Foam::label Foam::radiation::fvDOM::nLambda() const
{
return lambdaj_;
return nLambda_;
}
@ -73,10 +74,10 @@ inline const Foam::volScalarField& Foam::radiation::fvDOM::a() const
inline const Foam::volScalarField& Foam::radiation::fvDOM::aj
(
const label i
const label lambdaI
) const
{
return aj_[i];
return aj_[lambdaI];
}
@ -92,7 +93,7 @@ inline const Foam::volScalarField& Foam::radiation::fvDOM::Qr() const
}
virtual const Foam::radiation::blackBodyEmission&
inline const Foam::radiation::blackBodyEmission&
Foam::radiation::fvDOM::blackBody() const
{
return blackBody_;

View File

@ -79,18 +79,18 @@ Foam::label Foam::interpolationLookUpTable <Type>::index
) const
{
label i = 0;
label totalindex =
min
(
max
label totalIndex =
Foam::min
(
label((indice - min_[i])/delta_[i]),
0
),
dim_[i]
);
Foam::max
(
label((indice - min_[i])/delta_[i]),
0
),
dim_[i]
);
return totalindex;
return totalIndex;
}

View File

@ -198,7 +198,7 @@ public:
inline const List<scalar>& max() const;
//- Return const access to the table name
inline const word tableName() const;
inline word tableName() const;
// Member Operators
@ -212,6 +212,10 @@ public:
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "interpolationLookUpTableI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -84,7 +84,7 @@ Foam::interpolationLookUpTable<Type>::max() const
template<class Type>
inline const Foam::word Foam::interpolationLookUpTable<Type>::tableName() const
inline Foam::word Foam::interpolationLookUpTable<Type>::tableName() const
{
return fileName_.name();
}

View File

@ -44,11 +44,11 @@ Foam::label Foam::radiation::radiativeIntensityRay::rayId = 0;
Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
(
scalar& phii,
scalar& thetai,
scalar& deltaPhi,
scalar& deltaTheta,
label& lambdaj,
const scalar phi,
const scalar theta,
const scalar deltaPhi,
const scalar deltaTheta,
const label nLambda,
const fvMesh& mesh,
const absorptionEmissionModel& absEmmModel,
const blackBodyEmission& blackBody
@ -70,7 +70,7 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
mesh_,
dimensionedScalar("I", dimMass/pow3(dimTime), 0.0)
),
Qri_
Qr_
(
IOobject
(
@ -82,9 +82,78 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
),
mesh_,
dimensionedScalar("Qr", dimMass/pow3(dimTime), 0.0)
)
),
d_(vector::zero),
dAve_(vector::zero),
theta_(theta),
phi_(phi),
omega_(0.0),
nLambda_(nLambda),
IWave_(nLambda)
{
init(phii,thetai,deltaPhi,deltaTheta,lambdaj);
scalar sinTheta = Foam::sin(theta);
scalar cosTheta = Foam::cos(theta);
scalar sinPhi = Foam::sin(phi);
scalar cosPhi = Foam::cos(phi);
omega_ = 2.0*sinTheta*Foam::sin(deltaTheta/2.0)*deltaPhi;
d_ = vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
dAve_ = vector
(
sinPhi
*Foam::sin(0.5*deltaPhi)
*(deltaTheta - Foam::cos(2.0*theta)
*Foam::sin(deltaTheta)),
cosPhi
*Foam::sin(0.5*deltaPhi)
*(deltaTheta - Foam::cos(2.0*theta)
*Foam::sin(deltaTheta)),
0.5*deltaPhi*Foam::sin(2.0*theta)*Foam::sin(deltaTheta)
);
forAll(IWave_, i)
{
IOobject IHeader
(
"Ilambda_" + name(rayId) + "_" + name(i),
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
// check if field exists and can be read
if (IHeader.headerOk())
{
IWave_.set
(
i,
new volScalarField(IHeader, mesh_)
);
}
else
{
volScalarField IDefault
(
IOobject
(
"IDefault",
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh_
);
IWave_.set
(
i,
new volScalarField(IHeader, IDefault)
);
}
}
rayId++;
}
@ -96,131 +165,34 @@ Foam::radiation::radiativeIntensityRay::~radiativeIntensityRay()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::radiation::radiativeIntensityRay::init
(
const scalar phii,
const scalar thetai,
const scalar deltaPhi,
const scalar deltaTheta,
const scalar lambdaj
)
{
phii_ = phii;
thetai_ = thetai;
nLambdaj_ = lambdaj;
scalar sinTheta = Foam::sin(thetai);
scalar cosTheta = Foam::cos(thetai);
scalar sinPhi = Foam::sin(phii);
scalar cosPhi = Foam::cos(phii);
Si_ = vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
omegai_ = 2.0*Foam::sin(thetai)*Foam::sin(deltaTheta/2.0)*deltaPhi;
Ilambdaj_.setSize(nLambdaj_);
Di_ = vector
(
sinPhi
*Foam::sin(0.5*deltaPhi)
*(deltaTheta - Foam::cos(2.0*thetai)
*Foam::sin(deltaTheta)),
cosPhi
*Foam::sin(0.5*deltaPhi)
*(deltaTheta - Foam::cos(2.0*thetai)
*Foam::sin(deltaTheta)),
0.5*deltaPhi*Foam::sin(2.0*thetai)*Foam::sin(deltaTheta)
);
forAll(Ilambdaj_, i)
{
IOobject header
(
"Ilambda_" + name(rayId) + "_" + name(i),
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ
);
// check if field exists and can be read
if (header.headerOk())
{
Ilambdaj_.set
(
i,
new volScalarField
(
IOobject
(
"Ilambda_" + name(rayId) + "_" + name(i),
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
);
}
else
{
volScalarField Idefault
(
IOobject
(
"Idefault",
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh_
);
Ilambdaj_.set
(
i,
new volScalarField
(
IOobject
(
"Ilambda_" + name(rayId) + "_"+ name(i),
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Idefault
)
);
}
}
rayId++;
}
Foam::scalar Foam::radiation::radiativeIntensityRay::correct
(
fvDOM* DomPtr
)
{
Qri_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
// reset boundary heat flux to zero
Qr_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
scalar maxResidual = 0.0;
for(label i = 0; i < nLambdaj_; i++)
forAll(IWave_, lambdaI)
{
volScalarField k = DomPtr->aj(i);
volScalarField k = DomPtr->aj(lambdaI);
volScalarField E = absEmmModel_.ECont(i)/Foam::mathematicalConstant::pi;
volScalarField E =
absEmmModel_.ECont(lambdaI)/Foam::mathematicalConstant::pi;
surfaceScalarField Ji = Di_ & mesh_.Sf();
surfaceScalarField Ji = dAve_ & mesh_.Sf();
volScalarField Ib = blackBody_.bj(i)/Foam::mathematicalConstant::pi;
volScalarField Ib =
blackBody_.bj(lambdaI)/Foam::mathematicalConstant::pi;
fvScalarMatrix IiEq
(
fvm::div(Ji, Ilambdaj_[i], " div(Ji,Ii_h)")
+ fvm::Sp(k*omegai_, Ilambdaj_[i])
fvm::div(Ji, IWave_[lambdaI], " div(Ji,Ii_h)")
+ fvm::Sp(k*omega_, IWave_[lambdaI])
==
k*omegai_*Ib + E
k*omega_*Ib + E
);
IiEq.relax();
@ -234,6 +206,7 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct
maxResidual = max(eqnResidual, maxResidual);
}
return maxResidual;
}
@ -242,21 +215,11 @@ void Foam::radiation::radiativeIntensityRay::addIntensity()
{
I_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
for (label i = 0; i < nLambdaj_; i++)
forAll(IWave_, lambdaI)
{
I_ += absEmmModel_.addRadInt(i, Ilambdaj_[i]);
I_ += absEmmModel_.addRadInt(lambdaI, IWave_[lambdaI]);
}
}
void Foam::radiation::radiativeIntensityRay::add
(
const scalarField& qr,
const label patchI
) const
{
Qri_.boundaryField()[patchI] += qr;
}
// ************************************************************************* //

View File

@ -26,6 +26,7 @@ Class
Foam::radiation::radiativeIntensityRay
Description
Radiation intensity for a ray in a given direction
SourceFiles
radiativeIntensityRay.C
@ -65,32 +66,32 @@ class radiativeIntensityRay
//- Black body
const blackBodyEmission& blackBody_;
//- Total radiative intensity in i direction / [W/m2]
//- Total radiative intensity / [W/m2]
volScalarField I_;
//- Total radiative heat flux on boundary in i direction
mutable volScalarField Qri_;
//- Total radiative heat flux on boundary
volScalarField Qr_;
//- Direction i
vector Si_;
//- Direction
vector d_;
//- Theta angle of direction i
scalar thetai_;
//- Average direction vector inside the solid angle
vector dAve_;
//- Phi angle of direction i
scalar phii_;
//- Theta angle
scalar theta_;
//- Solid angle of direction i
scalar omegai_;
//- Phi angle
scalar phi_;
//- Number of bands on i direction
label nLambdaj_;
//- Solid angle
scalar omega_;
//- Average vector inside the solid angle
vector Di_;
//- Number of wavelengths/bands
label nLambda_;
//- List of pointers to radiative intensity wave-length
PtrList<volScalarField> Ilambdaj_;
//- List of pointers to radiative intensity fields for given wavelengths
PtrList<volScalarField> IWave_;
// Private member functions
@ -111,14 +112,14 @@ public:
// Constructors
//- Null constructor
//- Construct form components
radiativeIntensityRay
(
scalar& phii,
scalar& thetai,
scalar& deltaPhi,
scalar& deltaTheta,
label& lambdaj,
const scalar phi,
const scalar theta,
const scalar deltaPhi,
const scalar deltaTheta,
const label lambda,
const fvMesh& mesh_,
const absorptionEmissionModel& absEmmModel_,
const blackBodyEmission& blackBody
@ -139,75 +140,48 @@ public:
//- Initialise the ray in i direction
void init
(
const scalar phii,
const scalar thetai,
const scalar phi,
const scalar theta,
const scalar deltaPhi,
const scalar deltaTheta,
const scalar lambda
);
//- Add radiative heat flux on walls from the boundary patch
void add(const scalarField&, const label) const;
//- Add Radiative intensities from all the bands
//- Add radiative intensities from all the bands
void addIntensity();
// Access
//- Return intensity in i direction
inline const volScalarField& I() const
{
return I_;
}
//- Return intensity
inline const volScalarField& I() const;
//- Return heat flux on boundary in i direction
inline const volScalarField& Qri() const
{
return Qri_;
}
//- Return const access to the boundary heat flux
inline const volScalarField& Qr() const;
//- Return direction i
inline const vector Si() const
{
return Si_;
}
//- Return non-const access to the boundary heat flux
inline volScalarField& Qr();
//- Return direction
inline const vector& d() const;
//- Return the average vector inside the solid angle
inline const vector Di() const
{
return Di_;
}
inline const vector& dAve() const;
//- Return the number of bands on i direction
scalar nLambdaj() const
{
return nlambdaj_;
}
//- Return the number of bands
inline scalar nLambda() const;
//- Return the phi angle of direction i
scalar phii() const
{
return phii_;
}
//- Return the phi angle
inline scalar phi() const;
//- Return the theta angle of direction i
scalar thetai() const
{
return thetai_;
}
//- Return the theta angle
inline scalar theta() const;
//- Return the solid angle of direction i
scalar omegai() const
{
return omegai_;
}
//- Return the solid angle
inline scalar omega() const;
//- Return the list of pointers to radiative intensity wave-length
const volScalarField& Ilambdaj(const label i) const
{
return Ilambdaj_[i];
}
//- Return the radiative intensity for a given wavelength
inline const volScalarField& IWave(const label lambdaI) const;
};
@ -218,6 +192,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "radiativeIntensityRayI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -53,7 +53,7 @@ autoPtr<radiationModel> radiationModel::New
(
"radiationProperties",
T.mesh().time().constant(),
T.mesh().db(),
T.mesh().objectRegistry::db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
@ -75,7 +75,7 @@ autoPtr<radiationModel> radiationModel::New
"radiationModel::New(const volScalarField&)"
) << "Unknown radiationModel type " << radiationModelTypeName
<< nl << nl
<< "Valid radiationModel types are :" << nl
<< "Valid radiationModel types are:" << nl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}

View File

@ -54,8 +54,8 @@ Foam::radiation::radiationModel::radiationModel
IOobject
(
"radiationProperties",
T.mesh().time().constant(),
T.mesh().db(),
T.time().constant(),
T.mesh().objectRegistry::db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
@ -63,7 +63,7 @@ Foam::radiation::radiationModel::radiationModel
T_(T),
mesh_(T.mesh()),
radiation_(lookup("radiation")),
radiationModelCoeffs_(subDict(type + "Coeffs")),
coeffs_(subDict(type + "Coeffs")),
nFlowIterPerRadIter_(readLabel(lookup("nFlowIterPerRadIter"))),
absorptionEmission_(absorptionEmissionModel::New(*this, mesh_)),
scatter_(scatterModel::New(*this, mesh_))
@ -83,7 +83,7 @@ bool Foam::radiation::radiationModel::read()
if (regIOobject::read())
{
lookup("radiation") >> radiation_;
radiationModelCoeffs_ = subDict(type() + "Coeffs");
coeffs_ = subDict(type() + "Coeffs");
return true;
}

View File

@ -62,14 +62,13 @@ class absorptionEmissionModel;
class scatterModel;
/*---------------------------------------------------------------------------*\
Class radiationModel Declaration
Class radiationModel Declaration
\*---------------------------------------------------------------------------*/
class radiationModel
:
public IOdictionary
{
protected:
// Protected data
@ -83,13 +82,14 @@ protected:
//- Model specific dictionary input parameters
Switch radiation_;
//- Radiation model dictionary
dictionary radiationModelCoeffs_;
dictionary coeffs_;
//- Number of iteration in the Flow solver per Radiative solver
//- Number of iterations in the flow solver per radiation solver
// iteration
label nFlowIterPerRadIter_;
// References to the radiation sub-models
//- Absorption/emission model
@ -99,7 +99,6 @@ protected:
autoPtr<scatterModel> scatter_;
private:
// Private Member Functions
@ -111,7 +110,6 @@ private:
void operator=(const radiationModel&);
public:
//- Runtime type information
@ -135,20 +133,13 @@ public:
// Constructors
//- Construct from components
radiationModel
(
const word& type,
const volScalarField& T
);
radiationModel(const word& type, const volScalarField& T);
// Selectors
//- Return a reference to the selected radiation model
static autoPtr<radiationModel> New
(
const volScalarField& T
);
static autoPtr<radiationModel> New(const volScalarField& T);
// Destructor
@ -175,12 +166,7 @@ public:
virtual tmp<DimensionedField<scalar, volMesh> > Ru() const = 0;
//- Enthalpy source term
virtual tmp<fvScalarMatrix> Sh
(
basicThermo& thermo
) const;
virtual tmp<fvScalarMatrix> Sh(basicThermo& thermo) const;
};

View File

@ -59,14 +59,14 @@ Foam::radiation::absorptionEmissionModel::~absorptionEmissionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::a(label i) const
Foam::radiation::absorptionEmissionModel::a(const label bandI) const
{
return aDisp(i) + aCont(i);
return aDisp(bandI) + aCont(bandI);
}
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::aCont(label i) const
Foam::radiation::absorptionEmissionModel::aCont(const label bandI) const
{
return tmp<volScalarField>
(
@ -89,7 +89,7 @@ Foam::radiation::absorptionEmissionModel::aCont(label i) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::aDisp(label i) const
Foam::radiation::absorptionEmissionModel::aDisp(const label bandI) const
{
return tmp<volScalarField>
(
@ -112,14 +112,14 @@ Foam::radiation::absorptionEmissionModel::aDisp(label i) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::e(label i) const
Foam::radiation::absorptionEmissionModel::e(const label bandI) const
{
return eDisp(i) + eCont(i);
return eDisp(bandI) + eCont(bandI);
}
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::eCont(label i) const
Foam::radiation::absorptionEmissionModel::eCont(const label bandI) const
{
return tmp<volScalarField>
(
@ -142,7 +142,7 @@ Foam::radiation::absorptionEmissionModel::eCont(label i) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::eDisp(label i) const
Foam::radiation::absorptionEmissionModel::eDisp(const label bandI) const
{
return tmp<volScalarField>
(
@ -165,14 +165,14 @@ Foam::radiation::absorptionEmissionModel::eDisp(label i) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::E(label i) const
Foam::radiation::absorptionEmissionModel::E(const label bandI) const
{
return EDisp(i) + ECont(i);
return EDisp(bandI) + ECont(bandI);
}
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::ECont(label i) const
Foam::radiation::absorptionEmissionModel::ECont(const label bandI) const
{
return tmp<volScalarField>
(
@ -195,7 +195,7 @@ Foam::radiation::absorptionEmissionModel::ECont(label i) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::EDisp(label i) const
Foam::radiation::absorptionEmissionModel::EDisp(const label bandI) const
{
return tmp<volScalarField>
(
@ -224,9 +224,8 @@ Foam::label Foam::radiation::absorptionEmissionModel::nBands() const
const Foam::Vector2D<Foam::scalar>&
Foam::radiation::absorptionEmissionModel::bands(label n) const
Foam::radiation::absorptionEmissionModel::bands(const label n) const
{
return Vector2D<scalar>::one;
}
@ -240,11 +239,11 @@ bool Foam::radiation::absorptionEmissionModel::isGrey() const
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::addRadInt
(
const label i,
const volScalarField& Ilambdaj
const label rayI,
const volScalarField& IWave
) const
{
return Ilambdaj;
return IWave;
}

View File

@ -96,12 +96,11 @@ public:
//- Selector
static autoPtr<absorptionEmissionModel> New
(
const dictionary& dict,
const fvMesh& mesh
);
static autoPtr<absorptionEmissionModel> New
(
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
@ -124,6 +123,7 @@ public:
return dict_;
}
// Absorption coefficient
//- Absorption coefficient (net)
@ -166,16 +166,16 @@ public:
//- Const access to the bands - defaults to Vector2D::one for grey
// absorption/emission
virtual const Vector2D<scalar>& bands(label n) const;
virtual const Vector2D<scalar>& bands(const label n) const;
//- Flag for whether the absorption/emission is for a grey gas
virtual bool isGrey(void) const;
virtual bool isGrey() const;
//- Add radiative intensity fir ray i
//- Add radiative intensity for ray i
virtual tmp<volScalarField> addRadInt
(
const label i,
const volScalarField& Ilambdaj
const label rayI,
const volScalarField& IWave
) const;
//- Correct absorption coefficients
@ -183,7 +183,7 @@ public:
(
volScalarField& a,
PtrList<volScalarField>& aj
) const ;
) const;
};

View File

@ -63,7 +63,7 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
mesh.time().constant(),
mesh
),
thermo_(mesh.db().lookupObject<basicThermo>("thermophysicalProperties")),
thermo_(mesh.lookupObject<basicThermo>("thermophysicalProperties")),
EhrrCoeff_(readScalar(coeffsDict_.lookup("EhrrCoeff"))),
Yj_(0)
{
@ -91,7 +91,7 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
label j = 0;
forAllConstIter(HashTable<label>, speciesNames_, iter)
{
if (mesh.db().foundObject<volScalarField>("ft"))
if (mesh.foundObject<volScalarField>("ft"))
{
if (lookUpTable_.found(iter.key()))
{
@ -102,15 +102,15 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
specieIndex_[iter()] = index;
}
else if (mesh.db().foundObject<volScalarField>(iter.key()))
else if (mesh.foundObject<volScalarField>(iter.key()))
{
volScalarField& Y =
const_cast<volScalarField&>
(
mesh.db().lookupObject<volScalarField>(iter.key())
mesh.lookupObject<volScalarField>(iter.key())
);
Yj_.set(j, &Y);
specieIndex_[iter()] = 0.0;
specieIndex_[iter()] = 0;
j++;
Info << "specie: " << iter.key() << " is being solved "
<< endl;
@ -154,8 +154,7 @@ Foam::radiation::greyMeanAbsorptionEmission::aCont(const label bandI) const
{
const volScalarField& T = thermo_.T();
const volScalarField& p = thermo_.p();
const volScalarField& ft =
this->mesh().db().lookupObject<volScalarField>("ft");
const volScalarField& ft = mesh_.lookupObject<volScalarField>("ft");
label nSpecies = speciesNames_.size();
@ -234,7 +233,7 @@ Foam::radiation::greyMeanAbsorptionEmission::eCont(const label bandI) const
IOobject::NO_WRITE
),
mesh(),
dimensionedScalar("e",dimless/dimLength, 0.0)
dimensionedScalar("e", dimless/dimLength, 0.0)
)
);
@ -252,21 +251,20 @@ Foam::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const
IOobject
(
"E",
mesh().time().timeName(),
mesh(),
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh(),
mesh_,
dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0.0)
)
);
if (mesh().db().foundObject<volScalarField>("hrr"))
if (mesh_.foundObject<volScalarField>("hrr"))
{
const volScalarField& hrr =
mesh().db().lookupObject<volScalarField>("hrr");
E().internalField() = EhrrCoeff_*hrr.internalField();
const volScalarField& hrr = mesh_.lookupObject<volScalarField>("hrr");
E().internalField() = EhrrCoeff_*hrr.internalField();
}
return E;

View File

@ -63,7 +63,7 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
mesh.time().constant(),
mesh
),
thermo_(mesh.db().lookupObject<basicThermo>("thermophysicalProperties")),
thermo_(mesh.lookupObject<basicThermo>("thermophysicalProperties")),
Yj_(0),
totalWaveLength_(0)
{
@ -85,7 +85,7 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
label nSpec = 0;
const dictionary& specDicts = dict.subDict("species");
forAllConstIter(dictionary, SpecDicts, iter)
forAllConstIter(dictionary, specDicts, iter)
{
const word& key = iter().keyword();
if (nBand == 0)
@ -124,10 +124,10 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
<< " with index: " << index << endl;
specieIndex_[iter()] = index;
}
else if (mesh.db().foundObject<volScalarField>(iter.key()))
else if (mesh.foundObject<volScalarField>(iter.key()))
{
volScalarField& Y = const_cast<volScalarField&>
(mesh.db().lookupObject<volScalarField>(iter.key()));
(mesh.lookupObject<volScalarField>(iter.key()));
Yj_.set(j, &Y);
@ -164,8 +164,7 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandI) const
{
const volScalarField& T = thermo_.T();
const volScalarField& p = thermo_.p();
const volScalarField& ft =
this->mesh().db().lookupObject<volScalarField>("ft");
const volScalarField& ft = mesh_.lookupObject<volScalarField>("ft");
label nSpecies = speciesNames_.size();
@ -275,10 +274,10 @@ Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandI) const
)
);
if (mesh().db().foundObject<volScalarField>("hrr"))
if (mesh().foundObject<volScalarField>("hrr"))
{
const volScalarField& hrr =
mesh().db().lookupObject<volScalarField>("hrr");
mesh().lookupObject<volScalarField>("hrr");
E().internalField() =
iEhrrCoeffs_[bandI]
*hrr.internalField()