mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
coding updates/corrections - first pass
This commit is contained in:
@ -24,7 +24,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "GreyDiffusiveRadiationMixedFvPatchScalarField.H"
|
#include "greyDiffusiveRadiationMixedFvPatchScalarField.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "fvPatchFieldMapper.H"
|
#include "fvPatchFieldMapper.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
@ -37,15 +37,15 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mixedFvPatchScalarField(p, iF),
|
mixedFvPatchScalarField(p, iF),
|
||||||
TName_("undefined"),
|
TName_("undefinedT"),
|
||||||
emissivity_(0.0),
|
emissivity_(0.0),
|
||||||
myRayIndex_(0),
|
myRayIndex_(0),
|
||||||
myWaveLengthIndex_(0),
|
myWaveLengthIndex_(0),
|
||||||
@ -59,10 +59,10 @@ GreyDiffusiveRadiationMixedFvPatchField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const GreyDiffusiveRadiationMixedFvPatchField& ptf,
|
const greyDiffusiveRadiationMixedFvPatchScalarField& ptf,
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
@ -78,8 +78,8 @@ GreyDiffusiveRadiationMixedFvPatchField
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
@ -117,10 +117,10 @@ GreyDiffusiveRadiationMixedFvPatchField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const GreyDiffusiveRadiationMixedFvPatchField& ptf
|
const greyDiffusiveRadiationMixedFvPatchScalarField& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mixedFvPatchScalarField(ptf),
|
mixedFvPatchScalarField(ptf),
|
||||||
@ -133,10 +133,10 @@ GreyDiffusiveRadiationMixedFvPatchField
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const GreyDiffusiveRadiationMixedFvPatchField& ptf,
|
const greyDiffusiveRadiationMixedFvPatchScalarField& ptf,
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -153,17 +153,18 @@ GreyDiffusiveRadiationMixedFvPatchField
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::autoMap
|
void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::autoMap
|
||||||
(
|
(
|
||||||
const fvPatchFieldMapper& m
|
const fvPatchFieldMapper& m
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalarField::autoMap(m);
|
scalarField::autoMap(m);
|
||||||
|
|
||||||
|
qr_.automap(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::rmap
|
void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::rmap
|
||||||
(
|
(
|
||||||
const fvPatchScalarField& ptf,
|
const fvPatchScalarField& ptf,
|
||||||
const labelList& addr
|
const labelList& addr
|
||||||
@ -171,12 +172,15 @@ void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::rmap
|
|||||||
{
|
{
|
||||||
mixedFvPatchScalarField::rmap(ptf, addr);
|
mixedFvPatchScalarField::rmap(ptf, addr);
|
||||||
|
|
||||||
// const GreyDiffusiveRadiationMixedFvPatchField& mrptf =
|
const greyDiffusiveRadiationMixedFvPatchScalarField& gdrpsf =
|
||||||
refCast<const GreyDiffusiveRadiationMixedFvPatchField>(ptf);
|
refCast<const greyDiffusiveRadiationMixedFvPatchScalarField>(ptf);
|
||||||
|
|
||||||
|
qr_.rmap(gdrpsf.qr_, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::updateCoeffs()
|
void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
|
updateCoeffs()
|
||||||
{
|
{
|
||||||
if (this->updated())
|
if (this->updated())
|
||||||
{
|
{
|
||||||
@ -187,28 +191,31 @@ void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::updateCoeffs()
|
|||||||
patch().lookupPatchField<volScalarField, scalar>(TName_);
|
patch().lookupPatchField<volScalarField, scalar>(TName_);
|
||||||
|
|
||||||
const radiationModel& rad =
|
const radiationModel& rad =
|
||||||
db().lookupObject<radiationModel>("radiationProperties");
|
db().lookupObject<radiationModel>("radiationProperties");
|
||||||
|
|
||||||
const fvDOM& Dom(refCast<const fvDOM>(rad));
|
const fvDOM& dom = refCast<const fvDOM>(rad);
|
||||||
|
|
||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
if(Dom.lambdaj() == 1)
|
if (dom.lambdaj() == 1)
|
||||||
{
|
{
|
||||||
if (myRayIsInit_ == -1)
|
if (myRayIsInit_ == -1)
|
||||||
{
|
{
|
||||||
for(label i=0; i < Dom.Ni() ; i++)
|
for (label i=0; i < Dom.Ni() ; i++)
|
||||||
{
|
{
|
||||||
for(label j=0; j < Dom.lambdaj() ; j++)
|
for (label j=0; j < dom.lambdaj() ; j++)
|
||||||
{
|
{
|
||||||
const volScalarField& radiationField =
|
const volScalarField& radiationField =
|
||||||
Dom.RadIntRayiLambdaj(i,j);
|
dom.RadIntRayiLambdaj(i,j);
|
||||||
if (&(radiationField.internalField()) ==
|
if
|
||||||
&dimensionedInternalField())
|
(
|
||||||
|
&(radiationField.internalField())
|
||||||
|
== &dimensionedInternalField()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
myRayIndex_ = i;
|
myRayIndex_ = i;
|
||||||
myWaveLengthIndex_ = j;
|
myWaveLengthIndex_ = j;
|
||||||
myRayIsInit_ = 0.;
|
myRayIsInit_ = 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +227,7 @@ void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::updateCoeffs()
|
|||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::radiation::"
|
"Foam::radiation::"
|
||||||
"GreyDiffusiveRadiationMixedFvPatchField::"
|
"greyDiffusiveRadiationMixedFvPatchScalarField::"
|
||||||
"updateCoeffs"
|
"updateCoeffs"
|
||||||
) << " a grey boundary condition is used with a non-grey"
|
) << " a grey boundary condition is used with a non-grey"
|
||||||
<< "absorption model"
|
<< "absorption model"
|
||||||
@ -229,22 +236,21 @@ void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::updateCoeffs()
|
|||||||
|
|
||||||
vectorField n = patch().Sf()/patch().magSf();
|
vectorField n = patch().Sf()/patch().magSf();
|
||||||
|
|
||||||
scalarField& Iw = *(this);
|
scalarField& Iw = *this;
|
||||||
|
|
||||||
qr_ = Iw *(-n & Dom.RadIntRay(myRayIndex_).Di());
|
qr_ = Iw*(-n & dom.RadIntRay(myRayIndex_).Di());
|
||||||
|
|
||||||
Dom.RadIntRay(myRayIndex_).add(qr_,patchi);
|
dom.RadIntRay(myRayIndex_).add(qr_,patchi);
|
||||||
|
|
||||||
forAll(Iw, faceI)
|
forAll(Iw, faceI)
|
||||||
{
|
{
|
||||||
|
|
||||||
scalar Ir = 0.0;
|
scalar Ir = 0.0;
|
||||||
|
|
||||||
for(label i=0; i < Dom.Ni() ; i++) //
|
for (label i=0; i < dom.Ni(); i++)
|
||||||
{
|
{
|
||||||
const vector& si = Dom.RadIntRay(i).Si();
|
const vector& si = dom.RadIntRay(i).Si();
|
||||||
|
|
||||||
const scalarField& Iface = Dom.RadIntRay(i).Ilambdaj
|
const scalarField& Iface = dom.RadIntRay(i).Ilambdaj
|
||||||
(
|
(
|
||||||
myWaveLengthIndex_
|
myWaveLengthIndex_
|
||||||
).boundaryField()[patch().index()];
|
).boundaryField()[patch().index()];
|
||||||
@ -253,12 +259,12 @@ void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::updateCoeffs()
|
|||||||
|
|
||||||
if (InOut < 0.) // qin into the wall
|
if (InOut < 0.) // qin into the wall
|
||||||
{
|
{
|
||||||
const vector& di = Dom.RadIntRay(i).Di();
|
const vector& di = dom.RadIntRay(i).Di();
|
||||||
Ir += Iface[faceI]*mag(n[faceI] & di);
|
Ir += Iface[faceI]*mag(n[faceI] & di);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector& mySi = Dom.RadIntRay(myRayIndex_).Si();
|
const vector& mySi = dom.RadIntRay(myRayIndex_).Si();
|
||||||
|
|
||||||
scalar InOut = -n[faceI] & mySi;
|
scalar InOut = -n[faceI] & mySi;
|
||||||
|
|
||||||
@ -266,9 +272,12 @@ void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::updateCoeffs()
|
|||||||
{
|
{
|
||||||
refGrad()[faceI] = 0.0;
|
refGrad()[faceI] = 0.0;
|
||||||
valueFraction()[faceI] = 1.0;
|
valueFraction()[faceI] = 1.0;
|
||||||
refValue()[faceI] = ((1. - emissivity_) * Ir +
|
refValue()[faceI] =
|
||||||
emissivity_*radiation::sigmaSB.value()*pow4(Tp[faceI])) /
|
(
|
||||||
Foam::mathematicalConstant::pi;
|
Ir*(1.0 - emissivity_)
|
||||||
|
+ emissivity_*radiation::sigmaSB.value()*pow4(Tp[faceI])
|
||||||
|
)
|
||||||
|
/mathematicalConstant::pi;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (InOut < 0.) //direction into the wall
|
else if (InOut < 0.) //direction into the wall
|
||||||
@ -283,13 +292,14 @@ void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::GreyDiffusiveRadiationMixedFvPatchField::write(Ostream&
|
void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::write
|
||||||
os) const
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
fvPatchScalarField::write(os);
|
fvPatchScalarField::write(os);
|
||||||
os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl;
|
os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
|
os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +313,7 @@ namespace radiation
|
|||||||
makePatchTypeField
|
makePatchTypeField
|
||||||
(
|
(
|
||||||
fvPatchScalarField,
|
fvPatchScalarField,
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,18 +23,18 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::WideBandDiffusiveRadiationMixedFvPatchField
|
Foam::greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Radiation temperature specified
|
Radiation temperature specified
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField.C
|
greyDiffusiveRadiationMixedFvPatchScalarField.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef WideBandDiffusiveRadiationMixedFvPatchField_H
|
#ifndef greyDiffusiveRadiationMixedFvPatchScalarField_H
|
||||||
#define WideBandDiffusiveRadiationMixedFvPatchField_H
|
#define greyDiffusiveRadiationMixedFvPatchScalarField_H
|
||||||
|
|
||||||
#include "mixedFvPatchFields.H"
|
#include "mixedFvPatchFields.H"
|
||||||
|
|
||||||
@ -45,14 +45,13 @@ namespace Foam
|
|||||||
namespace radiation
|
namespace radiation
|
||||||
{
|
{
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class WideBandDiffusiveRadiationMixedFvPatchField Declaration
|
Class greyDiffusiveRadiationMixedFvPatchScalarField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class WideBandDiffusiveRadiationMixedFvPatchField
|
class greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
:
|
:
|
||||||
public mixedFvPatchScalarField
|
public mixedFvPatchScalarField
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of temperature field
|
//- Name of temperature field
|
||||||
@ -67,49 +66,50 @@ class WideBandDiffusiveRadiationMixedFvPatchField
|
|||||||
//- Direction index
|
//- Direction index
|
||||||
label myWaveLengthIndex_;
|
label myWaveLengthIndex_;
|
||||||
|
|
||||||
//- Init ray flag
|
//- Initialise ray flag
|
||||||
label myRayIsInit_;
|
label myRayIsInit_;
|
||||||
|
|
||||||
//- Radiative heat flux on walls.
|
//- Radiative heat flux on walls
|
||||||
scalarField qr_;
|
scalarField qr_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("WideBandDiffusiveRadiation");
|
TypeName("greyDiffusiveRadiation");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Construct from patch and internal field
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<scalar, volMesh>&
|
const DimensionedField<scalar, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
//- Construct from patch, internal field and dictionary
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<scalar, volMesh>&,
|
const DimensionedField<scalar, volMesh>&,
|
||||||
const dictionary&
|
const dictionary&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct by mapping given GreyDiffusiveRadiationMixedFvPatchField
|
//- Construct by mapping given a
|
||||||
// onto a new patch
|
// greyDiffusiveRadiationMixedFvPatchScalarField onto a new patch
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const WideBandDiffusiveRadiationMixedFvPatchField&,
|
const greyDiffusiveRadiationMixedFvPatchScalarField&,
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<scalar, volMesh>&,
|
const DimensionedField<scalar, volMesh>&,
|
||||||
const fvPatchFieldMapper&
|
const fvPatchFieldMapper&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const WideBandDiffusiveRadiationMixedFvPatchField&
|
const greyDiffusiveRadiationMixedFvPatchScalarField&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
@ -117,14 +117,14 @@ public:
|
|||||||
{
|
{
|
||||||
return tmp<fvPatchScalarField>
|
return tmp<fvPatchScalarField>
|
||||||
(
|
(
|
||||||
new WideBandDiffusiveRadiationMixedFvPatchField(*this)
|
new greyDiffusiveRadiationMixedFvPatchScalarField(*this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
greyDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const WideBandDiffusiveRadiationMixedFvPatchField&,
|
const greyDiffusiveRadiationMixedFvPatchScalarField&,
|
||||||
const DimensionedField<scalar, volMesh>&
|
const DimensionedField<scalar, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public:
|
|||||||
{
|
{
|
||||||
return tmp<fvPatchScalarField>
|
return tmp<fvPatchScalarField>
|
||||||
(
|
(
|
||||||
new WideBandDiffusiveRadiationMixedFvPatchField(*this, iF)
|
new greyDiffusiveRadiationMixedFvPatchScalarField(*this, iF)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,13 +145,13 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the temperature field name
|
//- Return the temperature field name
|
||||||
const word& TName() const
|
const word& TName() const
|
||||||
{
|
{
|
||||||
return TName_;
|
return TName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return reference to the temperature field name to allow
|
//- Return reference to the temperature field name to allow
|
||||||
// adjustment
|
// adjustment
|
||||||
word& TName()
|
word& TName()
|
||||||
{
|
{
|
||||||
@ -170,14 +170,14 @@ public:
|
|||||||
return emissivity_;
|
return emissivity_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return heat flux on the boundary
|
//- Return heat flux on the boundary
|
||||||
const scalarField& qr() const
|
const scalarField& qr() const
|
||||||
{
|
{
|
||||||
return qr_;
|
return qr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mapping functions
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
//- Map (and resize as needed) from self given a mapping object
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
virtual void autoMap
|
virtual void autoMap
|
||||||
@ -35,11 +35,10 @@ License
|
|||||||
#include "radiationConstants.H"
|
#include "radiationConstants.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
@ -51,7 +50,7 @@ WideBandDiffusiveRadiationMixedFvPatchField
|
|||||||
myRayIndex_(0),
|
myRayIndex_(0),
|
||||||
myWaveLengthIndex_(0),
|
myWaveLengthIndex_(0),
|
||||||
myRayIsInit_(-1),
|
myRayIsInit_(-1),
|
||||||
qr_(0)
|
qr_(p.size(), 0.0)
|
||||||
{
|
{
|
||||||
refValue() = 0.0;
|
refValue() = 0.0;
|
||||||
refGrad() = 0.0;
|
refGrad() = 0.0;
|
||||||
@ -60,10 +59,10 @@ WideBandDiffusiveRadiationMixedFvPatchField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const WideBandDiffusiveRadiationMixedFvPatchField& ptf,
|
const wideBandDiffusiveRadiationMixedFvPatchScalarField& ptf,
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
@ -79,8 +78,8 @@ WideBandDiffusiveRadiationMixedFvPatchField
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch& p,
|
const fvPatch& p,
|
||||||
const DimensionedField<scalar, volMesh>& iF,
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
@ -93,17 +92,16 @@ WideBandDiffusiveRadiationMixedFvPatchField
|
|||||||
myRayIndex_(0),
|
myRayIndex_(0),
|
||||||
myWaveLengthIndex_(0),
|
myWaveLengthIndex_(0),
|
||||||
myRayIsInit_(-1),
|
myRayIsInit_(-1),
|
||||||
qr_(0)
|
qr_(p.size(), 0.0)
|
||||||
{
|
{
|
||||||
const scalarField& Tp =
|
const scalarField& Tp =
|
||||||
patch().lookupPatchField<volScalarField, scalar>(TName_);
|
patch().lookupPatchField<volScalarField, scalar>(TName_);
|
||||||
|
|
||||||
refValue() = emissivity_*4.0*radiation::sigmaSB.value()*pow4(Tp) /
|
refValue() =
|
||||||
Foam::mathematicalConstant::pi;
|
emissivity_*4.0*radiation::sigmaSB.value()*pow4(Tp)
|
||||||
|
/Foam::mathematicalConstant::pi;
|
||||||
refGrad() = 0.0;
|
refGrad() = 0.0;
|
||||||
|
|
||||||
qr_.setSize(p.size());
|
|
||||||
|
|
||||||
if (dict.found("value"))
|
if (dict.found("value"))
|
||||||
{
|
{
|
||||||
fvPatchScalarField::operator=
|
fvPatchScalarField::operator=
|
||||||
@ -118,10 +116,10 @@ WideBandDiffusiveRadiationMixedFvPatchField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const WideBandDiffusiveRadiationMixedFvPatchField& ptf
|
const wideBandDiffusiveRadiationMixedFvPatchScalarField& ptf
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mixedFvPatchScalarField(ptf),
|
mixedFvPatchScalarField(ptf),
|
||||||
@ -134,10 +132,10 @@ WideBandDiffusiveRadiationMixedFvPatchField
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::
|
Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const WideBandDiffusiveRadiationMixedFvPatchField& ptf,
|
const wideBandDiffusiveRadiationMixedFvPatchScalarField& ptf,
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
@ -148,23 +146,23 @@ WideBandDiffusiveRadiationMixedFvPatchField
|
|||||||
myWaveLengthIndex_(ptf.myWaveLengthIndex_),
|
myWaveLengthIndex_(ptf.myWaveLengthIndex_),
|
||||||
myRayIsInit_(ptf.myRayIsInit_),
|
myRayIsInit_(ptf.myRayIsInit_),
|
||||||
qr_(ptf.qr_)
|
qr_(ptf.qr_)
|
||||||
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::autoMap
|
void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::autoMap
|
||||||
(
|
(
|
||||||
const fvPatchFieldMapper& m
|
const fvPatchFieldMapper& m
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalarField::autoMap(m);
|
scalarField::autoMap(m);
|
||||||
|
|
||||||
|
qr_.automap(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::rmap
|
void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::rmap
|
||||||
(
|
(
|
||||||
const fvPatchScalarField& ptf,
|
const fvPatchScalarField& ptf,
|
||||||
const labelList& addr
|
const labelList& addr
|
||||||
@ -172,14 +170,15 @@ void Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::rmap
|
|||||||
{
|
{
|
||||||
mixedFvPatchScalarField::rmap(ptf, addr);
|
mixedFvPatchScalarField::rmap(ptf, addr);
|
||||||
|
|
||||||
// const GreyDiffusiveRadiationMixedFvPatchField& mrptf =
|
const wideBandDiffusiveRadiationMixedFvPatchScalarField& wbdrpsf =
|
||||||
refCast<const WideBandDiffusiveRadiationMixedFvPatchField>(ptf);
|
refCast<const wideBandDiffusiveRadiationMixedFvPatchScalarField>(ptf);
|
||||||
|
|
||||||
|
qr_.rmap(wbdrpsf.qr_, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::
|
||||||
Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::updateCoeffs
|
updateCoeffs()
|
||||||
()
|
|
||||||
{
|
{
|
||||||
if (this->updated())
|
if (this->updated())
|
||||||
{
|
{
|
||||||
@ -187,24 +186,27 @@ Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::updateCoeffs
|
|||||||
}
|
}
|
||||||
|
|
||||||
const radiationModel& rad =
|
const radiationModel& rad =
|
||||||
db().lookupObject<radiationModel>("radiationProperties");
|
db().lookupObject<radiationModel>("radiationProperties");
|
||||||
|
|
||||||
const fvDOM& Dom(refCast<const fvDOM>(rad));
|
const fvDOM& dom(refCast<const fvDOM>(rad));
|
||||||
|
|
||||||
const label patchi = patch().index();
|
const label patchi = patch().index();
|
||||||
|
|
||||||
if(Dom.lambdaj() > 1)
|
if (dom.lambdaj() > 1)
|
||||||
{
|
{
|
||||||
if (myRayIsInit_ == -1)
|
if (myRayIsInit_ == -1)
|
||||||
{
|
{
|
||||||
for(label i=0; i < Dom.Ni() ; i++)
|
for (label i=0; i < dom.Ni() ; i++)
|
||||||
{
|
{
|
||||||
for(label j=0; j < Dom.lambdaj() ; j++)
|
for (label j=0; j < dom.lambdaj() ; j++)
|
||||||
{
|
{
|
||||||
const volScalarField& radiationField =
|
const volScalarField& radiationField =
|
||||||
Dom.RadIntRayiLambdaj(i,j);
|
dom.RadIntRayiLambdaj(i,j);
|
||||||
if (&(radiationField.internalField()) ==
|
if
|
||||||
&dimensionedInternalField())
|
(
|
||||||
|
&(radiationField.internalField())
|
||||||
|
==&dimensionedInternalField()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
myRayIndex_ = i;
|
myRayIndex_ = i;
|
||||||
myWaveLengthIndex_ = j;
|
myWaveLengthIndex_ = j;
|
||||||
@ -220,7 +222,7 @@ Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::updateCoeffs
|
|||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::radiation::"
|
"Foam::radiation::"
|
||||||
"WideBandDiffusiveRadiationMixedFvPatchScalarField::"
|
"wideBandDiffusiveRadiationMixedFvPatchScalarField::"
|
||||||
"updateCoeffs"
|
"updateCoeffs"
|
||||||
) << " a Non-grey boundary condition is used with a grey"
|
) << " a Non-grey boundary condition is used with a grey"
|
||||||
<< "absorption model"
|
<< "absorption model"
|
||||||
@ -229,24 +231,23 @@ Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::updateCoeffs
|
|||||||
|
|
||||||
vectorField n = patch().Sf()/patch().magSf();
|
vectorField n = patch().Sf()/patch().magSf();
|
||||||
|
|
||||||
scalarField& Iw = *(this);
|
scalarField& Iw = *this;
|
||||||
|
|
||||||
qr_ = Iw *(-n & Dom.RadIntRay(myRayIndex_).Di());
|
qr_ = Iw*(-n & dom.RadIntRay(myRayIndex_).Di());
|
||||||
|
|
||||||
Dom.RadIntRay(myRayIndex_).add(qr_,patchi);
|
dom.RadIntRay(myRayIndex_).add(qr_,patchi);
|
||||||
|
|
||||||
const scalarField Eb =
|
const scalarField Eb =
|
||||||
Dom.blackBody().bj(myWaveLengthIndex_).boundaryField()[patchi];
|
dom.blackBody().bj(myWaveLengthIndex_).boundaryField()[patchi];
|
||||||
|
|
||||||
forAll(Iw, faceI)
|
forAll(Iw, faceI)
|
||||||
{
|
{
|
||||||
|
|
||||||
scalar Ir = 0.0;
|
scalar Ir = 0.0;
|
||||||
for(label i=0; i < Dom.Ni() ; i++) //
|
for(label i=0; i < dom.Ni(); i++)
|
||||||
{
|
{
|
||||||
const vector& si = Dom.RadIntRay(i).Si();
|
const vector& si = dom.RadIntRay(i).Si();
|
||||||
|
|
||||||
const scalarField& Iface = Dom.RadIntRay(i).Ilambdaj
|
const scalarField& Iface = dom.RadIntRay(i).Ilambdaj
|
||||||
(
|
(
|
||||||
myWaveLengthIndex_
|
myWaveLengthIndex_
|
||||||
).boundaryField()[patch().index()];
|
).boundaryField()[patch().index()];
|
||||||
@ -255,13 +256,12 @@ Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::updateCoeffs
|
|||||||
|
|
||||||
if (InOut < 0.) // qin into the wall
|
if (InOut < 0.) // qin into the wall
|
||||||
{
|
{
|
||||||
const vector& di = Dom.RadIntRay(i).Di();
|
const vector& di = dom.RadIntRay(i).Di();
|
||||||
Ir = Ir + Iface[faceI]*mag(n[faceI] & di);
|
Ir = Ir + Iface[faceI]*mag(n[faceI] & di);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const vector& mySi = dom.RadIntRay(myRayIndex_).Si();
|
||||||
const vector& mySi = Dom.RadIntRay(myRayIndex_).Si();
|
|
||||||
|
|
||||||
scalar InOut = -n[faceI] & mySi;
|
scalar InOut = -n[faceI] & mySi;
|
||||||
|
|
||||||
@ -269,8 +269,12 @@ Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::updateCoeffs
|
|||||||
{
|
{
|
||||||
refGrad()[faceI] = 0.0;
|
refGrad()[faceI] = 0.0;
|
||||||
valueFraction()[faceI] = 1.0;
|
valueFraction()[faceI] = 1.0;
|
||||||
refValue()[faceI] = ((1. - emissivity_) * Ir +
|
refValue()[faceI] =
|
||||||
emissivity_* Eb[faceI]) / Foam::mathematicalConstant::pi;
|
(
|
||||||
|
Ir*(1.0 - emissivity_)
|
||||||
|
+ emissivity_* Eb[faceI]
|
||||||
|
)
|
||||||
|
/mathematicalConstant::pi;
|
||||||
}
|
}
|
||||||
else if (InOut < 0.) //direction into the wall
|
else if (InOut < 0.) //direction into the wall
|
||||||
{
|
{
|
||||||
@ -284,7 +288,7 @@ Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::updateCoeffs
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::WideBandDiffusiveRadiationMixedFvPatchField::write
|
void Foam::radiation::wideBandDiffusiveRadiationMixedFvPatchScalarField::write
|
||||||
(
|
(
|
||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
@ -305,7 +309,7 @@ namespace radiation
|
|||||||
makePatchTypeField
|
makePatchTypeField
|
||||||
(
|
(
|
||||||
fvPatchScalarField,
|
fvPatchScalarField,
|
||||||
WideBandDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,18 +23,18 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::GreyDiffusiveRadiationMixedFvPatchField
|
Foam::wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Radiation temperature specified
|
Radiation temperature specified
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
GreyDiffusiveRadiationMixedFvPatchField.C
|
wideBandDiffusiveRadiationMixedFvPatchScalarField.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef GreyDiffusiveRadiationMixedFvPatchField_H
|
#ifndef wideBandDiffusiveRadiationMixedFvPatchScalarField_H
|
||||||
#define GreyDiffusiveRadiationMixedFvPatchField_H
|
#define wideBandDiffusiveRadiationMixedFvPatchScalarField_H
|
||||||
|
|
||||||
#include "mixedFvPatchFields.H"
|
#include "mixedFvPatchFields.H"
|
||||||
|
|
||||||
@ -45,14 +45,13 @@ namespace Foam
|
|||||||
namespace radiation
|
namespace radiation
|
||||||
{
|
{
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class GreyDiffusiveRadiationMixedFvPatchField Declaration
|
Class wideBandDiffusiveRadiationMixedFvPatchScalarField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class GreyDiffusiveRadiationMixedFvPatchField
|
class wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
:
|
:
|
||||||
public mixedFvPatchScalarField
|
public mixedFvPatchScalarField
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of temperature field
|
//- Name of temperature field
|
||||||
@ -73,23 +72,24 @@ class GreyDiffusiveRadiationMixedFvPatchField
|
|||||||
//- Radiative heat flux on walls.
|
//- Radiative heat flux on walls.
|
||||||
scalarField qr_;
|
scalarField qr_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("GreyDiffusiveRadiation");
|
TypeName("wideBandDiffusiveRadiation");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from patch and internal field
|
//- Construct from patch and internal field
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<scalar, volMesh>&
|
const DimensionedField<scalar, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from patch, internal field and dictionary
|
//- Construct from patch, internal field and dictionary
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<scalar, volMesh>&,
|
const DimensionedField<scalar, volMesh>&,
|
||||||
@ -98,18 +98,18 @@ public:
|
|||||||
|
|
||||||
//- Construct by mapping given GreyDiffusiveRadiationMixedFvPatchField
|
//- Construct by mapping given GreyDiffusiveRadiationMixedFvPatchField
|
||||||
// onto a new patch
|
// onto a new patch
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const GreyDiffusiveRadiationMixedFvPatchField&,
|
const wideBandDiffusiveRadiationMixedFvPatchScalarField&,
|
||||||
const fvPatch&,
|
const fvPatch&,
|
||||||
const DimensionedField<scalar, volMesh>&,
|
const DimensionedField<scalar, volMesh>&,
|
||||||
const fvPatchFieldMapper&
|
const fvPatchFieldMapper&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct as copy
|
//- Construct as copy
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const GreyDiffusiveRadiationMixedFvPatchField&
|
const wideBandDiffusiveRadiationMixedFvPatchScalarField&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
@ -117,14 +117,14 @@ public:
|
|||||||
{
|
{
|
||||||
return tmp<fvPatchScalarField>
|
return tmp<fvPatchScalarField>
|
||||||
(
|
(
|
||||||
new GreyDiffusiveRadiationMixedFvPatchField(*this)
|
new wideBandDiffusiveRadiationMixedFvPatchScalarField(*this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Construct as copy setting internal field reference
|
//- Construct as copy setting internal field reference
|
||||||
GreyDiffusiveRadiationMixedFvPatchField
|
wideBandDiffusiveRadiationMixedFvPatchScalarField
|
||||||
(
|
(
|
||||||
const GreyDiffusiveRadiationMixedFvPatchField&,
|
const wideBandDiffusiveRadiationMixedFvPatchScalarField&,
|
||||||
const DimensionedField<scalar, volMesh>&
|
const DimensionedField<scalar, volMesh>&
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ public:
|
|||||||
{
|
{
|
||||||
return tmp<fvPatchScalarField>
|
return tmp<fvPatchScalarField>
|
||||||
(
|
(
|
||||||
new GreyDiffusiveRadiationMixedFvPatchField(*this, iF)
|
new wideBandDiffusiveRadiationMixedFvPatchScalarField(*this, iF)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,13 +145,13 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the temperature field name
|
//- Return the temperature field name
|
||||||
const word& TName() const
|
const word& TName() const
|
||||||
{
|
{
|
||||||
return TName_;
|
return TName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return reference to the temperature field name to allow
|
//- Return reference to the temperature field name to allow
|
||||||
// adjustment
|
// adjustment
|
||||||
word& TName()
|
word& TName()
|
||||||
{
|
{
|
||||||
@ -170,14 +170,14 @@ public:
|
|||||||
return emissivity_;
|
return emissivity_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return heat flux on the boundary
|
//- Return heat flux on the boundary
|
||||||
const scalarField& qr() const
|
const scalarField& qr() const
|
||||||
{
|
{
|
||||||
return qr_;
|
return qr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mapping functions
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
//- Map (and resize as needed) from self given a mapping object
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
virtual void autoMap
|
virtual void autoMap
|
||||||
@ -101,8 +101,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~P1();
|
||||||
~P1();
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|||||||
@ -27,14 +27,8 @@ License
|
|||||||
#include "absorptionCoeffs.H"
|
#include "absorptionCoeffs.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::radiation::absorptionCoeffs::~absorptionCoeffs()
|
|
||||||
{}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
Foam::radiation::absorptionCoeffs::absorptionCoeffs(Istream& is)
|
Foam::radiation::absorptionCoeffs::absorptionCoeffs(Istream& is)
|
||||||
:
|
:
|
||||||
Tcommon_(readScalar(is)),
|
Tcommon_(readScalar(is)),
|
||||||
@ -42,38 +36,36 @@ Foam::radiation::absorptionCoeffs::absorptionCoeffs(Istream& is)
|
|||||||
Thigh_(readScalar(is)),
|
Thigh_(readScalar(is)),
|
||||||
invTemp_(readBool(is))
|
invTemp_(readBool(is))
|
||||||
{
|
{
|
||||||
for
|
for (label coefLabel=0; absorptionCoeffs::nCoeffs_; coefLabel++)
|
||||||
(
|
|
||||||
label coefLabel=0;
|
|
||||||
absorptionCoeffs::nCoeffs_;
|
|
||||||
coefLabel++
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
is >> highACoeffs_[coefLabel];
|
is >> highACoeffs_[coefLabel];
|
||||||
}
|
}
|
||||||
|
|
||||||
for
|
for (label coefLabel=0; absorptionCoeffs::nCoeffs_; coefLabel++)
|
||||||
(
|
|
||||||
label coefLabel=0;
|
|
||||||
absorptionCoeffs::nCoeffs_;
|
|
||||||
coefLabel++
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
is >> lowACoeffs_[coefLabel];
|
is >> lowACoeffs_[coefLabel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::radiation::absorptionCoeffs::~absorptionCoeffs()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::radiation::absorptionCoeffs::checkT(const scalar T) const
|
void Foam::radiation::absorptionCoeffs::checkT(const scalar T) const
|
||||||
{
|
{
|
||||||
if (T < Tlow_ || T > Thigh_)
|
if (T < Tlow_ || T > Thigh_)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"absCoeffs::checkT(const scalar T) const"
|
"absorptionCoeffs::checkT(const scalar T) const"
|
||||||
) << "attempt to use absCoeff"
|
) << "attempt to use absCoeff out of temperature range:" << nl
|
||||||
" out of temperature range "
|
<< " " << Tlow_ << " -> " << Thigh_ << "; T = " << T
|
||||||
<< Tlow_ << " -> " << Thigh_ << "; T = " << T
|
<< nl << abort(FatalError);
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +88,7 @@ Foam::radiation::absorptionCoeffs::coeffs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::absorptionCoeffs::init
|
void Foam::radiation::absorptionCoeffs::init
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
@ -109,4 +102,6 @@ void Foam::radiation::absorptionCoeffs::init
|
|||||||
dict.lookup("loTcoeffs") >> lowACoeffs_;
|
dict.lookup("loTcoeffs") >> lowACoeffs_;
|
||||||
dict.lookup("hiTcoeffs") >> highACoeffs_;
|
dict.lookup("hiTcoeffs") >> highACoeffs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -40,6 +40,7 @@ SourceFiles
|
|||||||
#include "List.H"
|
#include "List.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "IOdictionary.H"
|
#include "IOdictionary.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -47,29 +48,33 @@ namespace radiation
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class absorptionCoeffs Declaration
|
Class absorptionCoeffs Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class absorptionCoeffs
|
class absorptionCoeffs
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Public data members
|
||||||
|
|
||||||
static const int nCoeffs_ = 6;
|
static const int nCoeffs_ = 6;
|
||||||
typedef FixedList<scalar, nCoeffs_> coeffArray;
|
typedef FixedList<scalar, nCoeffs_> coeffArray;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
// Temperature limits of applicability of functions
|
// Temperature limits of applicability of functions
|
||||||
scalar Tcommon_;
|
|
||||||
|
|
||||||
scalar Tlow_;
|
scalar Tcommon_;
|
||||||
|
|
||||||
scalar Thigh_;
|
scalar Tlow_;
|
||||||
|
|
||||||
// Polynomio using inverse temperatures
|
scalar Thigh_;
|
||||||
|
|
||||||
|
|
||||||
|
// Polynomial using inverse temperatures
|
||||||
bool invTemp_;
|
bool invTemp_;
|
||||||
|
|
||||||
coeffArray highACoeffs_;
|
coeffArray highACoeffs_;
|
||||||
@ -93,26 +98,28 @@ public:
|
|||||||
absorptionCoeffs()
|
absorptionCoeffs()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
~absorptionCoeffs();
|
||||||
|
|
||||||
~absorptionCoeffs();
|
|
||||||
|
|
||||||
// member functions
|
// Member functions
|
||||||
|
|
||||||
//- Return the coefficients corresponding to the given temperature
|
//- Return the coefficients corresponding to the given temperature
|
||||||
const coeffArray& coeffs(const scalar T) const;
|
const coeffArray& coeffs(const scalar T) const;
|
||||||
|
|
||||||
// Init from a dictionary
|
// Initialise from a dictionary
|
||||||
void init(const dictionary&);
|
void init(const dictionary&);
|
||||||
|
|
||||||
// Init from an Istram
|
// Initialise from an Istream
|
||||||
inline void init(Istream&)
|
inline void init(Istream&)
|
||||||
{
|
{
|
||||||
absorptionCoeffs(Istream);
|
absorptionCoeffs(Istream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Acces Functions
|
// Acces Functions
|
||||||
|
|
||||||
inline bool invTemp() const
|
inline bool invTemp() const
|
||||||
{
|
{
|
||||||
return invTemp_;
|
return invTemp_;
|
||||||
@ -142,12 +149,15 @@ public:
|
|||||||
{
|
{
|
||||||
return lowACoeffs_;
|
return lowACoeffs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace Foam
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
} // End namespace radiation
|
} // End namespace radiation
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -24,7 +24,6 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#include "blackBodyEmission.H"
|
#include "blackBodyEmission.H"
|
||||||
#include "dimensionedConstants.H"
|
#include "dimensionedConstants.H"
|
||||||
|
|
||||||
@ -37,14 +36,15 @@ Foam::radiation::blackBodyEmission::blackBodyEmission
|
|||||||
label lambdaj,
|
label lambdaj,
|
||||||
const volScalarField& T
|
const volScalarField& T
|
||||||
)
|
)
|
||||||
:blackBodyEmissiveTable_(fn, instance, T.mesh()),
|
:
|
||||||
C1_("C1",dimensionSet(1,4,3,0,0,0,0),3.7419e-16),
|
blackBodyEmissiveTable_(fn, instance, T.mesh()),
|
||||||
C2_("C2",dimensionSet(0,1,0,1,0,0,0),14.388e-6),
|
C1_("C1",dimensionSet(1, 4, 3, 0, 0, 0, 0), 3.7419e-16),
|
||||||
bj_(0),
|
C2_("C2",dimensionSet(0, 1, 0, 1, 0, 0, 0), 14.388e-6),
|
||||||
T_(T)
|
bj_(0),
|
||||||
|
T_(T)
|
||||||
{
|
{
|
||||||
bj_.setSize(lambdaj);
|
bj_.setSize(lambdaj);
|
||||||
for(label i=0; i < lambdaj; i++)
|
for (label i=0; i < lambdaj; i++)
|
||||||
{
|
{
|
||||||
bj_.set
|
bj_.set
|
||||||
(
|
(
|
||||||
@ -66,21 +66,24 @@ T_(T)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * Destructor * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::radiation::blackBodyEmission::~blackBodyEmission()
|
Foam::radiation::blackBodyEmission::~blackBodyEmission()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::scalar Foam::radiation::blackBodyEmission::flambdaT
|
Foam::scalar Foam::radiation::blackBodyEmission::flambdaT
|
||||||
(
|
(
|
||||||
const scalar lambdaT
|
const scalar lambdaT
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return blackBodyEmissiveTable_.LookUp(lambdaT*1e6)[1];
|
return blackBodyEmissiveTable_.LookUp(lambdaT*1.0e6)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::blackBodyEmission::EbDeltaLambdaT
|
Foam::radiation::blackBodyEmission::EbDeltaLambdaT
|
||||||
(
|
(
|
||||||
@ -125,7 +128,6 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT
|
|||||||
}
|
}
|
||||||
return Eb;
|
return Eb;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,5 +141,4 @@ void Foam::radiation::blackBodyEmission::correct
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -33,6 +33,7 @@ SourceFiles
|
|||||||
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef blackModyEmission_H
|
#ifndef blackModyEmission_H
|
||||||
#define blackModyEmission_H
|
#define blackModyEmission_H
|
||||||
|
|
||||||
@ -42,6 +43,7 @@ SourceFiles
|
|||||||
#include "radiationConstants.H"
|
#include "radiationConstants.H"
|
||||||
#include "interpolationLookUpTable.H"
|
#include "interpolationLookUpTable.H"
|
||||||
#include "Vector2D.H"
|
#include "Vector2D.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -54,71 +56,82 @@ namespace radiation
|
|||||||
class blackBodyEmission
|
class blackBodyEmission
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
mutable interpolationLookUpTable<scalar> blackBodyEmissiveTable_;
|
|
||||||
|
|
||||||
scalar flambdaT(const scalar lambdaT) const;
|
mutable interpolationLookUpTable<scalar> blackBodyEmissiveTable_;
|
||||||
|
|
||||||
const dimensionedScalar C1_;
|
scalar flambdaT(const scalar lambdaT) const;
|
||||||
|
|
||||||
const dimensionedScalar C2_;
|
const dimensionedScalar C1_;
|
||||||
|
|
||||||
// Ptr List for enregy black body emission
|
const dimensionedScalar C2_;
|
||||||
PtrList<volScalarField> bj_;
|
|
||||||
|
// Ptr List for enregy black body emission
|
||||||
|
PtrList<volScalarField> bj_;
|
||||||
|
|
||||||
|
// Reference to the temperature field
|
||||||
|
const volScalarField& T_;
|
||||||
|
|
||||||
// T
|
|
||||||
const volScalarField& T_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
blackBodyEmission
|
|
||||||
(
|
//- Construct from components
|
||||||
const fileName& fn,
|
blackBodyEmission
|
||||||
const word& instance,
|
(
|
||||||
label lambdaj,
|
const fileName& fn,
|
||||||
const volScalarField& T
|
const word& instance,
|
||||||
);
|
label lambdaj,
|
||||||
|
const volScalarField& T
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~blackBodyEmission();
|
~blackBodyEmission();
|
||||||
|
|
||||||
|
|
||||||
// - Spectral emission for the black body at T and lambda
|
// Member functions
|
||||||
inline dimensionedScalar EblambdaT
|
|
||||||
(
|
|
||||||
const dimensionedScalar T,
|
|
||||||
const scalar lambda
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return (C1_/(pow5(lambda)*(exp(C2_/(lambda*T))-1)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Integral Energy at T from lambda1 to lambda2
|
// Access
|
||||||
|
|
||||||
|
//- Black body spectrum
|
||||||
|
inline const volScalarField& bj(label i) const
|
||||||
|
{
|
||||||
|
return bj_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Spectral emission for the black body at T and lambda
|
||||||
|
inline dimensionedScalar EblambdaT
|
||||||
|
(
|
||||||
|
const dimensionedScalar T,
|
||||||
|
const scalar lambda
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return (C1_/(pow5(lambda)*(exp(C2_/(lambda*T)) - 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Integral energy at T from lambda1 to lambda2
|
||||||
|
tmp<Foam::volScalarField> EbDeltaLambdaT
|
||||||
|
(
|
||||||
|
const volScalarField& T,
|
||||||
|
const Vector2D<scalar>& band
|
||||||
|
) const;
|
||||||
|
|
||||||
tmp<Foam::volScalarField> EbDeltaLambdaT //dimensionedScalar
|
|
||||||
(
|
|
||||||
const volScalarField& T,
|
|
||||||
const Vector2D<scalar>& band
|
|
||||||
) const;
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
// Update black body emission
|
// Update black body emission
|
||||||
void correct(label j, const Vector2D<scalar>& band);
|
void correct(label j, const Vector2D<scalar>& band);
|
||||||
|
|
||||||
// Acces members
|
|
||||||
|
|
||||||
// Black body spectrum
|
|
||||||
inline const volScalarField& bj(label i) const
|
|
||||||
{
|
|
||||||
return bj_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
}
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
} // End namespace radiation
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -53,9 +53,9 @@ namespace Foam
|
|||||||
// Radiation solver iterator counter
|
// Radiation solver iterator counter
|
||||||
Foam::label Foam::radiation::fvDOM::iterRadId = pTraits<label>::one;
|
Foam::label Foam::radiation::fvDOM::iterRadId = pTraits<label>::one;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from components
|
|
||||||
Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
|
Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
|
||||||
:
|
:
|
||||||
radiationModel(typeName, T),
|
radiationModel(typeName, T),
|
||||||
@ -134,25 +134,30 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
|
|||||||
aj_.setSize(lambdaj_);
|
aj_.setSize(lambdaj_);
|
||||||
if (mesh_.nSolutionD() == 3) //3D
|
if (mesh_.nSolutionD() == 3) //3D
|
||||||
{
|
{
|
||||||
RadIntRay_.setSize(4.* Nphi_* Ntheta_);
|
RadIntRay_.setSize(4.0*Nphi_*Ntheta_);
|
||||||
Ni_ = 4. * Nphi_ * Ntheta_;
|
Ni_ = 4.0*Nphi_*Ntheta_;
|
||||||
scalar deltaPhi = mathematicalConstant::pi / (2. * Nphi_);
|
scalar deltaPhi = mathematicalConstant::pi/(2.0*Nphi_);
|
||||||
scalar deltaTheta = mathematicalConstant::pi / Ntheta_;
|
scalar deltaTheta = mathematicalConstant::pi/Ntheta_;
|
||||||
label i = 0;
|
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.*n - 1.)*deltaTheta/2.;
|
scalar thetai = (2.0*n - 1.0)*deltaTheta/2.0;
|
||||||
scalar phii = (2.*m - 1.)*deltaPhi/2.;
|
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
|
||||||
RadIntRay_.set
|
RadIntRay_.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
new radiativeIntensityRay
|
new radiativeIntensityRay
|
||||||
(
|
(
|
||||||
phii, thetai, deltaPhi,
|
phii,
|
||||||
deltaTheta, lambdaj_, mesh_,
|
thetai,
|
||||||
absorptionEmission_, blackBody_
|
deltaPhi,
|
||||||
|
deltaTheta,
|
||||||
|
lambdaj_,
|
||||||
|
mesh_,
|
||||||
|
absorptionEmission_,
|
||||||
|
blackBody_
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
i++;
|
i++;
|
||||||
@ -163,23 +168,28 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
|
|||||||
{
|
{
|
||||||
if (mesh_.nSolutionD() == 2) //2D (X & Y)
|
if (mesh_.nSolutionD() == 2) //2D (X & Y)
|
||||||
{
|
{
|
||||||
scalar thetai = mathematicalConstant::pi/2.;
|
scalar thetai = mathematicalConstant::pi/2.0;
|
||||||
scalar deltaTheta = mathematicalConstant::pi;
|
scalar deltaTheta = mathematicalConstant::pi;
|
||||||
RadIntRay_.setSize(4.* Nphi_);
|
RadIntRay_.setSize(4.0*Nphi_);
|
||||||
Ni_ = 4. * Nphi_;
|
Ni_ = 4.0*Nphi_;
|
||||||
scalar deltaPhi = mathematicalConstant::pi / (2. * Nphi_);
|
scalar deltaPhi = mathematicalConstant::pi/(2.0*Nphi_);
|
||||||
label i = 0;
|
label i = 0;
|
||||||
for(label m = 1 ; m <= 4*Nphi_ ; m++)
|
for (label m = 1 ; m <= 4*Nphi_ ; m++)
|
||||||
{
|
{
|
||||||
scalar phii = (2.*m - 1.)*deltaPhi/2.;
|
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
|
||||||
RadIntRay_.set
|
RadIntRay_.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
new radiativeIntensityRay
|
new radiativeIntensityRay
|
||||||
(
|
(
|
||||||
phii, thetai, deltaPhi,
|
phii,
|
||||||
deltaTheta, lambdaj_, mesh_,
|
thetai,
|
||||||
absorptionEmission_, blackBody_
|
deltaPhi,
|
||||||
|
deltaTheta,
|
||||||
|
lambdaj_,
|
||||||
|
mesh_,
|
||||||
|
absorptionEmission_,
|
||||||
|
blackBody_
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
i++;
|
i++;
|
||||||
@ -187,23 +197,28 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
|
|||||||
}
|
}
|
||||||
else //1D (X)
|
else //1D (X)
|
||||||
{
|
{
|
||||||
scalar thetai = mathematicalConstant::pi/2.;
|
scalar thetai = mathematicalConstant::pi/2.0;
|
||||||
scalar deltaTheta = mathematicalConstant::pi;
|
scalar deltaTheta = mathematicalConstant::pi;
|
||||||
RadIntRay_.setSize(2);
|
RadIntRay_.setSize(2);
|
||||||
Ni_ = 2.;
|
Ni_ = 2.0;
|
||||||
scalar deltaPhi = mathematicalConstant::pi;
|
scalar deltaPhi = mathematicalConstant::pi;
|
||||||
label i = 0;
|
label i = 0;
|
||||||
for(label m = 1 ; m <= 2 ; m++)
|
for (label m = 1 ; m <= 2 ; m++)
|
||||||
{
|
{
|
||||||
scalar phii = (2*m - 1.)*deltaPhi/2.;
|
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
|
||||||
RadIntRay_.set
|
RadIntRay_.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
new radiativeIntensityRay
|
new radiativeIntensityRay
|
||||||
(
|
(
|
||||||
phii, thetai, deltaPhi,
|
phii,
|
||||||
deltaTheta, lambdaj_, mesh_,
|
thetai,
|
||||||
absorptionEmission_, blackBody_
|
deltaPhi,
|
||||||
|
deltaTheta,
|
||||||
|
lambdaj_,
|
||||||
|
mesh_,
|
||||||
|
absorptionEmission_,
|
||||||
|
blackBody_
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
i++;
|
i++;
|
||||||
@ -213,7 +228,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Construct absorption for wave length
|
// Construct absorption for wave length
|
||||||
for(label i=0; i < lambdaj_; i++)
|
for(label i=0; i < lambdaj_; i++)
|
||||||
{
|
{
|
||||||
volScalarField* volPtr= new volScalarField
|
volScalarField* volPtr= new volScalarField
|
||||||
@ -233,6 +248,8 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::radiation::fvDOM::~fvDOM()
|
Foam::radiation::fvDOM::~fvDOM()
|
||||||
@ -274,8 +291,8 @@ void Foam::radiation::fvDOM::correct()
|
|||||||
label radIter = 0;
|
label radIter = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
radIter ++;
|
radIter ++;
|
||||||
for(label i = 0; i < Ni_; i++) //
|
for (label i = 0; i < Ni_; i++)
|
||||||
{
|
{
|
||||||
maxResidual = 0;
|
maxResidual = 0;
|
||||||
scalar maxBandResidual = RadIntRay_[i].correct(this);
|
scalar maxBandResidual = RadIntRay_[i].correct(this);
|
||||||
@ -284,13 +301,14 @@ void Foam::radiation::fvDOM::correct()
|
|||||||
|
|
||||||
Info << "Radiation solver Iter: " << radIter << endl;
|
Info << "Radiation solver Iter: " << radIter << endl;
|
||||||
|
|
||||||
}while(maxResidual > convergenceCriterion);
|
} while(maxResidual > convergenceCriterion);
|
||||||
|
|
||||||
updateG();
|
updateG();
|
||||||
|
|
||||||
iterRadId = pTraits<label>::one;
|
iterRadId = pTraits<label>::one;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField> Foam::radiation::fvDOM::Rp() const
|
Foam::tmp<Foam::volScalarField> Foam::radiation::fvDOM::Rp() const
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -327,27 +345,29 @@ Foam::radiation::fvDOM::Ru() const
|
|||||||
return a*G - 4.0*E;
|
return a*G - 4.0*E;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::fvDOM::updateBlackBodyEmission()
|
void Foam::radiation::fvDOM::updateBlackBodyEmission()
|
||||||
{
|
{
|
||||||
|
for (label j=0; j < lambdaj_; j++)
|
||||||
for(label j=0; j < lambdaj_; j++)
|
|
||||||
{
|
{
|
||||||
blackBody_.correct(j, absorptionEmission_->bands(j));
|
blackBody_.correct(j, absorptionEmission_->bands(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::fvDOM::updateG()
|
void Foam::radiation::fvDOM::updateG()
|
||||||
{
|
{
|
||||||
|
|
||||||
G_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
G_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
||||||
Qr_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
Qr_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
||||||
|
|
||||||
for(label i = 0; i < Ni_; i++)
|
for (label i = 0; i < Ni_; i++)
|
||||||
{
|
{
|
||||||
RadIntRay_[i].addIntensity();
|
RadIntRay_[i].addIntensity();
|
||||||
G_ += RadIntRay_[i].I()* RadIntRay_[i].omegai();
|
G_ += RadIntRay_[i].I()* RadIntRay_[i].omegai();
|
||||||
Qr_ += RadIntRay_[i].Qri();
|
Qr_ += RadIntRay_[i].Qri();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -27,25 +27,25 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
|
|
||||||
Finite Volume Discrete Ordinary Method. It solves the RTE equation for n
|
Finite Volume Discrete Ordinary Method. Solves the RTE equation for n
|
||||||
directions in a participating media. It does not consider scatter.
|
directions in a participating media, not including scatter.
|
||||||
|
|
||||||
Available absorption models:
|
Available absorption models:
|
||||||
greyMeanAbsoprtionEmission
|
greyMeanAbsoprtionEmission
|
||||||
wideBandAbsorptionEmission
|
wideBandAbsorptionEmission
|
||||||
|
|
||||||
i.e. dictionary
|
i.e. dictionary
|
||||||
fvDOMCoeffs
|
fvDOMCoeffs
|
||||||
{
|
{
|
||||||
Nphi 1; // azimuthal angles in PI/2 on X-Y.(from Y to X)
|
Nphi 1; // azimuthal angles in PI/2 on X-Y.(from Y to X)
|
||||||
Ntheta 2; // polar angles in P1 (from Z to X-Y plane)
|
Ntheta 2; // polar angles in P1 (from Z to X-Y plane)
|
||||||
convergence 1e-4; //convergence criteria for radiation iteration
|
convergence 1e-4; // convergence criteria for radiation iteration
|
||||||
}
|
}
|
||||||
|
|
||||||
nFlowIterPerRadIter 1; // Number of flow iterations per radiation
|
nFlowIterPerRadIter 1; // Number of flow iterations per radiation
|
||||||
iteration
|
iteration
|
||||||
|
|
||||||
The total number of solid angles is 4 * Nphi * Ntheta.
|
The total number of solid angles is 4*Nphi*Ntheta.
|
||||||
|
|
||||||
In 1D the direction of the rays is X (Nphi and Ntheta are ignored)
|
In 1D the direction of the rays is X (Nphi and Ntheta are ignored)
|
||||||
In 2D the direction of the rays is on X-Y plane (only Nphi is considered)
|
In 2D the direction of the rays is on X-Y plane (only Nphi is considered)
|
||||||
@ -77,7 +77,6 @@ class fvDOM
|
|||||||
:
|
:
|
||||||
public radiationModel
|
public radiationModel
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Incident radiation [W/m2]
|
//- Incident radiation [W/m2]
|
||||||
@ -131,14 +130,16 @@ class fvDOM
|
|||||||
//- Update Black Body Emissiom
|
//- Update Black Body Emissiom
|
||||||
void updateBlackBodyEmission(void);
|
void updateBlackBodyEmission(void);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
static label iterRadId;
|
static label iterRadId;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("fvDOM");
|
TypeName("fvDOM");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -148,103 +149,74 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~fvDOM();
|
||||||
~fvDOM();
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Update radiationSource varible
|
//- Update radiation source variable
|
||||||
void correct();
|
void correct();
|
||||||
|
|
||||||
//- Read radiationProperties dictionary
|
//- Read radiationProperties dictionary
|
||||||
bool read();
|
bool read();
|
||||||
|
|
||||||
//- Update G and calculate total heat flux on boundary
|
//- Update G and calculate total heat flux on boundary
|
||||||
void updateG();
|
void updateG();
|
||||||
|
|
||||||
//- Source term component (for power of T^4)
|
//- Source term component (for power of T^4)
|
||||||
virtual tmp<volScalarField> Rp() const;
|
virtual tmp<volScalarField> Rp() const;
|
||||||
|
|
||||||
|
//- Source term component (constant)
|
||||||
|
virtual tmp<DimensionedField<scalar, volMesh> > Ru() const;
|
||||||
|
|
||||||
//- Source term component (constant)
|
|
||||||
virtual tmp<DimensionedField<scalar, volMesh> > Ru() const;
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Intensity Ray on i direction
|
//- Ray intensity in i direction
|
||||||
inline const radiativeIntensityRay& RadIntRay(label i) const
|
inline const radiativeIntensityRay& RadIntRay(label i) const;
|
||||||
{
|
|
||||||
return RadIntRay_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Intensity Ray on i direction and j band-width
|
//- Ray intensity in i direction and j band-width
|
||||||
inline const volScalarField& RadIntRayiLambdaj
|
inline const volScalarField& RadIntRayiLambdaj
|
||||||
(
|
(
|
||||||
const label i,
|
const label i,
|
||||||
const label j
|
const label j
|
||||||
) const
|
) const;
|
||||||
{
|
|
||||||
return RadIntRay_[i].Ilambdaj(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-Number of angles in theta
|
//- Number of angles in theta
|
||||||
label Ntheta() const
|
inline label Ntheta() const;
|
||||||
{
|
|
||||||
return Ntheta_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Number of angles in phi
|
//- Number of angles in phi
|
||||||
label Nphi() const
|
inline label Nphi() const;
|
||||||
{
|
|
||||||
return Nphi_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Number of directions
|
//- Number of directions
|
||||||
label Ni() const
|
inline label Ni() const;
|
||||||
{
|
|
||||||
return Ni_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Number of wavelengths
|
//- Number of wavelengths
|
||||||
inline const label& lambdaj() const
|
inline label lambdaj() const;
|
||||||
{
|
|
||||||
return lambdaj_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Const access to a
|
// Const access to a
|
||||||
inline const volScalarField& a() const
|
inline const volScalarField& a() const;
|
||||||
{
|
|
||||||
return a_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Const access to aj
|
// Const access to aj
|
||||||
inline const volScalarField& aj(label i) const
|
inline const volScalarField& aj(label i) const;
|
||||||
{
|
|
||||||
return aj_[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Const access to G
|
// Const access to G
|
||||||
inline const volScalarField& G() const
|
inline const volScalarField& G() const;
|
||||||
{
|
|
||||||
return G_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Const access to Qr
|
// Const access to Qr
|
||||||
inline const volScalarField& Qr() const
|
inline const volScalarField& Qr() const;
|
||||||
{
|
|
||||||
return Qr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Const access to blavkBody
|
// Const access to blackBody
|
||||||
virtual const blackBodyEmission& blackBody() const
|
virtual const blackBodyEmission& blackBody() const;
|
||||||
{
|
|
||||||
return blackBody_;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "fvDOMI.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace radiation
|
} // End namespace radiation
|
||||||
|
|||||||
@ -0,0 +1,102 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
inline const Foam::radiation::radiativeIntensityRay&
|
||||||
|
Foam::radiation::fvDOM::RadIntRay(label i) const
|
||||||
|
{
|
||||||
|
return RadIntRay_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::fvDOM::RadIntRayiLambdaj
|
||||||
|
(
|
||||||
|
const label i,
|
||||||
|
const label j
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return RadIntRay_[i].Ilambdaj(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::radiation::fvDOM::Ntheta() const
|
||||||
|
{
|
||||||
|
return Ntheta_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::radiation::fvDOM::Nphi() const
|
||||||
|
{
|
||||||
|
return Nphi_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::radiation::fvDOM::Ni() const
|
||||||
|
{
|
||||||
|
return Ni_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::radiation::fvDOM::lambdaj() const
|
||||||
|
{
|
||||||
|
return lambdaj_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::fvDOM::a() const
|
||||||
|
{
|
||||||
|
return a_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::fvDOM::aj
|
||||||
|
(
|
||||||
|
const label i
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return aj_[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::fvDOM::G() const
|
||||||
|
{
|
||||||
|
return G_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::volScalarField& Foam::radiation::fvDOM::Qr() const
|
||||||
|
{
|
||||||
|
return Qr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual const Foam::radiation::blackBodyEmission&
|
||||||
|
Foam::radiation::fvDOM::blackBody() const
|
||||||
|
{
|
||||||
|
return blackBody_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -26,65 +26,65 @@ License
|
|||||||
|
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
template <class Type>
|
template <class Type>
|
||||||
Foam::label Foam::interpolationLookUpTable <Type>::index
|
Foam::label Foam::interpolationLookUpTable <Type>::index
|
||||||
(
|
(
|
||||||
const List<scalar>& indices,
|
const List<scalar>& indices,
|
||||||
const bool lastDim
|
const bool lastDim
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label totalindex = 0;
|
label totalindex = 0;
|
||||||
|
|
||||||
for(int i = 0;i < dim_.size()-1;i++)
|
for (int i = 0; i < dim_.size() - 1; i++)
|
||||||
{
|
{
|
||||||
label dim = 1;
|
label dim = 1;
|
||||||
for(int j = i + 1 ;j < dim_.size() ; j++)
|
for (int j = i + 1; j < dim_.size(); j++)
|
||||||
{
|
{
|
||||||
dim *=(dim_[j]+1);
|
dim *=(dim_[j]+1);
|
||||||
}
|
}
|
||||||
totalindex += Foam::min
|
|
||||||
(
|
totalindex +=
|
||||||
Foam::max(label((indices[i]-min_[i])/delta_[i]),0),
|
dim
|
||||||
dim_[i]
|
*min
|
||||||
)*dim;
|
(
|
||||||
|
max(label((indices[i] - min_[i])/delta_[i]), 0),
|
||||||
|
dim_[i]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lastDim)
|
if (lastDim)
|
||||||
{
|
{
|
||||||
|
label iLastdim = dim_.size() - 1;
|
||||||
|
totalindex += Foam::min
|
||||||
label iLastdim = dim_.size() -1;
|
(
|
||||||
totalindex += Foam::min
|
max
|
||||||
(
|
(
|
||||||
Foam::max
|
label((indices[iLastdim] - min_[iLastdim])/delta_[iLastdim]),
|
||||||
(
|
0
|
||||||
label((indices[iLastdim]-min_[iLastdim])/delta_[iLastdim]),
|
),
|
||||||
0
|
dim_[iLastdim]
|
||||||
),
|
);
|
||||||
dim_[iLastdim]
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalindex;
|
return totalindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class Type>
|
template <class Type>
|
||||||
Foam::label Foam::interpolationLookUpTable <Type>::index
|
Foam::label Foam::interpolationLookUpTable <Type>::index
|
||||||
(
|
(
|
||||||
const scalar indice
|
const scalar indice
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
|
||||||
label i = 0;
|
label i = 0;
|
||||||
label totalindex =
|
label totalindex =
|
||||||
Foam::min
|
min
|
||||||
(
|
(
|
||||||
Foam::max
|
max
|
||||||
(
|
(
|
||||||
label((indice-min_[i])/delta_[i]),
|
label((indice - min_[i])/delta_[i]),
|
||||||
0
|
0
|
||||||
),
|
),
|
||||||
dim_[i]
|
dim_[i]
|
||||||
@ -93,108 +93,110 @@ Foam::label Foam::interpolationLookUpTable <Type>::index
|
|||||||
return totalindex;
|
return totalindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool Foam::interpolationLookUpTable<Type>::checkRange
|
bool Foam::interpolationLookUpTable<Type>::checkRange
|
||||||
(
|
(
|
||||||
const scalar lookUpValue,
|
const scalar lookUpValue,
|
||||||
const label interfield
|
const label interfield
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if(lookUpValue >= min_[interfield] && lookUpValue <= max_[interfield])
|
if (lookUpValue >= min_[interfield] && lookUpValue <= max_[interfield])
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::scalar Foam::interpolationLookUpTable<Type>::interpolate
|
Foam::scalar Foam::interpolationLookUpTable<Type>::interpolate
|
||||||
(
|
(
|
||||||
const label lo,
|
const label lo,
|
||||||
const label hi,
|
const label hi,
|
||||||
const scalar lookUpValue, //Xi
|
const scalar lookUpValue,
|
||||||
const label ofield, // Yo , Delta Y
|
const label ofield,
|
||||||
const label interfield // Delta X
|
const label interfield
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
if( List<scalarField>::operator[](interfield).operator[](hi)
|
List<scalarField>::operator[](interfield).operator[](hi)
|
||||||
!= List<scalarField>::operator[](interfield).operator[](lo))
|
!= List<scalarField>::operator[](interfield).operator[](lo)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
scalar output
|
||||||
scalar output
|
(
|
||||||
(
|
List<scalarField>::operator[](ofield).operator[](lo)
|
||||||
List<scalarField>::operator[](ofield).operator[](lo)
|
+ (
|
||||||
+ (
|
List<scalarField>::operator[](ofield).operator[](hi)
|
||||||
List<scalarField>::operator[](ofield).operator[](hi)
|
- List<scalarField>::operator[](ofield).operator[](lo)
|
||||||
- List<scalarField>::operator[](ofield).operator[](lo)
|
)
|
||||||
)
|
*(
|
||||||
* (
|
lookUpValue
|
||||||
lookUpValue
|
- List<scalarField>::operator[](interfield).operator[](lo)
|
||||||
- List<scalarField>::operator[](interfield).operator[](lo)
|
)
|
||||||
)
|
/(
|
||||||
/(
|
List<scalarField>::operator[](interfield).operator[](hi)
|
||||||
List<scalarField>::operator[](interfield).operator[](hi)
|
- List<scalarField>::operator[](interfield).operator[](lo)
|
||||||
- List<scalarField>::operator[](interfield).operator[](lo)
|
)
|
||||||
)
|
);
|
||||||
);
|
return output;
|
||||||
return output;
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
return List<scalarField>::operator[](ofield).operator[](lo);
|
||||||
return List<scalarField>::operator[](ofield).operator[](lo);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::interpolationLookUpTable<Type>::dimensionTable()
|
void Foam::interpolationLookUpTable<Type>::dimensionTable()
|
||||||
{
|
{
|
||||||
min_.setSize(entries_.size());
|
min_.setSize(entries_.size());
|
||||||
dim_.setSize(entries_.size());
|
dim_.setSize(entries_.size());
|
||||||
delta_.setSize(entries_.size());
|
delta_.setSize(entries_.size());
|
||||||
max_.setSize(entries_.size());
|
max_.setSize(entries_.size());
|
||||||
entryIndices_.setSize(entries_.size());
|
entryIndices_.setSize(entries_.size());
|
||||||
outputIndices_.setSize(output_.size());
|
outputIndices_.setSize(output_.size());
|
||||||
label index = 0;
|
label index = 0;
|
||||||
label tableDim = 1;
|
label tableDim = 1;
|
||||||
|
|
||||||
forAll(entries_,i)
|
forAll(entries_,i)
|
||||||
{
|
{
|
||||||
dim_[i] = readLabel(entries_[i].lookup("N"));
|
dim_[i] = readLabel(entries_[i].lookup("N"));
|
||||||
max_[i] = readScalar(entries_[i].lookup("max"));
|
max_[i] = readScalar(entries_[i].lookup("max"));
|
||||||
min_[i] = readScalar(entries_[i].lookup("min"));
|
min_[i] = readScalar(entries_[i].lookup("min"));
|
||||||
delta_[i] = (max_[i] - min_[i]) / dim_[i];
|
delta_[i] = (max_[i] - min_[i])/dim_[i];
|
||||||
tableDim *= (dim_[i] + 1);
|
tableDim *= (dim_[i] + 1);
|
||||||
fieldIndices_.insert(entries_[i].lookup("name"),index);
|
fieldIndices_.insert(entries_[i].lookup("name"),index);
|
||||||
entryIndices_[i] = index;
|
entryIndices_[i] = index;
|
||||||
index ++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(output_,i)
|
forAll(output_,i)
|
||||||
{
|
{
|
||||||
fieldIndices_.insert(output_[i].lookup("name"),index);
|
fieldIndices_.insert(output_[i].lookup("name"),index);
|
||||||
outputIndices_[i] = index;
|
outputIndices_[i] = index;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<scalarField >& internal = *this;
|
List<scalarField>& internal = *this;
|
||||||
|
|
||||||
internal.setSize(entries_.size()+output_.size());
|
internal.setSize(entries_.size() + output_.size());
|
||||||
|
|
||||||
interpOutput_.setSize(entries_.size() + output_.size());
|
interpOutput_.setSize(entries_.size() + output_.size());
|
||||||
|
|
||||||
forAll(internal, i)
|
forAll(internal, i)
|
||||||
{
|
{
|
||||||
internal[i].setSize(tableDim);
|
internal[i].setSize(tableDim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::interpolationLookUpTable<Type>::readTable
|
void Foam::interpolationLookUpTable<Type>::readTable
|
||||||
(
|
(
|
||||||
@ -202,12 +204,12 @@ void Foam::interpolationLookUpTable<Type>::readTable
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOdictionary control
|
IOdictionary control
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fileName_, //,
|
fileName_,
|
||||||
instance, //i,
|
instance,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
@ -216,9 +218,9 @@ void Foam::interpolationLookUpTable<Type>::readTable
|
|||||||
|
|
||||||
control.lookup("fields") >> entries_;
|
control.lookup("fields") >> entries_;
|
||||||
control.lookup("output") >> output_;
|
control.lookup("output") >> output_;
|
||||||
control.lookup("values") >> *this;
|
control.lookup("values") >> *this;
|
||||||
|
|
||||||
dimensionTable();
|
dimensionTable();
|
||||||
|
|
||||||
check();
|
check();
|
||||||
|
|
||||||
@ -226,7 +228,7 @@ void Foam::interpolationLookUpTable<Type>::readTable
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::interpolationLookUpTable<Type>::readTable()"
|
"Foam::interpolationLookUpTable<Type>::readTable()"
|
||||||
) << "table is empty" << nl
|
) << "table is empty" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -238,7 +240,7 @@ void Foam::interpolationLookUpTable<Type>::readTable
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable()
|
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable()
|
||||||
:
|
:
|
||||||
List<scalarField >(),
|
List<scalarField >(),
|
||||||
fileName_("fileNameIsUndefined")
|
fileName_("fileNameIsUndefined")
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -246,20 +248,20 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable()
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
|
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
|
||||||
(
|
(
|
||||||
const fileName& fn, const word& instance, const fvMesh& mesh
|
const fileName& fn, const word& instance, const fvMesh& mesh
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
List<scalarField >(),
|
List<scalarField >(),
|
||||||
fileName_(fn),
|
fileName_(fn),
|
||||||
dim_(0),
|
dim_(0),
|
||||||
min_(0),
|
min_(0),
|
||||||
delta_(0.),
|
delta_(0.0),
|
||||||
max_(0.),
|
max_(0.0),
|
||||||
entries_(0),
|
entries_(0),
|
||||||
output_(0),
|
output_(0),
|
||||||
entryIndices_(0),
|
entryIndices_(0),
|
||||||
outputIndices_(0),
|
outputIndices_(0),
|
||||||
interpOutput_(0)
|
interpOutput_(0)
|
||||||
{
|
{
|
||||||
readTable(instance, mesh);
|
readTable(instance, mesh);
|
||||||
}
|
}
|
||||||
@ -271,39 +273,40 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
|
|||||||
const interpolationLookUpTable& interpTable
|
const interpolationLookUpTable& interpTable
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
List<scalarField >(interpTable),
|
List<scalarField >(interpTable),
|
||||||
fileName_(interpTable.fileName_),
|
fileName_(interpTable.fileName_),
|
||||||
entryIndices_(interpTable.entryIndices_),
|
entryIndices_(interpTable.entryIndices_),
|
||||||
outputIndices_(interpTable.outputIndices_),
|
outputIndices_(interpTable.outputIndices_),
|
||||||
dim_(interpTable.dim_),
|
dim_(interpTable.dim_),
|
||||||
min_(interpTable.min_),
|
min_(interpTable.min_),
|
||||||
delta_(interpTable.delta_),
|
delta_(interpTable.delta_),
|
||||||
max_(interpTable.max_),
|
max_(interpTable.max_),
|
||||||
entries_(0),
|
entries_(0),
|
||||||
output_(0),
|
output_(0),
|
||||||
interpOutput_(interpTable.interpOutput_)
|
interpOutput_(interpTable.interpOutput_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
|
Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
List<scalarField >(),
|
List<scalarField >(),
|
||||||
fileName_(fileName(dict.lookup("fileName")).expand()),
|
fileName_(fileName(dict.lookup("fileName")).expand()),
|
||||||
dim_(0),
|
dim_(0),
|
||||||
min_(.0),
|
min_(0.0),
|
||||||
delta_(.0),
|
delta_(0.0),
|
||||||
max_(.0),
|
max_(0.0),
|
||||||
entries_(dict.lookup("fields")),
|
entries_(dict.lookup("fields")),
|
||||||
output_(dict.lookup("output")),
|
output_(dict.lookup("output")),
|
||||||
entryIndices_(0),
|
entryIndices_(0),
|
||||||
outputIndices_(0),
|
outputIndices_(0),
|
||||||
fieldIndices_(0),
|
fieldIndices_(0),
|
||||||
interpOutput_(0)
|
interpOutput_(0)
|
||||||
{
|
{
|
||||||
dimensionTable();
|
dimensionTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -312,27 +315,27 @@ Foam::interpolationLookUpTable<Type>::interpolationLookUpTable
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::interpolationLookUpTable<Type>::check() const
|
void Foam::interpolationLookUpTable<Type>::check() const
|
||||||
{
|
{
|
||||||
|
|
||||||
// check order in the first dimension.
|
// check order in the first dimension.
|
||||||
|
|
||||||
scalar prevValue = List<scalarField >::operator[](0).operator[](0);
|
scalar prevValue = List<scalarField >::operator[](0).operator[](0);
|
||||||
label dim = 1 ;
|
label dim = 1 ;
|
||||||
for(int j = 1 ;j < dim_.size() ; j++)
|
for (int j = 1; j < dim_.size(); j++)
|
||||||
{
|
{
|
||||||
dim *=(dim_[j]+1);
|
dim *=(dim_[j]+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (label i = 1; i < dim_[0]; i++)
|
for (label i = 1; i < dim_[0]; i++)
|
||||||
{
|
{
|
||||||
label index = i*dim;
|
label index = i*dim;
|
||||||
const scalar currValue =
|
const scalar currValue =
|
||||||
List<scalarField >::operator[](0).operator[](index);
|
List<scalarField >::operator[](0).operator[](index);
|
||||||
|
|
||||||
// avoid duplicate values (divide-by-zero error)
|
// avoid duplicate values (divide-by-zero error)
|
||||||
if (currValue <= prevValue)
|
if (currValue <= prevValue)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::interpolationLookUpTable<Type>::checkOrder() const"
|
"Foam::interpolationLookUpTable<Type>::checkOrder() const"
|
||||||
) << "out-of-order value: "
|
) << "out-of-order value: "
|
||||||
<< currValue << " at index " << index << nl
|
<< currValue << " at index " << index << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -341,6 +344,7 @@ void Foam::interpolationLookUpTable<Type>::check() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::interpolationLookUpTable<Type>::write
|
void Foam::interpolationLookUpTable<Type>::write
|
||||||
(
|
(
|
||||||
@ -354,21 +358,21 @@ void Foam::interpolationLookUpTable<Type>::write
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fn, //,
|
fn,
|
||||||
instance, //i,
|
instance,
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
control.writeHeader(os) ;
|
control.writeHeader(os);
|
||||||
|
|
||||||
os.writeKeyword("fields");
|
os.writeKeyword("fields");
|
||||||
os << entries_ << token::END_STATEMENT << nl;
|
os << entries_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
os.writeKeyword("output");
|
os.writeKeyword("output");
|
||||||
os << output_ << token::END_STATEMENT << nl;
|
os << output_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (this->size() == 0)
|
if (this->size() == 0)
|
||||||
{
|
{
|
||||||
@ -378,7 +382,7 @@ void Foam::interpolationLookUpTable<Type>::write
|
|||||||
) << "table is empty" << nl
|
) << "table is empty" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
os.writeKeyword("values");
|
os.writeKeyword("values");
|
||||||
os << *this << token::END_STATEMENT << nl;
|
os << *this << token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,10 +391,7 @@ void Foam::interpolationLookUpTable<Type>::write
|
|||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::scalarField&
|
Foam::scalarField&
|
||||||
Foam::interpolationLookUpTable<Type>::operator[]
|
Foam::interpolationLookUpTable<Type>::operator[](const label i)
|
||||||
(
|
|
||||||
const label i
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
label ii = i;
|
label ii = i;
|
||||||
label n = this->size();
|
label n = this->size();
|
||||||
@ -399,41 +400,37 @@ Foam::interpolationLookUpTable<Type>::operator[]
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::interpolationLookUpTable<Type>::operator[]"
|
"Foam::interpolationLookUpTable<Type>::operator[]"
|
||||||
"(const label) const"
|
"(const label) const"
|
||||||
) << "table has (" << n << ") columns" << nl
|
) << "table has (" << n << ") columns" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
else if (ii < 0)
|
else if (ii < 0)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::interpolationLookUpTable<Type>::operator[]"
|
"Foam::interpolationLookUpTable<Type>::operator[]"
|
||||||
"(const label) const"
|
"(const label) const"
|
||||||
) << "index (" << ii << ") underflow" << nl
|
) << "index (" << ii << ") underflow" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ii > n)
|
else if (ii > n)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::interpolationLookUpTable<Type>::operator[]"
|
"Foam::interpolationLookUpTable<Type>::operator[]"
|
||||||
"(const label) const"
|
"(const label) const"
|
||||||
) << "index (" << ii << ") overflow" << nl
|
) << "index (" << ii << ") overflow" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return List<scalarField >::operator[](ii);
|
return List<scalarField >::operator[](ii);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::scalarField&
|
const Foam::scalarField&
|
||||||
Foam::interpolationLookUpTable<Type>::operator[]
|
Foam::interpolationLookUpTable<Type>::operator[](const label i) const
|
||||||
(
|
|
||||||
const label i
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
label ii = i;
|
label ii = i;
|
||||||
label n = this->size();
|
label n = this->size();
|
||||||
@ -442,62 +439,45 @@ Foam::interpolationLookUpTable<Type>::operator[]
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::interpolationLookUpTable<Type>::operator[]"
|
"Foam::interpolationLookUpTable<Type>::operator[]"
|
||||||
"(const label) const"
|
"(const label) const"
|
||||||
) << "table has (" << n << ") columns" << nl
|
) << "table has (" << n << ") columns" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
else if (ii < 0)
|
else if (ii < 0)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::interpolationLookUpTable<Type>::operator[]"
|
"Foam::interpolationLookUpTable<Type>::operator[]"
|
||||||
"(const label) const"
|
"(const label) const"
|
||||||
) << "index (" << ii << ") underflow" << nl
|
) << "index (" << ii << ") underflow" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ii > n)
|
else if (ii > n)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"Foam::interpolationLookUpTable<Type>::operator[]"
|
"Foam::interpolationLookUpTable<Type>::operator[]"
|
||||||
"(const label) const"
|
"(const label) const"
|
||||||
) << "index (" << ii << ") overflow" << nl
|
) << "index (" << ii << ") overflow" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return List<scalarField >::operator[](ii);
|
return List<scalarField >::operator[](ii);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool Foam::interpolationLookUpTable<Type>::found
|
bool Foam::interpolationLookUpTable<Type>::found(const word& fieldName) const
|
||||||
(
|
|
||||||
const word& key
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
for
|
return fieldIndices_.found(fieldName);
|
||||||
(
|
|
||||||
HashTable<label>::const_iterator iter = fieldIndices_.begin();
|
|
||||||
iter != fieldIndices_.end();
|
|
||||||
++iter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (fieldIndices_.found(key))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
const Foam::scalarList&
|
const Foam::scalarList&
|
||||||
Foam::interpolationLookUpTable<Type>::LookUp
|
Foam::interpolationLookUpTable<Type>::lookUp(const scalar retvals)
|
||||||
(
|
|
||||||
const scalar retvals
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const label lo = index(retvals);
|
const label lo = index(retvals);
|
||||||
findHi(lo, retvals);
|
findHi(lo, retvals);
|
||||||
@ -512,7 +492,6 @@ void Foam::interpolationLookUpTable<Type>::findHi
|
|||||||
const scalar retvals
|
const scalar retvals
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
forAll(outputIndices_,j)
|
forAll(outputIndices_,j)
|
||||||
{
|
{
|
||||||
scalar tmp = 0;
|
scalar tmp = 0;
|
||||||
@ -525,10 +504,10 @@ void Foam::interpolationLookUpTable<Type>::findHi
|
|||||||
{
|
{
|
||||||
label dim = 1;
|
label dim = 1;
|
||||||
|
|
||||||
label hi = Foam::min(lo + dim,(*this)[0].size()-1);
|
label hi = Foam::min(lo + dim, (*this)[0].size() - 1);
|
||||||
|
|
||||||
tmp +=(interpolate(lo,hi,retvals,ofield,entryIndices_[i])
|
tmp += interpolate(lo, hi, retvals, ofield, entryIndices_[i])
|
||||||
- baseValue);
|
- baseValue;
|
||||||
}
|
}
|
||||||
interpOutput_[entryIndices_[i]] = retvals;
|
interpOutput_[entryIndices_[i]] = retvals;
|
||||||
}
|
}
|
||||||
@ -536,5 +515,7 @@ void Foam::interpolationLookUpTable<Type>::findHi
|
|||||||
tmp += baseValue;
|
tmp += baseValue;
|
||||||
interpOutput_[outputIndices_[j]] = tmp;
|
interpOutput_[outputIndices_[j]] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -29,7 +29,6 @@ Description
|
|||||||
A list of lists. Interpolates based on the first dimension.
|
A list of lists. Interpolates based on the first dimension.
|
||||||
The values must be positive and monotonically increasing in each dimension
|
The values must be positive and monotonically increasing in each dimension
|
||||||
|
|
||||||
|
|
||||||
Note
|
Note
|
||||||
- Accessing an empty list results in an error.
|
- Accessing an empty list results in an error.
|
||||||
- Accessing a list with a single element always returns the same value.
|
- Accessing a list with a single element always returns the same value.
|
||||||
@ -48,6 +47,7 @@ SourceFiles
|
|||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
#include "IOdictionary.H"
|
#include "IOdictionary.H"
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -60,12 +60,8 @@ namespace Foam
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class interpolationLookUpTable
|
class interpolationLookUpTable
|
||||||
:
|
:
|
||||||
public List<scalarField>
|
public List<scalarField>
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
// Public data types
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
@ -73,71 +69,71 @@ private:
|
|||||||
//- File name
|
//- File name
|
||||||
fileName fileName_;
|
fileName fileName_;
|
||||||
|
|
||||||
//- table dimensions
|
//- Table dimensions
|
||||||
List<label> dim_;
|
List<label> dim_;
|
||||||
|
|
||||||
//- min on each dimension
|
//- Min on each dimension
|
||||||
List<scalar> min_;
|
List<scalar> min_;
|
||||||
|
|
||||||
//- deltas on each dimension
|
//- Deltas on each dimension
|
||||||
List<scalar> delta_;
|
List<scalar> delta_;
|
||||||
|
|
||||||
//- maximum on each dimension
|
//- Maximum on each dimension
|
||||||
List<scalar> max_;
|
List<scalar> max_;
|
||||||
|
|
||||||
//- entries dictionaries
|
//- Dictionary entries
|
||||||
List<dictionary> entries_;
|
List<dictionary> entries_;
|
||||||
|
|
||||||
//- output dictionaries
|
//- Output dictionaries
|
||||||
List<dictionary> output_;
|
List<dictionary> output_;
|
||||||
|
|
||||||
//- input Indeces from the Look Up Table
|
//- Input indices from the look up table
|
||||||
List<label> entryIndices_;
|
List<label> entryIndices_;
|
||||||
|
|
||||||
//- output Indeces from the Look Up Table
|
//- Output Indeces from the Look Up Table
|
||||||
List<label> outputIndices_;
|
List<label> outputIndices_;
|
||||||
|
|
||||||
//- field names and indices
|
//- Field names and indices
|
||||||
HashTable<label> fieldIndices_;
|
HashTable<label> fieldIndices_;
|
||||||
|
|
||||||
//- Output List containing input and interpolation values of outputs
|
//- Output list containing input and interpolation values of outputs
|
||||||
List<scalar> interpOutput_;
|
List<scalar> interpOutput_;
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Read the table of data from file
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Read the table of data from file
|
||||||
void readTable(const word& instance, const fvMesh& mesh);
|
void readTable(const word& instance, const fvMesh& mesh);
|
||||||
|
|
||||||
//- Dimension Table from dictionaries input and output
|
//- Dimension table from dictionaries input and output
|
||||||
void dimensionTable();
|
void dimensionTable();
|
||||||
|
|
||||||
// Index table finding using scalarList
|
//- Find table index by scalarList
|
||||||
label index(const List<scalar>&, const bool lastDim=true) const;
|
label index(const List<scalar>&, const bool lastDim=true) const;
|
||||||
|
|
||||||
// Index table finding using scalar
|
//- Find table index by scalar
|
||||||
label index(const scalar) const;
|
label index(const scalar) const;
|
||||||
|
|
||||||
//- check range of lookUpValue
|
//- Check range of lookup value
|
||||||
bool checkRange(const scalar, const label) const;
|
bool checkRange(const scalar, const label) const;
|
||||||
|
|
||||||
//- Interpolate function return an scalar
|
//- Interpolate function return an scalar
|
||||||
scalar interpolate
|
scalar interpolate
|
||||||
(
|
(
|
||||||
const label lo,
|
const label lo,
|
||||||
const label hi,
|
const label hi,
|
||||||
const scalar lookUpValue,
|
const scalar lookUpValue,
|
||||||
const label ofield,
|
const label ofield,
|
||||||
const label interfield
|
const label interfield
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
// Check list is monotonically increasing
|
// Check list is monotonically increasing
|
||||||
void check() const;
|
void check() const;
|
||||||
|
|
||||||
// find hi index, interpolate and populate interpOutput_
|
// find hi index, interpolate and populate interpOutput_
|
||||||
void findHi(const label lo, const scalar retvals);
|
void findHi(const label lo, const scalar retvals);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -156,18 +152,19 @@ public:
|
|||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
interpolationLookUpTable(const dictionary& dict);
|
interpolationLookUpTable(const dictionary& dict);
|
||||||
|
|
||||||
|
//- Construct copy
|
||||||
//- Construct copy
|
|
||||||
interpolationLookUpTable(const interpolationLookUpTable& interpTable);
|
interpolationLookUpTable(const interpolationLookUpTable& interpTable);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
bool found(const word& key) const;
|
//- Return true if the filed exists in the table
|
||||||
|
bool found(const word& fieldName) const;
|
||||||
|
|
||||||
//- Return the output list given a single input scalar
|
//- Return the output list given a single input scalar
|
||||||
const List<scalar>& LookUp(const scalar);
|
const List<scalar>& lookUp(const scalar);
|
||||||
|
|
||||||
//- Write Look Up Table to filename.
|
//- Write Look Up Table to filename.
|
||||||
void write
|
void write
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
@ -177,54 +174,40 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Acces
|
// Access
|
||||||
|
|
||||||
inline label findFieldIndex(const word& field) const
|
//- Return the index of a field by name
|
||||||
{
|
inline label findFieldIndex(const word& fieldName) const;
|
||||||
return fieldIndices_[field];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const List<dictionary>& output() const
|
//- Return const access to the output dictionaries
|
||||||
{
|
inline const List<dictionary>& output() const;
|
||||||
return output_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const List<dictionary>& entries() const
|
//- Return const access tp the dictionary entries
|
||||||
{
|
inline const List<dictionary>& entries() const;
|
||||||
return entries_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const List<scalar>& min() const
|
//- Return const access to the list of min dimensions
|
||||||
{
|
inline const List<scalar>& min() const;
|
||||||
return min_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const List<label>& dim() const
|
//- Return const access to the list of dimensions
|
||||||
{
|
inline const List<label>& dim() const;
|
||||||
return dim_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const List<scalar>& delta() const
|
//- Return const access to the deltas in each dimension
|
||||||
{
|
inline const List<scalar>& delta() const;
|
||||||
return delta_;
|
|
||||||
}
|
//- Return const access to the list of max dimensions
|
||||||
|
inline const List<scalar>& max() const;
|
||||||
|
|
||||||
|
//- Return const access to the table name
|
||||||
|
inline const word tableName() const;
|
||||||
|
|
||||||
inline const List<scalar>& max() const
|
|
||||||
{
|
|
||||||
return max_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const word tableName() const
|
|
||||||
{
|
|
||||||
return fileName_.name();
|
|
||||||
}
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
//- Return an element of constant List<scalar, Type>
|
//- Return an element of constant List<scalar, Type>
|
||||||
const scalarField& operator[](const label) const;
|
const scalarField& operator[](const label) const;
|
||||||
|
|
||||||
//- Return an element of List<scalar, Type>
|
//- Return an element of List<scalar, Type>
|
||||||
scalarField & operator[](const label);
|
scalarField& operator[](const label);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,93 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ 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
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline Foam::label
|
||||||
|
Foam::interpolationLookUpTable<Type>::findFieldIndex
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return fieldIndices_[fieldName];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Foam::List<Foam::dictionary>&
|
||||||
|
Foam::interpolationLookUpTable<Type>::output() const
|
||||||
|
{
|
||||||
|
return output_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Foam::List<Foam::dictionary>&
|
||||||
|
Foam::interpolationLookUpTable<Type>::entries() const
|
||||||
|
{
|
||||||
|
return entries_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Foam::List<Foam::scalar>&
|
||||||
|
Foam::interpolationLookUpTable<Type>::min() const
|
||||||
|
{
|
||||||
|
return min_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Foam::List<Foam::label>&
|
||||||
|
Foam::interpolationLookUpTable<Type>::dim() const
|
||||||
|
{
|
||||||
|
return dim_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Foam::List<Foam::scalar>&
|
||||||
|
Foam::interpolationLookUpTable<Type>::delta() const
|
||||||
|
{
|
||||||
|
return delta_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Foam::List<Foam::scalar>&
|
||||||
|
Foam::interpolationLookUpTable<Type>::max() const
|
||||||
|
{
|
||||||
|
return max_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Foam::word Foam::interpolationLookUpTable<Type>::tableName() const
|
||||||
|
{
|
||||||
|
return fileName_.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -36,10 +36,12 @@ License
|
|||||||
#include "Vector2D.H"
|
#include "Vector2D.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::label Foam::radiation::radiativeIntensityRay::rayId = 0;
|
Foam::label Foam::radiation::radiativeIntensityRay::rayId = 0;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Null constructor
|
|
||||||
Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
|
Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
|
||||||
(
|
(
|
||||||
scalar& phii,
|
scalar& phii,
|
||||||
@ -94,44 +96,49 @@ Foam::radiation::radiativeIntensityRay::~radiativeIntensityRay()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::radiativeIntensityRay::init
|
void Foam::radiation::radiativeIntensityRay::init
|
||||||
(
|
(
|
||||||
scalar phii, scalar thetai, scalar deltaPhi, scalar deltaTheta,
|
const scalar phii,
|
||||||
scalar lambdaj
|
const scalar thetai,
|
||||||
|
const scalar deltaPhi,
|
||||||
|
const scalar deltaTheta,
|
||||||
|
const scalar lambdaj
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
phii_ = phii;
|
||||||
|
thetai_ = thetai;
|
||||||
|
nLambdaj_ = lambdaj;
|
||||||
|
|
||||||
scalar sinTheta = Foam::sin(thetai);
|
scalar sinTheta = Foam::sin(thetai);
|
||||||
scalar cosTheta = Foam::cos(thetai);
|
scalar cosTheta = Foam::cos(thetai);
|
||||||
scalar sinPhi = Foam::sin(phii);
|
scalar sinPhi = Foam::sin(phii);
|
||||||
scalar cosPhi = Foam::cos(phii);
|
scalar cosPhi = Foam::cos(phii);
|
||||||
vector s = vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
|
Si_ = vector(sinTheta*sinPhi, sinTheta*cosPhi, cosTheta);
|
||||||
Si_ = (s);
|
omegai_ = 2.0*Foam::sin(thetai)*Foam::sin(deltaTheta/2.0)*deltaPhi;
|
||||||
thetai_ = thetai;
|
Ilambdaj_.setSize(nLambdaj_);
|
||||||
phii_ = phii;
|
Di_ = vector
|
||||||
omegai_ = 2. * Foam::sin(thetai)*Foam::sin(deltaTheta/2.)*deltaPhi;
|
|
||||||
Nlambdaj_ = (lambdaj);
|
|
||||||
Ilambdaj_.setSize(Nlambdaj_);
|
|
||||||
const vector& d = vector
|
|
||||||
(
|
(
|
||||||
sinPhi * Foam::sin(0.5*deltaPhi) * (deltaTheta - Foam::cos(2.*thetai)
|
sinPhi
|
||||||
* Foam::sin(deltaTheta)) ,
|
*Foam::sin(0.5*deltaPhi)
|
||||||
cosPhi * Foam::sin(0.5*deltaPhi) * (deltaTheta - Foam::cos(2.*thetai)
|
*(deltaTheta - Foam::cos(2.0*thetai)
|
||||||
* Foam::sin(deltaTheta)) ,
|
*Foam::sin(deltaTheta)),
|
||||||
0.5 * deltaPhi * Foam::sin(2.*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)
|
||||||
);
|
);
|
||||||
|
|
||||||
Di_ = (d);
|
|
||||||
|
|
||||||
forAll(Ilambdaj_, i)
|
forAll(Ilambdaj_, i)
|
||||||
{
|
{
|
||||||
IOobject header
|
IOobject header
|
||||||
(
|
(
|
||||||
"Ilambda_" + name(rayId) + "_"+ name(i),
|
"Ilambda_" + name(rayId) + "_" + name(i),
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
);
|
);
|
||||||
|
|
||||||
// check if field exists and can be read
|
// check if field exists and can be read
|
||||||
if (header.headerOk())
|
if (header.headerOk())
|
||||||
{
|
{
|
||||||
@ -188,16 +195,17 @@ void Foam::radiation::radiativeIntensityRay::init
|
|||||||
rayId++;
|
rayId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::radiation::radiativeIntensityRay::correct
|
Foam::scalar Foam::radiation::radiativeIntensityRay::correct
|
||||||
(
|
(
|
||||||
fvDOM* DomPtr
|
fvDOM* DomPtr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Qri_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
Qri_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
|
||||||
|
|
||||||
scalar maxResidual = 0.0;
|
scalar maxResidual = 0.0;
|
||||||
|
|
||||||
for(label i = 0; i < Nlambdaj_; i++)
|
for(label i = 0; i < nLambdaj_; i++)
|
||||||
{
|
{
|
||||||
volScalarField k = DomPtr->aj(i);
|
volScalarField k = DomPtr->aj(i);
|
||||||
|
|
||||||
@ -209,9 +217,10 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct
|
|||||||
|
|
||||||
fvScalarMatrix IiEq
|
fvScalarMatrix IiEq
|
||||||
(
|
(
|
||||||
fvm::div(Ji,Ilambdaj_[i],"div(Ji,Ii_h)")
|
fvm::div(Ji, Ilambdaj_[i], " div(Ji,Ii_h)")
|
||||||
+ fvm::Sp(k*omegai_, Ilambdaj_[i])
|
+ fvm::Sp(k*omegai_, Ilambdaj_[i])
|
||||||
== k*omegai_*Ib + E
|
==
|
||||||
|
k*omegai_*Ib + E
|
||||||
);
|
);
|
||||||
|
|
||||||
IiEq.relax();
|
IiEq.relax();
|
||||||
@ -228,23 +237,26 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct
|
|||||||
return maxResidual;
|
return maxResidual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::radiativeIntensityRay::addIntensity()
|
void Foam::radiation::radiativeIntensityRay::addIntensity()
|
||||||
{
|
{
|
||||||
I_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
|
I_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
|
||||||
|
|
||||||
for(label i = 0; i < Nlambdaj_; i++)
|
for (label i = 0; i < nLambdaj_; i++)
|
||||||
{
|
{
|
||||||
I_ += absEmmModel_.addRadInt(i, Ilambdaj_[i]);
|
I_ += absEmmModel_.addRadInt(i, Ilambdaj_[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::radiativeIntensityRay::add
|
void Foam::radiation::radiativeIntensityRay::add
|
||||||
(
|
(
|
||||||
const scalarField & qr,
|
const scalarField& qr,
|
||||||
label patchI
|
const label patchI
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
Qri_.boundaryField()[patchI] += qr;
|
Qri_.boundaryField()[patchI] += qr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -45,54 +45,54 @@ namespace Foam
|
|||||||
namespace radiation
|
namespace radiation
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class radiativeIntensityRay Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
class fvDOM;
|
class fvDOM;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class radiativeIntensityRay Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class radiativeIntensityRay
|
class radiativeIntensityRay
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- absorptionEmissionModel
|
//- Absorption/emission model
|
||||||
const absorptionEmissionModel& absEmmModel_;
|
const absorptionEmissionModel& absEmmModel_;
|
||||||
|
|
||||||
//- Temperature
|
//- Reference to the mesh
|
||||||
const fvMesh& mesh_;
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
// black Body
|
//- Black body
|
||||||
const blackBodyEmission& blackBody_;
|
const blackBodyEmission& blackBody_;
|
||||||
|
|
||||||
//- Total Radiative Intensity on i direction / [W/m2]
|
//- Total radiative intensity in i direction / [W/m2]
|
||||||
volScalarField I_;
|
volScalarField I_;
|
||||||
|
|
||||||
// - Total radiative heat flux on boundary on i direction
|
//- Total radiative heat flux on boundary in i direction
|
||||||
mutable volScalarField Qri_;
|
mutable volScalarField Qri_;
|
||||||
|
|
||||||
//- Direction i
|
//- Direction i
|
||||||
vector Si_;
|
vector Si_;
|
||||||
|
|
||||||
//- theta angle of direction i
|
//- Theta angle of direction i
|
||||||
scalar thetai_;
|
scalar thetai_;
|
||||||
|
|
||||||
//- phi angle of direction i
|
//- Phi angle of direction i
|
||||||
scalar phii_;
|
scalar phii_;
|
||||||
|
|
||||||
//- solid angle
|
//- Solid angle of direction i
|
||||||
scalar omegai_;
|
scalar omegai_;
|
||||||
|
|
||||||
//- Number of bands on i direction
|
//- Number of bands on i direction
|
||||||
label Nlambdaj_;
|
label nLambdaj_;
|
||||||
|
|
||||||
//- average vector inside the solid angle
|
//- Average vector inside the solid angle
|
||||||
vector Di_;
|
vector Di_;
|
||||||
|
|
||||||
//- List of Pointers to Radiative Intensity wave-length
|
//- List of pointers to radiative intensity wave-length
|
||||||
PtrList<volScalarField> Ilambdaj_;
|
PtrList<volScalarField> Ilambdaj_;
|
||||||
|
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -101,13 +101,14 @@ class radiativeIntensityRay
|
|||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const radiativeIntensityRay&);
|
void operator=(const radiativeIntensityRay&);
|
||||||
|
|
||||||
//- Integrate Intensity on this direction
|
|
||||||
// void IntegrateRadiativeIntensity(const label i);
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static data members
|
// Static data members
|
||||||
|
|
||||||
static label rayId;
|
static label rayId;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Null constructor
|
//- Null constructor
|
||||||
@ -125,80 +126,88 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
~radiativeIntensityRay();
|
||||||
~radiativeIntensityRay();
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
// Update radiative intensity on i direction
|
//- Update radiative intensity on i direction
|
||||||
scalar correct(fvDOM*);
|
scalar correct(fvDOM*);
|
||||||
|
|
||||||
// init the ray on i direction
|
//- Initialise the ray in i direction
|
||||||
void init
|
void init
|
||||||
(
|
(
|
||||||
scalar phii, scalar thetai, scalar deltaPhi,scalar
|
const scalar phii,
|
||||||
deltaTheta, scalar lambda
|
const scalar thetai,
|
||||||
|
const scalar deltaPhi,
|
||||||
|
const scalar deltaTheta,
|
||||||
|
const scalar lambda
|
||||||
);
|
);
|
||||||
|
|
||||||
// add radiative heat flux on walls from the boundary patch
|
//- Add radiative heat flux on walls from the boundary patch
|
||||||
void add(const scalarField&, label) const;
|
void add(const scalarField&, const label) const;
|
||||||
|
|
||||||
// add Radiative intensities from all the bands
|
//- Add Radiative intensities from all the bands
|
||||||
void addIntensity();
|
void addIntensity();
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return Intensity on i direction
|
//- Return intensity in i direction
|
||||||
inline const volScalarField& I() const
|
inline const volScalarField& I() const
|
||||||
{
|
{
|
||||||
return I_;
|
return I_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return heat flux on boundary on i direction
|
//- Return heat flux on boundary in i direction
|
||||||
inline const volScalarField& Qri() const
|
inline const volScalarField& Qri() const
|
||||||
{
|
{
|
||||||
return Qri_;
|
return Qri_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return direction i
|
||||||
inline const vector Si() const
|
inline const vector Si() const
|
||||||
{
|
{
|
||||||
return Si_;
|
return Si_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the average vector inside the solid angle
|
||||||
inline const vector Di() const
|
inline const vector Di() const
|
||||||
{
|
{
|
||||||
return Di_;
|
return Di_;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar lambdaj() const
|
//- Return the number of bands on i direction
|
||||||
|
scalar nLambdaj() const
|
||||||
{
|
{
|
||||||
return Nlambdaj_;
|
return nlambdaj_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the phi angle of direction i
|
||||||
scalar phii() const
|
scalar phii() const
|
||||||
{
|
{
|
||||||
return phii_;
|
return phii_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the theta angle of direction i
|
||||||
scalar thetai() const
|
scalar thetai() const
|
||||||
{
|
{
|
||||||
return thetai_;
|
return thetai_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the solid angle of direction i
|
||||||
scalar omegai() const
|
scalar omegai() const
|
||||||
{
|
{
|
||||||
return omegai_;
|
return omegai_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the list of pointers to radiative intensity wave-length
|
||||||
const volScalarField& Ilambdaj(label i) const
|
const volScalarField& Ilambdaj(const label i) const
|
||||||
{
|
{
|
||||||
return Ilambdaj_[i];
|
return Ilambdaj_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -77,8 +77,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~noRadiation();
|
||||||
~noRadiation();
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|||||||
@ -28,7 +28,6 @@ Namespace
|
|||||||
Description
|
Description
|
||||||
Namespace for radiation modelling
|
Namespace for radiation modelling
|
||||||
|
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::radiation::radiationModel
|
Foam::radiation::radiationModel
|
||||||
|
|
||||||
@ -58,6 +57,7 @@ namespace Foam
|
|||||||
namespace radiation
|
namespace radiation
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
class absorptionEmissionModel;
|
class absorptionEmissionModel;
|
||||||
class scatterModel;
|
class scatterModel;
|
||||||
|
|
||||||
@ -152,8 +152,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~radiationModel();
|
||||||
virtual ~radiationModel();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -216,12 +216,13 @@ Foam::radiation::absorptionEmissionModel::EDisp(label i) const
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Foam::label
|
|
||||||
Foam::radiation::absorptionEmissionModel::nBands() const
|
Foam::label Foam::radiation::absorptionEmissionModel::nBands() const
|
||||||
{
|
{
|
||||||
return pTraits<label>::one;
|
return pTraits<label>::one;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::Vector2D<Foam::scalar>&
|
const Foam::Vector2D<Foam::scalar>&
|
||||||
Foam::radiation::absorptionEmissionModel::bands(label n) const
|
Foam::radiation::absorptionEmissionModel::bands(label n) const
|
||||||
{
|
{
|
||||||
@ -229,11 +230,13 @@ Foam::radiation::absorptionEmissionModel::bands(label n) const
|
|||||||
return Vector2D<scalar>::one;
|
return Vector2D<scalar>::one;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Foam::radiation::absorptionEmissionModel::isGrey(void) const
|
|
||||||
|
bool Foam::radiation::absorptionEmissionModel::isGrey() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::absorptionEmissionModel::addRadInt
|
Foam::radiation::absorptionEmissionModel::addRadInt
|
||||||
(
|
(
|
||||||
@ -244,13 +247,16 @@ Foam::radiation::absorptionEmissionModel::addRadInt
|
|||||||
return Ilambdaj;
|
return Ilambdaj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::radiation::absorptionEmissionModel::correct
|
void Foam::radiation::absorptionEmissionModel::correct
|
||||||
(
|
(
|
||||||
volScalarField& a,
|
volScalarField& a,
|
||||||
PtrList<volScalarField>& aj
|
PtrList<volScalarField>& aj
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
a.internalField() = this->a();
|
a.internalField() = this->a();
|
||||||
aj[0].internalField() = a.internalField();
|
aj[0].internalField() = a.internalField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -105,80 +105,85 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
virtual ~absorptionEmissionModel();
|
||||||
virtual ~absorptionEmissionModel();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Reference to the mesh
|
||||||
|
inline const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return mesh_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Reference to the dictionary
|
||||||
|
inline const dictionary& dict() const
|
||||||
|
{
|
||||||
|
return dict_;
|
||||||
|
}
|
||||||
|
|
||||||
// Absorption coefficient
|
// Absorption coefficient
|
||||||
|
|
||||||
//- Absorption coefficient (net)
|
//- Absorption coefficient (net)
|
||||||
virtual tmp<volScalarField> a(const label i = 0) const;
|
virtual tmp<volScalarField> a(const label bandI = 0) const;
|
||||||
|
|
||||||
//- Absorption coefficient for continuous phase
|
//- Absorption coefficient for continuous phase
|
||||||
virtual tmp<volScalarField> aCont(const label i = 0) const;
|
virtual tmp<volScalarField> aCont(const label bandI = 0) const;
|
||||||
|
|
||||||
//- Absorption coefficient for dispersed phase
|
//- Absorption coefficient for dispersed phase
|
||||||
virtual tmp<volScalarField> aDisp(const label i = 0) const;
|
virtual tmp<volScalarField> aDisp(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Emission coefficient
|
// Emission coefficient
|
||||||
|
|
||||||
//- Emission coefficient (net)
|
//- Emission coefficient (net)
|
||||||
virtual tmp<volScalarField> e(const label i = 0) const;
|
virtual tmp<volScalarField> e(const label bandI = 0) const;
|
||||||
|
|
||||||
//- Return emission coefficient for continuous phase
|
//- Return emission coefficient for continuous phase
|
||||||
virtual tmp<volScalarField> eCont(const label i = 0) const;
|
virtual tmp<volScalarField> eCont(const label bandI = 0) const;
|
||||||
|
|
||||||
//- Return emission coefficient for dispersed phase
|
//- Return emission coefficient for dispersed phase
|
||||||
virtual tmp<volScalarField> eDisp(const label i = 0) const;
|
virtual tmp<volScalarField> eDisp(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Emission contribution
|
// Emission contribution
|
||||||
|
|
||||||
//- Emission contribution (net)
|
//- Emission contribution (net)
|
||||||
virtual tmp<volScalarField> E(const label i = 0) const;
|
virtual tmp<volScalarField> E(const label bandI = 0) const;
|
||||||
|
|
||||||
//- Emission contribution for continuous phase
|
//- Emission contribution for continuous phase
|
||||||
virtual tmp<volScalarField> ECont(const label i = 0) const;
|
virtual tmp<volScalarField> ECont(const label bandI = 0) const;
|
||||||
|
|
||||||
//- Emission contribution for dispersed phase
|
//- Emission contribution for dispersed phase
|
||||||
virtual tmp<volScalarField> EDisp(const label i = 0) const;
|
virtual tmp<volScalarField> EDisp(const label bandI = 0) const;
|
||||||
|
|
||||||
inline const fvMesh& mesh() const
|
|
||||||
{
|
|
||||||
return mesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default for grey absorptionEmission model return 1
|
|
||||||
virtual label nBands() const;
|
|
||||||
|
|
||||||
// Default for grey absorptionEmission model return Vector2D::one
|
|
||||||
virtual const Vector2D<scalar>& bands
|
|
||||||
(
|
|
||||||
label n
|
|
||||||
) const;
|
|
||||||
|
|
||||||
// Is the absorptionEmission grey
|
|
||||||
virtual bool isGrey(void) const;
|
|
||||||
|
|
||||||
|
|
||||||
// Add radiative intensity fir ray i
|
//- Const access to the number of bands - defaults to 1 for grey
|
||||||
virtual tmp<volScalarField> addRadInt
|
// absorption/emission
|
||||||
(
|
virtual label nBands() const;
|
||||||
const label i,
|
|
||||||
const volScalarField& Ilambdaj
|
|
||||||
) const;
|
|
||||||
|
|
||||||
// Correct absorption coefficients
|
//- Const access to the bands - defaults to Vector2D::one for grey
|
||||||
virtual void correct
|
// absorption/emission
|
||||||
(
|
virtual const Vector2D<scalar>& bands(label n) const;
|
||||||
volScalarField& a_,
|
|
||||||
PtrList<volScalarField>& aj_
|
//- Flag for whether the absorption/emission is for a grey gas
|
||||||
) const ;
|
virtual bool isGrey(void) const;
|
||||||
|
|
||||||
|
//- Add radiative intensity fir ray i
|
||||||
|
virtual tmp<volScalarField> addRadInt
|
||||||
|
(
|
||||||
|
const label i,
|
||||||
|
const volScalarField& Ilambdaj
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Correct absorption coefficients
|
||||||
|
virtual void correct
|
||||||
|
(
|
||||||
|
volScalarField& a,
|
||||||
|
PtrList<volScalarField>& aj
|
||||||
|
) const ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,6 @@ class binaryAbsorptionEmission
|
|||||||
:
|
:
|
||||||
public absorptionEmissionModel
|
public absorptionEmissionModel
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Coefficients dictionary
|
//- Coefficients dictionary
|
||||||
@ -83,8 +82,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~binaryAbsorptionEmission();
|
||||||
~binaryAbsorptionEmission();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|||||||
@ -70,7 +70,7 @@ Foam::radiation::constantAbsorptionEmission::~constantAbsorptionEmission()
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::constantAbsorptionEmission::aCont(label i) const
|
Foam::radiation::constantAbsorptionEmission::aCont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> ta
|
tmp<volScalarField> ta
|
||||||
(
|
(
|
||||||
@ -95,7 +95,7 @@ Foam::radiation::constantAbsorptionEmission::aCont(label i) const
|
|||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::constantAbsorptionEmission::eCont(label i) const
|
Foam::radiation::constantAbsorptionEmission::eCont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> te
|
tmp<volScalarField> te
|
||||||
(
|
(
|
||||||
@ -120,7 +120,7 @@ Foam::radiation::constantAbsorptionEmission::eCont(label i) const
|
|||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::constantAbsorptionEmission::ECont(label i) const
|
Foam::radiation::constantAbsorptionEmission::ECont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tE
|
tmp<volScalarField> tE
|
||||||
(
|
(
|
||||||
|
|||||||
@ -54,7 +54,6 @@ class constantAbsorptionEmission
|
|||||||
:
|
:
|
||||||
public absorptionEmissionModel
|
public absorptionEmissionModel
|
||||||
{
|
{
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Absorption model dictionary
|
//- Absorption model dictionary
|
||||||
@ -87,8 +86,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~constantAbsorptionEmission();
|
||||||
~constantAbsorptionEmission();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -98,23 +96,24 @@ public:
|
|||||||
// Absorption coefficient
|
// Absorption coefficient
|
||||||
|
|
||||||
//- Absorption coefficient for continuous phase
|
//- Absorption coefficient for continuous phase
|
||||||
tmp<volScalarField> aCont(const label i = 0) const;
|
tmp<volScalarField> aCont(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Emission coefficient
|
// Emission coefficient
|
||||||
|
|
||||||
//- Emission coefficient for continuous phase
|
//- Emission coefficient for continuous phase
|
||||||
tmp<volScalarField> eCont(const label i = 0) const;
|
tmp<volScalarField> eCont(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Emission contribution
|
// Emission contribution
|
||||||
|
|
||||||
//- Emission contribution for continuous phase
|
//- Emission contribution for continuous phase
|
||||||
tmp<volScalarField> ECont(const label i = 0) const;
|
tmp<volScalarField> ECont(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
inline bool isGrey(void) const
|
inline bool isGrey() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,10 +57,10 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
|
|||||||
coeffsDict_((dict.subDict(typeName + "Coeffs"))),
|
coeffsDict_((dict.subDict(typeName + "Coeffs"))),
|
||||||
speciesNames_(0),
|
speciesNames_(0),
|
||||||
specieIndex_(0),
|
specieIndex_(0),
|
||||||
LookUpTable_
|
lookUpTable_
|
||||||
(
|
(
|
||||||
fileName(coeffsDict_.lookup("LookUpTableFileName")),
|
fileName(coeffsDict_.lookup("lookUpTableFileName")),
|
||||||
"constant",
|
mesh.time().constant(),
|
||||||
mesh
|
mesh
|
||||||
),
|
),
|
||||||
thermo_(mesh.db().lookupObject<basicThermo>("thermophysicalProperties")),
|
thermo_(mesh.db().lookupObject<basicThermo>("thermophysicalProperties")),
|
||||||
@ -69,7 +69,7 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
|
|||||||
{
|
{
|
||||||
Yj_.setSize(nSpecies_);
|
Yj_.setSize(nSpecies_);
|
||||||
label nFunc = 0;
|
label nFunc = 0;
|
||||||
const dictionary& functionDicts = dict.subDict(typeName+"Coeffs");
|
const dictionary& functionDicts = dict.subDict(typeName + "Coeffs");
|
||||||
|
|
||||||
forAllConstIter(dictionary, functionDicts, iter)
|
forAllConstIter(dictionary, functionDicts, iter)
|
||||||
{
|
{
|
||||||
@ -85,36 +85,34 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
|
|||||||
nFunc++;
|
nFunc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that all the species on the dictionary are present in the LookupTable
|
// Check that all the species on the dictionary are present in the
|
||||||
// and save the corresponding indexes of the LookupTable
|
// look-up table and save the corresponding indices of the look-up table
|
||||||
|
|
||||||
label j = 0;
|
label j = 0;
|
||||||
forAllConstIter(HashTable<label>, speciesNames_, iter)
|
forAllConstIter(HashTable<label>, speciesNames_, iter)
|
||||||
{
|
{
|
||||||
if(mesh.db().foundObject<volScalarField>("ft"))
|
if (mesh.db().foundObject<volScalarField>("ft"))
|
||||||
{
|
{
|
||||||
|
if (lookUpTable_.found(iter.key()))
|
||||||
if(LookUpTable_.found(iter.key()))
|
|
||||||
{
|
{
|
||||||
label index = LookUpTable_.findFieldIndex(iter.key());
|
label index = lookUpTable_.findFieldIndex(iter.key());
|
||||||
|
|
||||||
Info << "specie: " << iter.key() << " found on LookUpTable"
|
Info<< "specie: " << iter.key() << " found on look-up table "
|
||||||
<< " with index: " << index << endl;
|
<< " with index: " << index << endl;
|
||||||
|
|
||||||
specieIndex_[iter()] = index;
|
specieIndex_[iter()] = index;
|
||||||
}
|
}
|
||||||
else if(mesh.db().foundObject<volScalarField>(iter.key()))
|
else if (mesh.db().foundObject<volScalarField>(iter.key()))
|
||||||
{
|
{
|
||||||
volScalarField& Y = const_cast<volScalarField&>
|
volScalarField& Y =
|
||||||
(mesh.db().lookupObject<volScalarField>(iter.key()));
|
const_cast<volScalarField&>
|
||||||
Yj_.set
|
(
|
||||||
(
|
mesh.db().lookupObject<volScalarField>(iter.key())
|
||||||
j,
|
);
|
||||||
&Y
|
Yj_.set(j, &Y);
|
||||||
);
|
specieIndex_[iter()] = 0.0;
|
||||||
specieIndex_[iter()] = 0.;
|
|
||||||
j++;
|
j++;
|
||||||
Info << "specie : " << iter.key() << " is being solved"
|
Info << "specie: " << iter.key() << " is being solved "
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -123,10 +121,10 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
|
|||||||
(
|
(
|
||||||
"Foam::radiation::greyMeanAbsorptionEmission(const"
|
"Foam::radiation::greyMeanAbsorptionEmission(const"
|
||||||
"dictionary& dict, const fvMesh& mesh)"
|
"dictionary& dict, const fvMesh& mesh)"
|
||||||
) << "specie : " << iter.key()
|
) << "specie: " << iter.key()
|
||||||
<< " is neither in Look Up Table : "
|
<< " is neither in look-up table: "
|
||||||
<< LookUpTable_.tableName()
|
<< lookUpTable_.tableName()
|
||||||
<< " nor is being solved" <<nl
|
<< " nor is being solved" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +134,7 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
|
|||||||
(
|
(
|
||||||
"Foam::radiation::greyMeanAbsorptionEmission(const"
|
"Foam::radiation::greyMeanAbsorptionEmission(const"
|
||||||
"dictionary& dict, const fvMesh& mesh)"
|
"dictionary& dict, const fvMesh& mesh)"
|
||||||
) << "specie ft is not present " <<nl
|
) << "specie ft is not present " << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -152,12 +150,12 @@ Foam::radiation::greyMeanAbsorptionEmission::~greyMeanAbsorptionEmission()
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::greyMeanAbsorptionEmission::aCont(label iband) const
|
Foam::radiation::greyMeanAbsorptionEmission::aCont(const label bandI) const
|
||||||
{
|
{
|
||||||
const volScalarField& T = thermo_.T();
|
const volScalarField& T = thermo_.T();
|
||||||
const volScalarField& p = thermo_.p();
|
const volScalarField& p = thermo_.p();
|
||||||
const volScalarField& ft =
|
const volScalarField& ft =
|
||||||
this->mesh().db().lookupObject<volScalarField>("ft");
|
this->mesh().db().lookupObject<volScalarField>("ft");
|
||||||
|
|
||||||
label nSpecies = speciesNames_.size();
|
label nSpecies = speciesNames_.size();
|
||||||
|
|
||||||
@ -182,33 +180,38 @@ Foam::radiation::greyMeanAbsorptionEmission::aCont(label iband) const
|
|||||||
|
|
||||||
forAll(a, i)
|
forAll(a, i)
|
||||||
{
|
{
|
||||||
//
|
const List<scalar>& species = lookUpTable_.lookUp(ft[i]);
|
||||||
const List<scalar>& species = LookUpTable_.LookUp(ft[i]);
|
|
||||||
|
|
||||||
for(label n=0; n<nSpecies; n++)
|
for (label n=0; n<nSpecies; n++)
|
||||||
{
|
{
|
||||||
label l = 0;
|
label l = 0;
|
||||||
scalar Yipi = 0;
|
scalar Yipi = 0;
|
||||||
if(specieIndex_[n] != 0)
|
if (specieIndex_[n] != 0)
|
||||||
{
|
{
|
||||||
//moles x pressure [atm]
|
//moles x pressure [atm]
|
||||||
Yipi = species[specieIndex_[n]]*p[i]*9.869231e-6;
|
Yipi = species[specieIndex_[n]]*p[i]*9.869231e-6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Yipi = Yj_[l][i]; // mass fraction
|
// mass fraction
|
||||||
|
Yipi = Yj_[l][i];
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const absorptionCoeffs::coeffArray& b = coeffs_[n].coeffs(T[i]);
|
const absorptionCoeffs::coeffArray& b = coeffs_[n].coeffs(T[i]);
|
||||||
|
|
||||||
scalar Ti = T[i];
|
scalar Ti = T[i];
|
||||||
if (coeffs_[n].invTemp()) //negative Temp exponents
|
// negative temperature exponents
|
||||||
|
if (coeffs_[n].invTemp())
|
||||||
{
|
{
|
||||||
Ti = 1./T[i];
|
Ti = 1./T[i];
|
||||||
}
|
}
|
||||||
a[i]+= Yipi*
|
a[i]+=
|
||||||
(((((b[5]*Ti + b[4])*Ti + b[3])*Ti + b[2])*Ti + b[1])*Ti + b[0]);
|
Yipi
|
||||||
|
*(
|
||||||
|
((((b[5]*Ti + b[4])*Ti + b[3])*Ti + b[2])*Ti + b[1])*Ti
|
||||||
|
+ b[0]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ta;
|
return ta;
|
||||||
@ -216,7 +219,7 @@ Foam::radiation::greyMeanAbsorptionEmission::aCont(label iband) const
|
|||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::greyMeanAbsorptionEmission::eCont(label iband) const
|
Foam::radiation::greyMeanAbsorptionEmission::eCont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> e
|
tmp<volScalarField> e
|
||||||
(
|
(
|
||||||
@ -240,7 +243,7 @@ Foam::radiation::greyMeanAbsorptionEmission::eCont(label iband) const
|
|||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::greyMeanAbsorptionEmission::ECont(label iband) const
|
Foam::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> E
|
tmp<volScalarField> E
|
||||||
(
|
(
|
||||||
@ -262,8 +265,8 @@ Foam::radiation::greyMeanAbsorptionEmission::ECont(label iband) const
|
|||||||
if (mesh().db().foundObject<volScalarField>("hrr"))
|
if (mesh().db().foundObject<volScalarField>("hrr"))
|
||||||
{
|
{
|
||||||
const volScalarField& hrr =
|
const volScalarField& hrr =
|
||||||
mesh().db().lookupObject<volScalarField>("hrr");
|
mesh().db().lookupObject<volScalarField>("hrr");
|
||||||
E().internalField() = EhrrCoeff_ * hrr.internalField();
|
E().internalField() = EhrrCoeff_*hrr.internalField();
|
||||||
}
|
}
|
||||||
|
|
||||||
return E;
|
return E;
|
||||||
|
|||||||
@ -27,37 +27,37 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
greyMeanAbsorptionEmission radiation absorption and emission coefficients
|
greyMeanAbsorptionEmission radiation absorption and emission coefficients
|
||||||
for continuous phase
|
for continuous phase
|
||||||
|
|
||||||
The coefficients for the species in the LookUpTable have to be specified
|
The coefficients for the species in the Look up table have to be specified
|
||||||
for use in moles x P [atm].i.e. (k[i] = species[i]*p*9.869231e-6).
|
for use in moles x P [atm], i.e. (k[i] = species[i]*p*9.869231e-6).
|
||||||
|
|
||||||
The coefficients for CO and soot or any other added are multiplied by the
|
The coefficients for CO and soot or any other added are multiplied by the
|
||||||
respective mass fraction being solved.
|
respective mass fraction being solved
|
||||||
|
|
||||||
All the species in the dictionary need either to be in the Look up Table or
|
All the species in the dictionary need either to be in the look-up table or
|
||||||
being solved. Conversely, all the species solved do not need to be included
|
being solved. Conversely, all the species solved do not need to be included
|
||||||
in the calculation of the absorption coefficient.
|
in the calculation of the absorption coefficient
|
||||||
|
|
||||||
The names of the species in the absorption dictionary must match exactly the
|
The names of the species in the absorption dictionary must match exactly the
|
||||||
name in the Look Up table or the name of the field being solved.
|
name in the look-up table or the name of the field being solved
|
||||||
|
|
||||||
The look Up table ("SpeciesTable") file should be in constant
|
The look-up table ("speciesTable") file should be in constant
|
||||||
|
|
||||||
i.e. dictionary
|
i.e. dictionary
|
||||||
|
|
||||||
LookUpTableFileName "SpeciesTable";
|
LookUpTableFileName "speciesTable";
|
||||||
|
|
||||||
EhrrCoeff 0.0;
|
EhrrCoeff 0.0;
|
||||||
|
|
||||||
CO2
|
CO2
|
||||||
{
|
{
|
||||||
Tcommon 300.; //Common Temp
|
Tcommon 300.; // Common Temp
|
||||||
invTemp true; //Is the polynomio using inverse temperature.
|
invTemp true; // Is the polynomial using inverse temperature?
|
||||||
Tlow 300.; //Low Temp
|
Tlow 300.; // Low Temp
|
||||||
Thigh 2500.; //Hight Temp
|
Thigh 2500.; // High Temp
|
||||||
|
|
||||||
loTcoeffs //coefss for T < Tcommon
|
loTcoeffs // coeffs for T < Tcommon
|
||||||
(
|
(
|
||||||
0 // a0 +
|
0 // a0 +
|
||||||
0 // a1*T +
|
0 // a1*T +
|
||||||
@ -66,7 +66,7 @@ Description
|
|||||||
0 // a4*T^(+/-)4 +
|
0 // a4*T^(+/-)4 +
|
||||||
0 // a5*T^(+/-)5 +
|
0 // a5*T^(+/-)5 +
|
||||||
);
|
);
|
||||||
hiTcoeffs //coefss for T > Tcommon
|
hiTcoeffs // coeffs for T > Tcommon
|
||||||
(
|
(
|
||||||
18.741
|
18.741
|
||||||
-121.31e3
|
-121.31e3
|
||||||
@ -92,8 +92,6 @@ SourceFiles
|
|||||||
#include "absorptionCoeffs.H"
|
#include "absorptionCoeffs.H"
|
||||||
#include "basicThermo.H"
|
#include "basicThermo.H"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -109,9 +107,9 @@ class greyMeanAbsorptionEmission
|
|||||||
:
|
:
|
||||||
public absorptionEmissionModel
|
public absorptionEmissionModel
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Public data
|
||||||
|
|
||||||
// - Maximum number of species considered for absorptivity
|
// - Maximum number of species considered for absorptivity
|
||||||
static const int nSpecies_ = 5;
|
static const int nSpecies_ = 5;
|
||||||
@ -119,21 +117,24 @@ public:
|
|||||||
// Absorption Coefficients
|
// Absorption Coefficients
|
||||||
absorptionCoeffs coeffs_[nSpecies_];
|
absorptionCoeffs coeffs_[nSpecies_];
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
//- Absorption model dictionary
|
//- Absorption model dictionary
|
||||||
dictionary coeffsDict_;
|
dictionary coeffsDict_;
|
||||||
|
|
||||||
// Hash table with species names
|
//- Hash table of species names
|
||||||
HashTable<label> speciesNames_;
|
HashTable<label> speciesNames_;
|
||||||
|
|
||||||
// Indexes of species in the LookUpTable
|
// Indices of species in the look-up table
|
||||||
FixedList<label,nSpecies_> specieIndex_;
|
FixedList<label, nSpecies_> specieIndex_;
|
||||||
|
|
||||||
|
// Look-up table of species related to ft
|
||||||
|
mutable interpolationLookUpTable<scalar> lookUpTable_;
|
||||||
|
|
||||||
// Look Up table of species related to ft
|
// Thermo package
|
||||||
mutable interpolationLookUpTable<scalar> LookUpTable_;
|
|
||||||
|
|
||||||
// Thermo
|
|
||||||
const basicThermo& thermo_;
|
const basicThermo& thermo_;
|
||||||
|
|
||||||
//- Emission constant coefficient
|
//- Emission constant coefficient
|
||||||
@ -145,7 +146,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("greyMeanAbsorptionEmission");
|
TypeName("greyMeanAbsorptionEmission");
|
||||||
|
|
||||||
@ -161,8 +161,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~greyMeanAbsorptionEmission();
|
||||||
~greyMeanAbsorptionEmission();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
@ -172,23 +171,24 @@ public:
|
|||||||
// Absorption coefficient
|
// Absorption coefficient
|
||||||
|
|
||||||
//- Absorption coefficient for continuous phase
|
//- Absorption coefficient for continuous phase
|
||||||
tmp<volScalarField> aCont(const label i = 0) const;
|
tmp<volScalarField> aCont(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Emission coefficient
|
// Emission coefficient
|
||||||
|
|
||||||
//- Emission coefficient for continuous phase
|
//- Emission coefficient for continuous phase
|
||||||
tmp<volScalarField> eCont(const label i = 0) const;
|
tmp<volScalarField> eCont(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Emission contribution
|
// Emission contribution
|
||||||
|
|
||||||
//- Emission contribution for continuous phase
|
//- Emission contribution for continuous phase
|
||||||
tmp<volScalarField> ECont(const label i = 0) const;
|
tmp<volScalarField> ECont(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
inline bool isGrey(void) const
|
inline bool isGrey() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,8 +71,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~noAbsorptionEmission();
|
||||||
~noAbsorptionEmission();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -57,10 +57,10 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
|
|||||||
coeffsDict_((dict.subDict(typeName + "Coeffs"))),
|
coeffsDict_((dict.subDict(typeName + "Coeffs"))),
|
||||||
speciesNames_(0),
|
speciesNames_(0),
|
||||||
specieIndex_(0),
|
specieIndex_(0),
|
||||||
LookUpTable_
|
lookUpTable_
|
||||||
(
|
(
|
||||||
fileName(coeffsDict_.lookup("LookUpTableFileName")),
|
fileName(coeffsDict_.lookup("lookUpTableFileName")),
|
||||||
"constant",
|
mesh.time().constant(),
|
||||||
mesh
|
mesh
|
||||||
),
|
),
|
||||||
thermo_(mesh.db().lookupObject<basicThermo>("thermophysicalProperties")),
|
thermo_(mesh.db().lookupObject<basicThermo>("thermophysicalProperties")),
|
||||||
@ -84,7 +84,7 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
|
|||||||
totalWaveLength_ += (iBands_[nBand][1] - iBands_[nBand][0]);
|
totalWaveLength_ += (iBands_[nBand][1] - iBands_[nBand][0]);
|
||||||
|
|
||||||
label nSpec = 0;
|
label nSpec = 0;
|
||||||
const dictionary& SpecDicts = dict.subDict("species");
|
const dictionary& specDicts = dict.subDict("species");
|
||||||
forAllConstIter(dictionary, SpecDicts, iter)
|
forAllConstIter(dictionary, SpecDicts, iter)
|
||||||
{
|
{
|
||||||
const word& key = iter().keyword();
|
const word& key = iter().keyword();
|
||||||
@ -101,42 +101,37 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
|
|||||||
"Foam::radiation::wideBandAbsorptionEmission(const"
|
"Foam::radiation::wideBandAbsorptionEmission(const"
|
||||||
"dictionary& dict, const fvMesh& mesh)"
|
"dictionary& dict, const fvMesh& mesh)"
|
||||||
) << "specie : " << key << "is not in all the bands"
|
) << "specie : " << key << "is not in all the bands"
|
||||||
<< nl
|
<< nl << exit(FatalError);
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
coeffs_[nSpec][nBand].init(SpecDicts.subDict(key));
|
coeffs_[nSpec][nBand].init(specDicts.subDict(key));
|
||||||
nSpec++;
|
nSpec++;
|
||||||
}
|
}
|
||||||
nBand++;
|
nBand++;
|
||||||
}
|
}
|
||||||
nBands_ = nBand;
|
nBands_ = nBand;
|
||||||
|
|
||||||
/*
|
// Check that all the species on the dictionary are present in the
|
||||||
Check that all the species on the dictionary are present in the
|
// look-up table and save the corresponding indexes of the look-up table
|
||||||
LookupTable and save the corresponding indexes of the LookupTable
|
|
||||||
*/
|
|
||||||
|
|
||||||
label j = 0;
|
label j = 0;
|
||||||
forAllConstIter(HashTable<label>, speciesNames_, iter)
|
forAllConstIter(HashTable<label>, speciesNames_, iter)
|
||||||
{
|
{
|
||||||
|
if (lookUpTable_.found(iter.key()))
|
||||||
if(LookUpTable_.found(iter.key()))
|
|
||||||
{
|
{
|
||||||
label index = LookUpTable_.findFieldIndex(iter.key());
|
label index = lookUpTable_.findFieldIndex(iter.key());
|
||||||
Info << "specie: " << iter.key() << " found in LookUpTable"
|
Info<< "specie: " << iter.key() << " found in look-up table "
|
||||||
<< " with index: " << index << endl;
|
<< " with index: " << index << endl;
|
||||||
specieIndex_[iter()] = index;
|
specieIndex_[iter()] = index;
|
||||||
}
|
}
|
||||||
else if
|
else if (mesh.db().foundObject<volScalarField>(iter.key()))
|
||||||
(mesh.db().foundObject<volScalarField>(iter.key()))
|
|
||||||
{
|
{
|
||||||
volScalarField& Y = const_cast<volScalarField&>
|
volScalarField& Y = const_cast<volScalarField&>
|
||||||
(mesh.db().lookupObject<volScalarField>(iter.key()));
|
(mesh.db().lookupObject<volScalarField>(iter.key()));
|
||||||
|
|
||||||
Yj_.set(j, &Y);
|
Yj_.set(j, &Y);
|
||||||
|
|
||||||
specieIndex_[iter()] = 0.;
|
specieIndex_[iter()] = 0.0;
|
||||||
j++;
|
j++;
|
||||||
Info << "specie : " << iter.key() << " is being solved" << endl;
|
Info << "specie : " << iter.key() << " is being solved" << endl;
|
||||||
}
|
}
|
||||||
@ -146,9 +141,9 @@ LookupTable and save the corresponding indexes of the LookupTable
|
|||||||
(
|
(
|
||||||
"radiation::wideBandAbsorptionEmission(const"
|
"radiation::wideBandAbsorptionEmission(const"
|
||||||
"dictionary& dict, const fvMesh& mesh)"
|
"dictionary& dict, const fvMesh& mesh)"
|
||||||
) << "specie : " << iter.key()
|
) << "specie : " << iter.key()
|
||||||
<< " is neither in Look Up Table : "
|
<< " is neither in look-up table : "
|
||||||
<< LookUpTable_.tableName() <<" nor is being slved"
|
<< lookUpTable_.tableName() << " nor is being solved"
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,15 +156,16 @@ LookupTable and save the corresponding indexes of the LookupTable
|
|||||||
Foam::radiation::wideBandAbsorptionEmission::~wideBandAbsorptionEmission()
|
Foam::radiation::wideBandAbsorptionEmission::~wideBandAbsorptionEmission()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::wideBandAbsorptionEmission::aCont(label iband) const
|
Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandI) const
|
||||||
{
|
{
|
||||||
const volScalarField& T = thermo_.T();
|
const volScalarField& T = thermo_.T();
|
||||||
const volScalarField& p = thermo_.p();
|
const volScalarField& p = thermo_.p();
|
||||||
const volScalarField& ft =
|
const volScalarField& ft =
|
||||||
this->mesh().db().lookupObject<volScalarField>("ft");
|
this->mesh().db().lookupObject<volScalarField>("ft");
|
||||||
|
|
||||||
label nSpecies = speciesNames_.size();
|
label nSpecies = speciesNames_.size();
|
||||||
|
|
||||||
@ -194,35 +190,40 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(label iband) const
|
|||||||
|
|
||||||
forAll(a, i)
|
forAll(a, i)
|
||||||
{
|
{
|
||||||
|
const List<scalar>& species = lookUpTable_.lookUp(ft[i]);
|
||||||
|
|
||||||
const List<scalar>& species = LookUpTable_.LookUp(ft[i]);
|
for (label n=0; n<nSpecies; n++)
|
||||||
|
|
||||||
for(label n=0; n<nSpecies; n++)
|
|
||||||
{
|
{
|
||||||
label l = 0;
|
label l = 0;
|
||||||
scalar Yipi = 0;
|
scalar Yipi = 0;
|
||||||
if(specieIndex_[n] != 0) //moles x pressure [atm]
|
if (specieIndex_[n] != 0)
|
||||||
{
|
{
|
||||||
|
// moles x pressure [atm]
|
||||||
Yipi = species[specieIndex_[n]]*p[i]*9.869231e-6;
|
Yipi = species[specieIndex_[n]]*p[i]*9.869231e-6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Yipi = Yj_[l][i]; // mass fraction from species being solved
|
// mass fraction from species being solved
|
||||||
|
Yipi = Yj_[l][i];
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar Ti = T[i];
|
scalar Ti = T[i];
|
||||||
|
|
||||||
const absorptionCoeffs::coeffArray& b =
|
const absorptionCoeffs::coeffArray& b =
|
||||||
coeffs_[n][iband].coeffs(T[i]);
|
coeffs_[n][bandI].coeffs(T[i]);
|
||||||
|
|
||||||
if (coeffs_[n][iband].invTemp())
|
if (coeffs_[n][bandI].invTemp())
|
||||||
{
|
{
|
||||||
Ti = 1./T[i];
|
Ti = 1./T[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
a[i]+=Yipi*
|
a[i]+=
|
||||||
(((((b[5]*Ti + b[4])*Ti + b[3])*Ti + b[2])*Ti + b[1])*Ti + b[0]);
|
Yipi
|
||||||
|
*(
|
||||||
|
((((b[5]*Ti + b[4])*Ti + b[3])*Ti + b[2])*Ti + b[1])*Ti
|
||||||
|
+ b[0]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +232,7 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(label iband) const
|
|||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::wideBandAbsorptionEmission::eCont(label iband) const
|
Foam::radiation::wideBandAbsorptionEmission::eCont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> e
|
tmp<volScalarField> e
|
||||||
(
|
(
|
||||||
@ -255,7 +256,7 @@ Foam::radiation::wideBandAbsorptionEmission::eCont(label iband) const
|
|||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::radiation::wideBandAbsorptionEmission::ECont(label iband) const
|
Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandI) const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> E
|
tmp<volScalarField> E
|
||||||
(
|
(
|
||||||
@ -277,12 +278,14 @@ Foam::radiation::wideBandAbsorptionEmission::ECont(label iband) const
|
|||||||
if (mesh().db().foundObject<volScalarField>("hrr"))
|
if (mesh().db().foundObject<volScalarField>("hrr"))
|
||||||
{
|
{
|
||||||
const volScalarField& hrr =
|
const volScalarField& hrr =
|
||||||
mesh().db().lookupObject<volScalarField>("hrr");
|
mesh().db().lookupObject<volScalarField>("hrr");
|
||||||
E().internalField() = iEhrrCoeffs_[iband] * hrr.internalField() *
|
E().internalField() =
|
||||||
(iBands_[iband][1] - iBands_[iband][0])/totalWaveLength_;
|
iEhrrCoeffs_[bandI]
|
||||||
|
*hrr.internalField()
|
||||||
|
*(iBands_[bandI][1] - iBands_[bandI][0])
|
||||||
|
/totalWaveLength_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return E;
|
return E;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +296,7 @@ Foam::radiation::wideBandAbsorptionEmission::addRadInt
|
|||||||
const volScalarField& Ilambdaj
|
const volScalarField& Ilambdaj
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return Ilambdaj*(iBands_[i][1] - iBands_[i][0])/totalWaveLength_;
|
return Ilambdaj*(iBands_[i][1] - iBands_[i][0])/totalWaveLength_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -303,16 +306,18 @@ void Foam::radiation::wideBandAbsorptionEmission::correct
|
|||||||
PtrList<volScalarField>& aj
|
PtrList<volScalarField>& aj
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
a = dimensionedScalar("zero",dimless/dimLength, 0.0);
|
a = dimensionedScalar("zero", dimless/dimLength, 0.0);
|
||||||
|
|
||||||
for(label j = 0; j < nBands_; j++)
|
for (label j = 0; j < nBands_; j++)
|
||||||
{
|
{
|
||||||
Info << "Calculating... absorption in band : " << j <<endl;
|
Info << "Calculating absorption in band: " << j <<endl;
|
||||||
aj[j].internalField() = this->a(j);
|
aj[j].internalField() = this->a(j);
|
||||||
Info << "Calculated absorption in band : " << j <<endl;
|
Info << "Calculated absorption in band: " << j <<endl;
|
||||||
a.internalField() += aj[j].internalField() *
|
a.internalField() +=
|
||||||
(iBands_[j][1] - iBands_[j][0])/totalWaveLength_;
|
aj[j].internalField()
|
||||||
}
|
*(iBands_[j][1] - iBands_[j][0])
|
||||||
|
/totalWaveLength_;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -99,13 +99,10 @@ Description
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
wideBandAbsorptionEmission.C
|
wideBandAbsorptionEmission.C
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef wideBandAbsorptionEmission_H
|
#ifndef wideBandAbsorptionEmission_H
|
||||||
#define wideBandAbsorptionEmission_H
|
#define wideBandAbsorptionEmission_H
|
||||||
@ -116,8 +113,6 @@ SourceFiles
|
|||||||
#include "absorptionCoeffs.H"
|
#include "absorptionCoeffs.H"
|
||||||
#include "basicThermo.H"
|
#include "basicThermo.H"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
@ -133,20 +128,24 @@ class wideBandAbsorptionEmission
|
|||||||
:
|
:
|
||||||
public absorptionEmissionModel
|
public absorptionEmissionModel
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Public data
|
||||||
|
|
||||||
// - Maximum number of species considered for absorptivity
|
//- Maximum number of species considered for absorptivity
|
||||||
static const int nSpecies_ = 5;
|
static const int nSpecies_ = 5;
|
||||||
|
|
||||||
// - Maximum number of bands
|
//- Maximum number of bands
|
||||||
static const int maxBands_ = 10;
|
static const int maxBands_ = 10;
|
||||||
|
|
||||||
// Absorption Coefficients
|
//- Absorption coefficients
|
||||||
FixedList< FixedList<absorptionCoeffs, nSpecies_> , maxBands_> coeffs_;
|
FixedList<FixedList<absorptionCoeffs, nSpecies_>, maxBands_> coeffs_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
//- Absorption model dictionary
|
//- Absorption model dictionary
|
||||||
dictionary coeffsDict_;
|
dictionary coeffsDict_;
|
||||||
|
|
||||||
@ -162,10 +161,10 @@ private:
|
|||||||
//- Proportion of the heat released rate emitted
|
//- Proportion of the heat released rate emitted
|
||||||
FixedList<scalar, maxBands_ > iEhrrCoeffs_;
|
FixedList<scalar, maxBands_ > iEhrrCoeffs_;
|
||||||
|
|
||||||
//- Look Up table of species related to ft
|
//- Look-up table of species related to ft
|
||||||
mutable interpolationLookUpTable<scalar> LookUpTable_;
|
mutable interpolationLookUpTable<scalar> lookUpTable_;
|
||||||
|
|
||||||
//- Thermo
|
//- Thermo package
|
||||||
const basicThermo& thermo_;
|
const basicThermo& thermo_;
|
||||||
|
|
||||||
//- Bands
|
//- Bands
|
||||||
@ -174,9 +173,10 @@ private:
|
|||||||
//- Pointer list of species being solved involved in the absorption
|
//- Pointer list of species being solved involved in the absorption
|
||||||
UPtrList<volScalarField> Yj_;
|
UPtrList<volScalarField> Yj_;
|
||||||
|
|
||||||
// Total wave lenght cover by the bands
|
// Total wave length covered by the bands
|
||||||
scalar totalWaveLength_;
|
scalar totalWaveLength_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
@ -195,32 +195,30 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
virtual ~wideBandAbsorptionEmission();
|
||||||
~wideBandAbsorptionEmission();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
// Absorption coefficient
|
// Absorption coefficient
|
||||||
|
|
||||||
//- Absorption coefficient for continuous phase
|
//- Absorption coefficient for continuous phase
|
||||||
tmp<volScalarField> aCont(const label i = 0) const;
|
tmp<volScalarField> aCont(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Emission coefficient
|
// Emission coefficient
|
||||||
|
|
||||||
//- Emission coefficient for continuous phase
|
//- Emission coefficient for continuous phase
|
||||||
tmp<volScalarField> eCont(const label i = 0) const;
|
tmp<volScalarField> eCont(const label bandI = 0) const;
|
||||||
|
|
||||||
|
|
||||||
// Emission contribution
|
// Emission contribution
|
||||||
|
|
||||||
//- Emission contribution for continuous phase
|
//- Emission contribution for continuous phase
|
||||||
tmp<volScalarField> ECont(const label i = 0) const;
|
tmp<volScalarField> ECont(const label bandI = 0) const;
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
inline bool isGrey(void) const
|
inline bool isGrey(void) const
|
||||||
{
|
{
|
||||||
@ -228,7 +226,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Number of bands
|
// Number of bands
|
||||||
label nBands() const
|
inline label nBands() const
|
||||||
{
|
{
|
||||||
return nBands_;
|
return nBands_;
|
||||||
}
|
}
|
||||||
@ -240,7 +238,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add contribution of Ilambdaj to the total Radiative Intensity on
|
// Add contribution of Ilambdaj to the total Radiative Intensity on
|
||||||
//direction i
|
// direction i
|
||||||
tmp<volScalarField> addRadInt
|
tmp<volScalarField> addRadInt
|
||||||
(
|
(
|
||||||
const label i,
|
const label i,
|
||||||
@ -248,7 +246,6 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
void correct(volScalarField& a_, PtrList<volScalarField>& aj) const;
|
void correct(volScalarField& a_, PtrList<volScalarField>& aj) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user