wideBandAbsorptionEmission: Corrected errors

Resolves bug-reports
https://bugs.openfoam.org/view.php?id=2881
https://bugs.openfoam.org/view.php?id=2882

Patches contributed by Kevin Nordin-Bates
This commit is contained in:
Henry Weller
2018-03-21 18:03:29 +00:00
parent a4de83a425
commit c677ba1185
6 changed files with 269 additions and 148 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,6 @@ License
#include "absorptionCoeffs.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
Foam::radiation::absorptionCoeffs::~absorptionCoeffs()
@ -40,7 +39,7 @@ void Foam::radiation::absorptionCoeffs::checkT(const scalar T) const
if (T < Tlow_ || T > Thigh_)
{
WarningInFunction
<< "usinf absCoeff out of temperature range:" << nl
<< "using absorptionCoeffs out of temperature range:" << nl
<< " " << Tlow_ << " -> " << Thigh_ << "; T = " << T
<< nl << endl;
}
@ -72,7 +71,6 @@ void Foam::radiation::absorptionCoeffs::initialise(const dictionary& dict)
dict.lookup("Tlow") >> Tlow_;
dict.lookup("Thigh") >> Thigh_;
dict.lookup("invTemp") >> invTemp_;
dict.lookup("loTcoeffs") >> lowACoeffs_;
dict.lookup("hiTcoeffs") >> highACoeffs_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -197,6 +197,44 @@ Foam::scalar Foam::radiation::blackBodyEmission::fLambdaT
}
Foam::tmp<Foam::volScalarField>
Foam::radiation::blackBodyEmission::deltaLambdaT
(
const volScalarField& T,
const Vector2D<scalar>& band
) const
{
tmp<volScalarField> deltaLambdaT
(
new volScalarField
(
IOobject
(
"deltaLambdaT",
T.mesh().time().timeName(),
T.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
T.mesh(),
dimensionedScalar("deltaLambdaT", dimless, 1.0)
)
);
if (band != Vector2D<scalar>::one)
{
scalarField& deltaLambdaTf = deltaLambdaT.ref();
forAll(T, i)
{
deltaLambdaTf[i] = fLambdaT(band[1]*T[i]) - fLambdaT(band[0]*T[i]);
}
}
return deltaLambdaT;
}
Foam::tmp<Foam::volScalarField>
Foam::radiation::blackBodyEmission::EbDeltaLambdaT
(
@ -220,21 +258,13 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT
)
);
if (band == Vector2D<scalar>::one)
{
return Eb;
}
else
if (band != Vector2D<scalar>::one)
{
scalarField& Ebif = Eb.ref();
forAll(T, i)
{
const scalar T1 = fLambdaT(band[1]*T[i]);
const scalar T2 = fLambdaT(band[0]*T[i]);
Ebif[i] *= T1 - T2;
Ebif[i] *= fLambdaT(band[1]*T[i]) - fLambdaT(band[0]*T[i]);
}
volScalarField::Boundary& EbBf = Eb.ref().boundaryFieldRef();
@ -256,9 +286,9 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT
}
}
}
return Eb;
}
return Eb;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,7 +27,7 @@ Class
Description
Class black body emission
Table of black body emissive power taken from:
Table of black body emissive power from:
Modest, "Radiative Heat Transfer", pp.775-777, 1993
SourceFiles
@ -123,6 +123,13 @@ public:
return (C1_/(pow5(lambda)*(exp(C2_/(lambda*T)) - 1.0)));
}
//- Proportion of total energy at T from lambda1 to lambda2
tmp<Foam::volScalarField> deltaLambdaT
(
const volScalarField& T,
const Vector2D<scalar>& band
) const;
//- Integral energy at T from lambda1 to lambda2
tmp<Foam::volScalarField> EbDeltaLambdaT
(
@ -130,7 +137,6 @@ public:
const Vector2D<scalar>& band
) const;
// Edit
// Update black body emission

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -54,15 +54,15 @@ void Foam::radiation::fvDOM::initialise()
{
nRay_ = 4*nPhi_*nTheta_;
IRay_.setSize(nRay_);
scalar deltaPhi = pi/(2.0*nPhi_);
scalar deltaTheta = pi/nTheta_;
const scalar deltaPhi = pi/(2.0*nPhi_);
const scalar deltaTheta = pi/nTheta_;
label i = 0;
for (label n = 1; n <= nTheta_; n++)
{
for (label m = 1; m <= 4*nPhi_; m++)
{
scalar thetai = (2.0*n - 1.0)*deltaTheta/2.0;
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
const scalar thetai = (2*n - 1)*deltaTheta/2.0;
const scalar phii = (2*m - 1)*deltaPhi/2.0;
IRay_.set
(
i,
@ -87,15 +87,15 @@ void Foam::radiation::fvDOM::initialise()
// 2D
else if (mesh_.nSolutionD() == 2)
{
scalar thetai = piByTwo;
scalar deltaTheta = pi;
const scalar thetai = piByTwo;
const scalar deltaTheta = pi;
nRay_ = 4*nPhi_;
IRay_.setSize(nRay_);
scalar deltaPhi = pi/(2.0*nPhi_);
const scalar deltaPhi = pi/(2.0*nPhi_);
label i = 0;
for (label m = 1; m <= 4*nPhi_; m++)
{
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
const scalar phii = (2*m - 1)*deltaPhi/2.0;
IRay_.set
(
i,
@ -119,15 +119,15 @@ void Foam::radiation::fvDOM::initialise()
// 1D
else
{
scalar thetai = piByTwo;
scalar deltaTheta = pi;
const scalar thetai = piByTwo;
const scalar deltaTheta = pi;
nRay_ = 2;
IRay_.setSize(nRay_);
scalar deltaPhi = pi;
const scalar deltaPhi = pi;
label i = 0;
for (label m = 1; m <= 2; m++)
{
scalar phii = (2.0*m - 1.0)*deltaPhi/2.0;
const scalar phii = (2*m - 1)*deltaPhi/2.0;
IRay_.set
(
i,
@ -212,7 +212,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("G", dimMass/pow3(dimTime), 0.0)
dimensionedScalar("G", dimMass/pow3(dimTime), 0)
),
qr_
(
@ -225,7 +225,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("qr", dimMass/pow3(dimTime), 0.0)
dimensionedScalar("qr", dimMass/pow3(dimTime), 0)
),
qem_
(
@ -238,7 +238,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("qem", dimMass/pow3(dimTime), 0.0)
dimensionedScalar("qem", dimMass/pow3(dimTime), 0)
),
qin_
(
@ -251,7 +251,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("qin", dimMass/pow3(dimTime), 0.0)
dimensionedScalar("qin", dimMass/pow3(dimTime), 0)
),
a_
(
@ -264,7 +264,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("a", dimless/dimLength, 0.0)
dimensionedScalar("a", dimless/dimLength, 0)
),
nTheta_(readLabel(coeffs_.lookup("nTheta"))),
nPhi_(readLabel(coeffs_.lookup("nPhi"))),
@ -277,7 +277,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
(
coeffs_.found("convergence")
? readScalar(coeffs_.lookup("convergence"))
: coeffs_.lookupOrDefault<scalar>("tolerance", 0.0)
: coeffs_.lookupOrDefault<scalar>("tolerance", 0)
),
maxIter_(coeffs_.lookupOrDefault<label>("maxIter", 50)),
omegaMax_(0)
@ -304,7 +304,7 @@ Foam::radiation::fvDOM::fvDOM
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("G", dimMass/pow3(dimTime), 0.0)
dimensionedScalar("G", dimMass/pow3(dimTime), 0)
),
qr_
(
@ -317,7 +317,7 @@ Foam::radiation::fvDOM::fvDOM
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("qr", dimMass/pow3(dimTime), 0.0)
dimensionedScalar("qr", dimMass/pow3(dimTime), 0)
),
qem_
(
@ -330,7 +330,7 @@ Foam::radiation::fvDOM::fvDOM
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("qem", dimMass/pow3(dimTime), 0.0)
dimensionedScalar("qem", dimMass/pow3(dimTime), 0)
),
qin_
(
@ -343,7 +343,7 @@ Foam::radiation::fvDOM::fvDOM
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("qin", dimMass/pow3(dimTime), 0.0)
dimensionedScalar("qin", dimMass/pow3(dimTime), 0)
),
a_
(
@ -356,7 +356,7 @@ Foam::radiation::fvDOM::fvDOM
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("a", dimless/dimLength, 0.0)
dimensionedScalar("a", dimless/dimLength, 0)
),
nTheta_(readLabel(coeffs_.lookup("nTheta"))),
nPhi_(readLabel(coeffs_.lookup("nPhi"))),
@ -369,7 +369,7 @@ Foam::radiation::fvDOM::fvDOM
(
coeffs_.found("convergence")
? readScalar(coeffs_.lookup("convergence"))
: coeffs_.lookupOrDefault<scalar>("tolerance", 0.0)
: coeffs_.lookupOrDefault<scalar>("tolerance", 0)
),
maxIter_(coeffs_.lookupOrDefault<label>("maxIter", 50)),
omegaMax_(0)
@ -394,9 +394,7 @@ bool Foam::radiation::fvDOM::read()
// For backward-compatibility
coeffs_.readIfPresent("convergence", tolerance_);
coeffs_.readIfPresent("tolerance", tolerance_);
coeffs_.readIfPresent("maxIter", maxIter_);
return true;
@ -417,14 +415,14 @@ void Foam::radiation::fvDOM::calculate()
// Set rays converged false
List<bool> rayIdConv(nRay_, false);
scalar maxResidual = 0.0;
scalar maxResidual = 0;
label radIter = 0;
do
{
Info<< "Radiation solver iter: " << radIter << endl;
radIter++;
maxResidual = 0.0;
maxResidual = 0;
forAll(IRay_, rayI)
{
if (!rayIdConv[rayI])
@ -447,7 +445,8 @@ void Foam::radiation::fvDOM::calculate()
Foam::tmp<Foam::volScalarField> Foam::radiation::fvDOM::Rp() const
{
return tmp<volScalarField>
// Construct using contribution from first frequency band
tmp<volScalarField> tRp
(
new volScalarField
(
@ -460,28 +459,75 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::fvDOM::Rp() const
IOobject::NO_WRITE,
false
),
// Only include continuous phase emission
4*absorptionEmission_->aCont()*physicoChemical::sigma
(
4
*physicoChemical::sigma
*(aLambda_[0] - absorptionEmission_->aDisp(0)())
*blackBody_.deltaLambdaT(T_, absorptionEmission_->bands(0))
)
)
);
volScalarField& Rp=tRp.ref();
// Add contributions over remaining frequency bands
for (label j=1; j < nLambda_; j++)
{
Rp +=
(
4
*physicoChemical::sigma
*(aLambda_[j] - absorptionEmission_->aDisp(j)())
*blackBody_.deltaLambdaT(T_, absorptionEmission_->bands(j))
);
}
return tRp;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
Foam::radiation::fvDOM::Ru() const
{
tmp<DimensionedField<scalar, volMesh>> tRu
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"Ru",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimensionSet(1, -1, -3, 0, 0), 0)
)
);
const volScalarField::Internal& G =
G_();
DimensionedField<scalar, volMesh>& Ru=tRu.ref();
const volScalarField::Internal E =
absorptionEmission_->ECont()()();
// Sum contributions over all frequency bands
for (label j=0; j < nLambda_; j++)
{
// Compute total incident radiation within frequency band
tmp<DimensionedField<scalar, volMesh>> Gj
(
IRay_[0].ILambda(j)()*IRay_[0].omega()
);
// Only include continuous phase absorption
const volScalarField::Internal a =
absorptionEmission_->aCont()()();
for (label rayI=1; rayI < nRay_; rayI++)
{
Gj.ref() += IRay_[rayI].ILambda(j)()*IRay_[rayI].omega();
}
return a*G - E;
Ru += (aLambda_[j]() - absorptionEmission_->aDisp(j)()())*Gj
- absorptionEmission_->ECont(j)()();
}
return tRu;
}
@ -496,10 +542,10 @@ void Foam::radiation::fvDOM::updateBlackBodyEmission()
void Foam::radiation::fvDOM::updateG()
{
G_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
qr_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0.0);
qem_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
qin_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
G_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0);
qr_ = dimensionedScalar("zero",dimMass/pow3(dimTime), 0);
qem_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0);
qin_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0);
forAll(IRay_, rayI)
{
@ -519,12 +565,12 @@ void Foam::radiation::fvDOM::setRayIdLambdaId
label& lambdaId
) const
{
// assuming name is in the form: CHARS_rayId_lambdaId
size_type i1 = name.find_first_of("_");
size_type i2 = name.find_last_of("_");
// Assume name is in the form: <name>_<rayId>_<lambdaId>
const size_type i1 = name.find_first_of("_");
const size_type i2 = name.find_last_of("_");
rayId = readLabel(IStringStream(name.substr(i1+1, i2-1))());
lambdaId = readLabel(IStringStream(name.substr(i2+1, name.size()-1))());
rayId = readLabel(IStringStream(name.substr(i1 + 1, i2 - 1))());
lambdaId = readLabel(IStringStream(name.substr(i2 + 1, name.size() - 1))());
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,8 @@ License
#include "wideBandAbsorptionEmission.H"
#include "addToRunTimeSelectionTable.H"
#include "basicSpecieMixture.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -56,12 +58,7 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
coeffsDict_((dict.optionalSubDict(typeName + "Coeffs"))),
speciesNames_(0),
specieIndex_(label(0)),
lookUpTable_
(
fileName(coeffsDict_.lookup("lookUpTableFileName")),
mesh.time().constant(),
mesh
),
lookUpTablePtr_(),
thermo_(mesh.lookupObject<fluidThermo>(basicThermo::dictName)),
Yj_(nSpecies_),
totalWaveLength_(0)
@ -95,7 +92,7 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
if (!speciesNames_.found(key))
{
FatalErrorInFunction
<< "specie: " << key << "is not in all the bands"
<< "specie: " << key << " is not in all the bands"
<< nl << exit(FatalError);
}
}
@ -106,40 +103,85 @@ Foam::radiation::wideBandAbsorptionEmission::wideBandAbsorptionEmission
}
nBands_ = nBand;
if (coeffsDict_.found("lookUpTableFileName"))
{
const word name = coeffsDict_.lookup("lookUpTableFileName");
if (name != "none")
{
lookUpTablePtr_.set
(
new interpolationLookUpTable<scalar>
(
fileName(coeffsDict_.lookup("lookUpTableFileName")),
mesh.time().constant(),
mesh
)
);
if (!mesh.foundObject<volScalarField>("ft"))
{
FatalErrorInFunction
<< "specie ft is not present to use with "
<< "lookUpTableFileName " << nl
<< exit(FatalError);
}
}
}
// Check that all the species on the dictionary are present in the
// look-up table and save the corresponding indices of the look-up table
// look-up table and save the corresponding indices of the look-up table
label j = 0;
forAllConstIter(HashTable<label>, speciesNames_, iter)
{
if (lookUpTable_.found(iter.key()))
if (!lookUpTablePtr_.empty())
{
label index = lookUpTable_.findFieldIndex(iter.key());
Info<< "specie: " << iter.key() << " found in look-up table "
<< " with index: " << index << endl;
specieIndex_[iter()] = index;
if (lookUpTablePtr_().found(iter.key()))
{
const label index =
lookUpTablePtr_().findFieldIndex(iter.key());
Info<< "specie: " << iter.key() << " found on look-up table "
<< " with index: " << index << endl;
specieIndex_[iter()] = index;
}
else if (mesh.foundObject<volScalarField>(iter.key()))
{
Yj_.set(j, &mesh.lookupObjectRef<volScalarField>(iter.key()));
specieIndex_[iter()] = 0;
j++;
Info<< "specie: " << iter.key() << " is being solved" << endl;
}
else
{
FatalErrorInFunction
<< "specie: " << iter.key()
<< " is neither in look-up table: "
<< lookUpTablePtr_().tableName()
<< " nor is being solved" << nl
<< exit(FatalError);
}
}
else if (mesh.foundObject<volScalarField>(iter.key()))
{
Yj_.set(j, &mesh.lookupObjectRef<volScalarField>(iter.key()));
specieIndex_[iter()] = 0.0;
specieIndex_[iter()] = 0;
j++;
Info<< "species: " << iter.key() << " is being solved" << endl;
}
else
{
FatalErrorInFunction
<< "specie: " << iter.key()
<< " is neither in look-up table : "
<< lookUpTable_.tableName() << " nor is being solved"
<< " there is no lookup table and the specie" << nl
<< iter.key() << nl
<< " is not found " << nl
<< exit(FatalError);
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::wideBandAbsorptionEmission::~wideBandAbsorptionEmission()
@ -149,13 +191,13 @@ Foam::radiation::wideBandAbsorptionEmission::~wideBandAbsorptionEmission()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandI) const
Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandi) const
{
const basicSpecieMixture& mixture =
dynamic_cast<const basicSpecieMixture&>(thermo_);
const volScalarField& T = thermo_.T();
const volScalarField& p = thermo_.p();
const volScalarField& ft = mesh_.lookupObject<volScalarField>("ft");
label nSpecies = speciesNames_.size();
tmp<volScalarField> ta
(
@ -170,44 +212,56 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandI) const
IOobject::NO_WRITE
),
mesh(),
dimensionedScalar("a", dimless/dimLength, 0.0)
dimensionedScalar("a", dimless/dimLength, 0)
)
);
scalarField& a = ta.ref().primitiveFieldRef();
forAll(a, i)
forAll(a, celli)
{
const List<scalar>& species = lookUpTable_.lookUp(ft[i]);
for (label n=0; n<nSpecies; n++)
forAllConstIter(HashTable<label>, speciesNames_, iter)
{
label l = 0;
scalar Yipi = 0.0;
const label n = iter();
scalar Xipi = 0;
if (specieIndex_[n] != 0)
{
// moles x pressure [atm]
Yipi = species[specieIndex_[n]]*p[i]*9.869231e-6;
const volScalarField& ft =
mesh_.lookupObject<volScalarField>("ft");
const List<scalar>& Ynft = lookUpTablePtr_().lookUp(ft[celli]);
// moles*pressure [atm]
Xipi = Ynft[specieIndex_[n]]*paToAtm(p[celli]);
}
else
{
// mass fraction from species being solved
Yipi = Yj_[l][i];
l++;
scalar invWt = 0;
forAll(mixture.Y(), s)
{
invWt += mixture.Y(s)[celli]/mixture.W(s);
}
const label index = mixture.species()[iter.key()];
const scalar Xk =
mixture.Y(index)[celli]/(mixture.W(index)*invWt);
Xipi = Xk*paToAtm(p[celli]);
}
scalar Ti = T[i];
scalar Ti = T[celli];
const absorptionCoeffs::coeffArray& b =
coeffs_[n][bandI].coeffs(T[i]);
coeffs_[bandi][n].coeffs(T[celli]);
if (coeffs_[n][bandI].invTemp())
if (coeffs_[bandi][n].invTemp())
{
Ti = 1.0/T[i];
Ti = 1.0/T[celli];
}
a[i]+=
Yipi
a[celli]+=
Xipi
*(
((((b[5]*Ti + b[4])*Ti + b[3])*Ti + b[2])*Ti + b[1])*Ti
+ b[0]
@ -220,14 +274,14 @@ Foam::radiation::wideBandAbsorptionEmission::aCont(const label bandI) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::wideBandAbsorptionEmission::eCont(const label bandI) const
Foam::radiation::wideBandAbsorptionEmission::eCont(const label bandi) const
{
return aCont(bandI);
return aCont(bandi);
}
Foam::tmp<Foam::volScalarField>
Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandI) const
Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandi) const
{
tmp<volScalarField> E
(
@ -242,7 +296,7 @@ Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandI) const
IOobject::NO_WRITE
),
mesh(),
dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0.0)
dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0)
)
);
@ -254,18 +308,18 @@ Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandI) const
if (Qdot.dimensions() == dimEnergy/dimTime)
{
E.ref().primitiveFieldRef() =
iEhrrCoeffs_[bandI]
iEhrrCoeffs_[bandi]
*Qdot.primitiveField()
*(iBands_[bandI][1] - iBands_[bandI][0])
*(iBands_[bandi][1] - iBands_[bandi][0])
/totalWaveLength_
/mesh_.V();
}
else if (Qdot.dimensions() == dimEnergy/dimTime/dimVolume)
{
E.ref().primitiveFieldRef() =
iEhrrCoeffs_[bandI]
iEhrrCoeffs_[bandi]
*Qdot.primitiveField()
*(iBands_[bandI][1] - iBands_[bandI][0])
*(iBands_[bandi][1] - iBands_[bandi][0])
/totalWaveLength_;
}
else
@ -285,7 +339,7 @@ void Foam::radiation::wideBandAbsorptionEmission::correct
PtrList<volScalarField>& aLambda
) const
{
a = dimensionedScalar("zero", dimless/dimLength, 0.0);
a = dimensionedScalar("zero", dimless/dimLength, 0);
for (label j=0; j<nBands_; j++)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,11 +37,8 @@ Description
The emission constant proportionality is specified per band (EhrrCoeff).
The coefficients for the species in the lookup table have to be specified
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
respective mass fraction being solved.
The coefficients for the species have to be specified for use in
moles x P [atm], i.e. (k[i] = species[i]*p*9.869231e-6).
The look Up table file should be in the constant directory.
@ -156,8 +153,8 @@ private:
//- Proportion of the heat released rate emitted
FixedList<scalar, maxBands_> iEhrrCoeffs_;
//- Lookup table of species related to ft
mutable interpolationLookUpTable<scalar> lookUpTable_;
//- Look-up table of species related to ft
mutable autoPtr<interpolationLookUpTable<scalar>> lookUpTablePtr_;
//- Thermo package
const fluidThermo& thermo_;
@ -190,24 +187,14 @@ public:
// Member Functions
// Access
//- Absorption coefficient for continuous phase
tmp<volScalarField> aCont(const label bandi = 0) const;
// Absorption coefficient
//- Emission coefficient for continuous phase
tmp<volScalarField> eCont(const label bandi = 0) const;
//- Absorption coefficient for continuous phase
tmp<volScalarField> aCont(const label bandI = 0) const;
// Emission coefficient
//- Emission coefficient for continuous phase
tmp<volScalarField> eCont(const label bandI = 0) const;
// Emission contribution
//- Emission contribution for continuous phase
tmp<volScalarField> ECont(const label bandI = 0) const;
//- Emission contribution for continuous phase
tmp<volScalarField> ECont(const label bandi = 0) const;
inline bool isGrey() const
@ -222,15 +209,15 @@ public:
}
//- Lower and upper limit of band i
inline const Vector2D<scalar>& bands(const label i) const
inline const Vector2D<scalar>& bands(const label bandi) const
{
return iBands_[i];
return iBands_[bandi];
}
//- Correct rays
void correct
(
volScalarField& a_,
volScalarField& a,
PtrList<volScalarField>& aLambda
) const;
};