further clean-up

This commit is contained in:
andy
2009-03-23 10:56:21 +00:00
parent 3a76720e14
commit 5838018199
15 changed files with 162 additions and 112 deletions

View File

@ -195,7 +195,7 @@ updateCoeffs()
ray.Qr().boundaryField()[patchI] += Iw*(-n & ray.dAve());
const scalarField Eb =
dom.blackBody().bj(lambdaId_).boundaryField()[patchI];
dom.blackBody().bLambda(lambdaId_).boundaryField()[patchI];
forAll(Iw, faceI)
{

View File

@ -89,15 +89,18 @@ Foam::radiation::absorptionCoeffs::coeffs
}
void Foam::radiation::absorptionCoeffs::init
(
const dictionary& dict
)
void Foam::radiation::absorptionCoeffs::initialise(Istream&)
{
Tcommon_ = readScalar(dict.lookup("Tcommon"));
Tlow_ = readScalar(dict.lookup("Tlow"));
Thigh_ = readScalar(dict.lookup("Thigh"));
invTemp_ = readBool(dict.lookup("invTemp"));
absorptionCoeffs(Istream);
}
void Foam::radiation::absorptionCoeffs::initialise(const dictionary& dict)
{
dict.lookup("Tcommon") >> Tcommon_;
dict.lookup("Tlow") >> Tlow_;
dict.lookup("Tlow") >> Thigh_;
dict.lookup("invTemp") >> invTemp_;
dict.lookup("loTcoeffs") >> lowACoeffs_;
dict.lookup("hiTcoeffs") >> highACoeffs_;

View File

@ -65,7 +65,7 @@ private:
// Private data
// Temperature limits of applicability of functions
// Temperature limits of applicability for functions
scalar Tcommon_;
@ -109,46 +109,25 @@ public:
const coeffArray& coeffs(const scalar T) const;
// Initialise from a dictionary
void init(const dictionary&);
void initialise(const dictionary&);
// Initialise from an Istream
inline void init(Istream&)
{
absorptionCoeffs(Istream);
}
void initialise(Istream&);
// Acces Functions
// Access Functions
inline bool invTemp() const
{
return invTemp_;
}
inline bool invTemp() const;
inline scalar Tcommon() const
{
return Tcommon_;
}
inline scalar Tcommon() const;
inline scalar Tlow() const
{
return Tlow_;
}
inline scalar Tlow() const;
inline scalar Thigh() const
{
return Thigh_;
}
inline scalar Thigh() const;
inline const coeffArray& highACoeffs() const
{
return highACoeffs_;
}
inline const coeffArray& highACoeffs() const;
inline const coeffArray& lowACoeffs() const
{
return lowACoeffs_;
}
inline const coeffArray& lowACoeffs() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -158,6 +137,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "absorptionCoeffsI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 bool Foam::radiation::absorptionCoeffs::invTemp() const
{
return invTemp_;
}
inline Foam::scalar Foam::radiation::absorptionCoeffs::Tcommon() const
{
return Tcommon_;
}
inline Foam::scalar Foam::radiation::absorptionCoeffs::Tlow() const
{
return Tlow_;
}
inline Foam::scalar Foam::radiation::absorptionCoeffs::Thigh() const
{
return Thigh_;
}
inline const Foam::radiation::absorptionCoeffs::coeffArray&
Foam::radiation::absorptionCoeffs::highACoeffs() const
{
return highACoeffs_;
}
inline const Foam::radiation::absorptionCoeffs::coeffArray&
Foam::radiation::absorptionCoeffs::lowACoeffs() const
{
return lowACoeffs_;
}
// ************************************************************************* //

View File

@ -33,26 +33,26 @@ Foam::radiation::blackBodyEmission::blackBodyEmission
(
const fileName& name,
const word& instance,
label nLambda,
const label nLambda,
const volScalarField& T
)
:
blackBodyEmissiveTable_(name, instance, T.mesh()),
C1_("C1",dimensionSet(1, 4, 3, 0, 0, 0, 0), 3.7419e-16),
C2_("C2",dimensionSet(0, 1, 0, 1, 0, 0, 0), 14.388e-6),
bj_(nLambda),
bLambda_(nLambda),
T_(T)
{
forAll(bj_, lambdaI)
forAll(bLambda_, lambdaI)
{
bj_.set
bLambda_.set
(
lambdaI,
new volScalarField
(
IOobject
(
"bj_" + Foam::name(lambdaI) ,
"bLambda_" + Foam::name(lambdaI) ,
T.mesh().time().timeName(),
T.mesh(),
IOobject::NO_READ,
@ -74,7 +74,7 @@ Foam::radiation::blackBodyEmission::~blackBodyEmission()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::radiation::blackBodyEmission::flambdaT
Foam::scalar Foam::radiation::blackBodyEmission::fLambdaT
(
const scalar lambdaT
) const
@ -115,15 +115,15 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT
{
forAll(T, i)
{
scalar T1 = flambdaT(band[1]*T[i]);
scalar T2 = flambdaT(band[0]*T[i]);
dimensionedScalar flambdaDelta
scalar T1 = fLambdaT(band[1]*T[i]);
scalar T2 = fLambdaT(band[0]*T[i]);
dimensionedScalar fLambdaDelta
(
"flambdaDelta",
"fLambdaDelta",
dimless,
T1 - T2
);
Eb()[i] = Eb()[i]*flambdaDelta.value();
Eb()[i] = Eb()[i]*fLambdaDelta.value();
}
return Eb;
}
@ -136,7 +136,7 @@ void Foam::radiation::blackBodyEmission::correct
const Vector2D<scalar>& band
)
{
bj_[lambdaI] = EbDeltaLambdaT(T_, band);
bLambda_[lambdaI] = EbDeltaLambdaT(T_, band);
}

View File

@ -67,7 +67,7 @@ class blackBodyEmission
const dimensionedScalar C2_;
// Ptr List for black body emission energy field for each wavelength
PtrList<volScalarField> bj_;
PtrList<volScalarField> bLambda_;
// Reference to the temperature field
const volScalarField& T_;
@ -75,7 +75,7 @@ class blackBodyEmission
// Private member functions
scalar flambdaT(const scalar lambdaT) const;
scalar fLambdaT(const scalar lambdaT) const;
public:
@ -85,9 +85,9 @@ public:
//- Construct from components
blackBodyEmission
(
const fileName& fn,
const fileName& name,
const word& instance,
label lambdaj,
const label nLambda,
const volScalarField& T
);
@ -101,19 +101,19 @@ public:
// Access
//- Black body spectrum
inline const volScalarField& bj(const label lambdaI) const
inline const volScalarField& bLambda(const label lambdaI) const
{
return bj_[lambdaI];
return bLambda_[lambdaI];
}
//- Spectral emission for the black body at T and lambda
inline dimensionedScalar EblambdaT
(
const dimensionedScalar T,
const dimensionedScalar& T,
const scalar lambda
) const
{
return (C1_/(pow5(lambda)*(exp(C2_/(lambda*T)) - 1)));
return (C1_/(pow5(lambda)*(exp(C2_/(lambda*T)) - 1.0)));
}
//- Integral energy at T from lambda1 to lambda2

View File

@ -125,7 +125,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
nPhi_(readLabel(coeffs_.lookup("nPhi"))),
nRay_(0),
nLambda_(absorptionEmission_->nBands()),
aj_(nLambda_),
aLambda_(nLambda_),
blackBody_
(
fileName("blackBodyEmissivePower"),
@ -139,7 +139,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
if (mesh_.nSolutionD() == 3) //3D
{
IRay_.setSize(4*nPhi_*nTheta_);
nRay_ = 4.0*nPhi_*nTheta_;
nRay_ = 4*nPhi_*nTheta_;
scalar deltaPhi = mathematicalConstant::pi/(2.0*nPhi_);
scalar deltaTheta = mathematicalConstant::pi/nTheta_;
label i = 0;
@ -176,7 +176,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
scalar thetai = mathematicalConstant::pi/2.0;
scalar deltaTheta = mathematicalConstant::pi;
IRay_.setSize(4*nPhi_);
nRay_ = 4.0*nPhi_;
nRay_ = 4*nPhi_;
scalar deltaPhi = mathematicalConstant::pi/(2.0*nPhi_);
label i = 0;
for (label m = 1; m <= 4*nPhi_; m++)
@ -206,7 +206,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
scalar thetai = mathematicalConstant::pi/2.0;
scalar deltaTheta = mathematicalConstant::pi;
IRay_.setSize(2);
nRay_ = 2.0;
nRay_ = 2;
scalar deltaPhi = mathematicalConstant::pi;
label i = 0;
for (label m = 1; m <= 2; m++)
@ -236,16 +236,16 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
// Construct absorption field for each wavelength
forAll(aj_, lambdaI)
forAll(aLambda_, lambdaI)
{
aj_.set
aLambda_.set
(
lambdaI,
new volScalarField
(
IOobject
(
"aj_" + Foam::name(lambdaI) ,
"aLambda_" + Foam::name(lambdaI) ,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
@ -286,7 +286,7 @@ bool Foam::radiation::fvDOM::read()
void Foam::radiation::fvDOM::calculate()
{
absorptionEmission_->correct(a_, aj_);
absorptionEmission_->correct(a_, aLambda_);
updateBlackBodyEmission();
@ -294,7 +294,7 @@ void Foam::radiation::fvDOM::calculate()
label radIter = 0;
do
{
radIter ++;
radIter++;
forAll(IRay_, rayI)
{
maxResidual = 0.0;
@ -302,7 +302,7 @@ void Foam::radiation::fvDOM::calculate()
maxResidual = max(maxBandResidual, maxResidual);
}
Info << "Radiation solver Iter: " << radIter << endl;
Info << "Radiation solver iter: " << radIter << endl;
} while(maxResidual > convergence_);

View File

@ -107,7 +107,7 @@ class fvDOM
label nLambda_;
//- Wavelength total absorption coefficient [1/m]
PtrList<volScalarField> aj_;
PtrList<volScalarField> aLambda_;
//- Black body
blackBodyEmission blackBody_;
@ -198,7 +198,7 @@ public:
inline const volScalarField& a() const;
// Const access to wavelength total absorption coefficient
inline const volScalarField& aj(const label lambdaI) const;
inline const volScalarField& aLambda(const label lambdaI) const;
// Const access to incident radiation field
inline const volScalarField& G() const;

View File

@ -72,12 +72,12 @@ inline const Foam::volScalarField& Foam::radiation::fvDOM::a() const
}
inline const Foam::volScalarField& Foam::radiation::fvDOM::aj
inline const Foam::volScalarField& Foam::radiation::fvDOM::aLambda
(
const label lambdaI
) const
{
return aj_[lambdaI];
return aLambda_[lambdaI];
}

View File

@ -176,7 +176,7 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct()
forAll(ILambda_, lambdaI)
{
const volScalarField& k = dom_.aj(lambdaI);
const volScalarField& k = dom_.aLambda(lambdaI);
surfaceScalarField Ji = dAve_ & mesh_.Sf();
@ -187,7 +187,7 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct()
==
1.0/Foam::mathematicalConstant::pi
*(
k*omega_*blackBody_.bj(lambdaI)
k*omega_*blackBody_.bLambda(lambdaI)
+ absorptionEmission_.ECont(lambdaI)
)
);
@ -214,7 +214,7 @@ void Foam::radiation::radiativeIntensityRay::addIntensity()
forAll(ILambda_, lambdaI)
{
I_ += absorptionEmission_.addRadInt(lambdaI, ILambda_[lambdaI]);
I_ += absorptionEmission_.addIntensity(lambdaI, ILambda_[lambdaI]);
}
}

View File

@ -237,7 +237,7 @@ bool Foam::radiation::absorptionEmissionModel::isGrey() const
Foam::tmp<Foam::volScalarField>
Foam::radiation::absorptionEmissionModel::addRadInt
Foam::radiation::absorptionEmissionModel::addIntensity
(
const label rayI,
const volScalarField& ILambda

View File

@ -172,7 +172,7 @@ public:
virtual bool isGrey() const;
//- Add radiative intensity for ray i
virtual tmp<volScalarField> addRadInt
virtual tmp<volScalarField> addIntensity
(
const label rayI,
const volScalarField& ILambda

View File

@ -65,9 +65,8 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
),
thermo_(mesh.lookupObject<basicThermo>("thermophysicalProperties")),
EhrrCoeff_(readScalar(coeffsDict_.lookup("EhrrCoeff"))),
Yj_(0)
Yj_(nSpecies_)
{
Yj_.setSize(nSpecies_);
label nFunc = 0;
const dictionary& functionDicts = dict.subDict(typeName + "Coeffs");
@ -81,7 +80,7 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
const word& key = iter().keyword();
speciesNames_.insert(key, nFunc);
const dictionary& dict = iter().dict();
coeffs_[nFunc].init(dict);
coeffs_[nFunc].initialise(dict);
nFunc++;
}
@ -112,8 +111,7 @@ Foam::radiation::greyMeanAbsorptionEmission::greyMeanAbsorptionEmission
Yj_.set(j, &Y);
specieIndex_[iter()] = 0;
j++;
Info << "specie: " << iter.key() << " is being solved "
<< endl;
Info<< "specie: " << iter.key() << " is being solved" << endl;
}
else
{
@ -171,7 +169,7 @@ Foam::radiation::greyMeanAbsorptionEmission::aCont(const label bandI) const
IOobject::NO_WRITE
),
mesh(),
dimensionedScalar("a",dimless/dimLength, 0.0)
dimensionedScalar("a", dimless/dimLength, 0.0)
)
);

View File

@ -64,10 +64,9 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
mesh
),
thermo_(mesh.lookupObject<basicThermo>("thermophysicalProperties")),
Yj_(0),
Yj_(nSpecies_),
totalWaveLength_(0)
{
Yj_.setSize(nSpecies_);
label nBand = 0;
const dictionary& functionDicts = dict.subDict(typeName +"Coeffs");
forAllConstIter(dictionary, functionDicts, iter)
@ -100,11 +99,11 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
(
"Foam::radiation::wideBandAbsorptionEmission(const"
"dictionary& dict, const fvMesh& mesh)"
) << "specie : " << key << "is not in all the bands"
) << "specie: " << key << "is not in all the bands"
<< nl << exit(FatalError);
}
}
coeffs_[nSpec][nBand].init(specDicts.subDict(key));
coeffs_[nSpec][nBand].initialise(specDicts.subDict(key));
nSpec++;
}
nBand++;
@ -133,7 +132,7 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
specieIndex_[iter()] = 0.0;
j++;
Info << "specie : " << iter.key() << " is being solved" << endl;
Info<< "species: " << iter.key() << " is being solved" << endl;
}
else
{
@ -141,7 +140,7 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
(
"radiation::wideBandAbsorptionEmission(const"
"dictionary& dict, const fvMesh& mesh)"
) << "specie : " << iter.key()
) << "specie: " << iter.key()
<< " is neither in look-up table : "
<< lookUpTable_.tableName() << " nor is being solved"
<< exit(FatalError);
@ -276,8 +275,7 @@ Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandI) const
if (mesh().foundObject<volScalarField>("hrr"))
{
const volScalarField& hrr =
mesh().lookupObject<volScalarField>("hrr");
const volScalarField& hrr = mesh().lookupObject<volScalarField>("hrr");
E().internalField() =
iEhrrCoeffs_[bandI]
*hrr.internalField()
@ -289,31 +287,31 @@ Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandI) const
}
Foam::tmp<Foam::volScalarField>
Foam::radiation::wideBandAbsorptionEmission::addRadInt
Foam::radiation::wideBandAbsorptionEmission::addIntensity
(
const label i,
const volScalarField& Ilambdaj
const volScalarField& ILambda
) const
{
return Ilambdaj*(iBands_[i][1] - iBands_[i][0])/totalWaveLength_;
return ILambda*(iBands_[i][1] - iBands_[i][0])/totalWaveLength_;
}
void Foam::radiation::wideBandAbsorptionEmission::correct
(
volScalarField& a,
PtrList<volScalarField>& aj
PtrList<volScalarField>& aLambda
) const
{
a = dimensionedScalar("zero", dimless/dimLength, 0.0);
for (label j = 0; j < nBands_; j++)
{
Info << "Calculating absorption in band: " << j <<endl;
aj[j].internalField() = this->a(j);
Info << "Calculated absorption in band: " << j <<endl;
Info<< "Calculating absorption in band: " << j << endl;
aLambda[j].internalField() = this->a(j);
Info<< "Calculated absorption in band: " << j << endl;
a.internalField() +=
aj[j].internalField()
aLambda[j].internalField()
*(iBands_[j][1] - iBands_[j][0])
/totalWaveLength_;
}

View File

@ -152,7 +152,7 @@ private:
//- Hash table with species names
HashTable<label> speciesNames_;
//- Indexes of species in the LookUpTable
//- Indices of species in the look-up table
FixedList<label,nSpecies_> specieIndex_;
//- Bands
@ -179,7 +179,6 @@ private:
public:
//- Runtime type information
TypeName("wideBandAbsorptionEmission");
@ -220,32 +219,36 @@ public:
tmp<volScalarField> ECont(const label bandI = 0) const;
inline bool isGrey(void) const
inline bool isGrey() const
{
return false;
}
// Number of bands
//- Number of bands
inline label nBands() const
{
return nBands_;
}
// lower and upper limit of band i
inline const Vector2D<scalar>& bands(label i) const
//- Lower and upper limit of band i
inline const Vector2D<scalar>& bands(const label i) const
{
return iBands_[i];
}
// Add contribution of Ilambdaj to the total Radiative Intensity on
// direction i
tmp<volScalarField> addRadInt
//- Add contribution of ILambda to the total radiative intensity in
// direction i
tmp<volScalarField> addIntensity
(
const label i,
const volScalarField& Ilambdaj
const volScalarField& ILambda
) const;
void correct(volScalarField& a_, PtrList<volScalarField>& aj) const;
void correct
(
volScalarField& a_,
PtrList<volScalarField>& aLambda
) const;
};