improved calculate() method called from correct() in base class

This commit is contained in:
andy
2009-03-23 10:39:57 +00:00
parent 1c9390b59d
commit 3a76720e14
10 changed files with 80 additions and 66 deletions

View File

@ -50,12 +50,9 @@ namespace Foam
}
}
// Radiation solver iteration
Foam::label Foam::radiation::P1::iterRadId = pTraits<label>::one;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::radiation::P1::P1(const volScalarField& T)
:
radiationModel(typeName, T),
@ -136,14 +133,8 @@ bool Foam::radiation::P1::read()
}
void Foam::radiation::P1::correct()
void Foam::radiation::P1::calculate()
{
if (!radiation_ || !(iterRadId == nFlowIterPerRadIter_))
{
iterRadId++;
return;
}
a_ = absorptionEmission_->a();
e_ = absorptionEmission_->e();
E_ = absorptionEmission_->E();
@ -171,8 +162,6 @@ void Foam::radiation::P1::correct()
==
- 4.0*(e_*radiation::sigmaSB*pow4(T_) + E_)
);
iterRadId = pTraits<label>::one;
}

View File

@ -59,7 +59,6 @@ class P1
:
public radiationModel
{
// Private data
//- Incident radiation / [W/m2]
@ -86,10 +85,6 @@ class P1
public:
// Static data members
static label iterRadId;
//- Runtime type information
TypeName("P1");
@ -108,10 +103,10 @@ public:
// Edit
//- Update radiationSource varible
void correct();
//- Solve radiation equation(s)
void calculate();
//- Read radiationProperties dictionary
//- Read radiation properties dictionary
bool read();

View File

@ -50,9 +50,6 @@ namespace Foam
}
}
// Radiation solver iterator counter
Foam::label Foam::radiation::fvDOM::iterRadId = pTraits<label>::one;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -287,19 +284,13 @@ bool Foam::radiation::fvDOM::read()
}
void Foam::radiation::fvDOM::correct()
void Foam::radiation::fvDOM::calculate()
{
if (!radiation_ || !(iterRadId == nFlowIterPerRadIter_))
{
iterRadId++;
return;
}
absorptionEmission_->correct(a_, aj_);
updateBlackBodyEmission();
scalar maxResidual = 0;
scalar maxResidual = 0.0;
label radIter = 0;
do
{
@ -316,8 +307,6 @@ void Foam::radiation::fvDOM::correct()
} while(maxResidual > convergence_);
updateG();
iterRadId = pTraits<label>::one;
}

View File

@ -136,11 +136,6 @@ class fvDOM
public:
// Static data members
static label iterRadId;
//- Runtime type information
TypeName("fvDOM");
@ -159,10 +154,10 @@ public:
// Edit
//- Update radiation source variable
void correct();
//- Solve radiation equation(s)
void calculate();
//- Read radiationProperties dictionary
//- Read radiation properties dictionary
bool read();
//- Update G and calculate total heat flux on boundary

View File

@ -117,7 +117,7 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay
{
IOobject IHeader
(
"Ilambda_" + name(rayId) + "_" + name(i),
"ILambda_" + name(rayId) + "_" + name(i),
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
@ -170,7 +170,7 @@ Foam::radiation::radiativeIntensityRay::~radiativeIntensityRay()
Foam::scalar Foam::radiation::radiativeIntensityRay::correct()
{
// reset boundary heat flux to zero
Qr_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
Qr_ = dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0);
scalar maxResidual = -GREAT;

View File

@ -96,6 +96,9 @@ class radiativeIntensityRay
//- List of pointers to radiative intensity fields for given wavelengths
PtrList<volScalarField> ILambda_;
//- Global ray id - incremented in constructor
static label rayId;
// Private member functions
@ -108,11 +111,6 @@ class radiativeIntensityRay
public:
// Static data members
static label rayId;
// Constructors
//- Construct form components

View File

@ -50,10 +50,9 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::radiation::noRadiation::noRadiation(const volScalarField& T)
:
radiationModel(typeName, T)
radiationModel(T)
{}
@ -71,7 +70,7 @@ bool Foam::radiation::noRadiation::read()
}
void Foam::radiation::noRadiation::correct()
void Foam::radiation::noRadiation::calculate()
{
// Do nothing
}

View File

@ -54,7 +54,6 @@ class noRadiation
:
public radiationModel
{
// Private member functions
//- Disallow default bitwise copy construct
@ -76,7 +75,7 @@ public:
noRadiation(const volScalarField& T);
// Destructor
//- Destructor
virtual ~noRadiation();
@ -84,8 +83,8 @@ public:
// Edit
//- Update radiation source
void correct();
//- Solve radiation equation(s)
void calculate();
//- Read radiationProperties dictionary
bool read();

View File

@ -43,6 +43,30 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
:
IOdictionary
(
IOobject
(
"radiationProperties",
T.time().constant(),
T.mesh().objectRegistry::db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
mesh_(T.mesh()),
time_(T.time()),
T_(T),
radiation_(false),
coeffs_(dictionary::null),
solverFreq_(0),
absorptionEmission_(NULL),
scatter_(NULL)
{}
Foam::radiation::radiationModel::radiationModel
(
const word& type,
@ -60,14 +84,17 @@ Foam::radiation::radiationModel::radiationModel
IOobject::NO_WRITE
)
),
T_(T),
mesh_(T.mesh()),
time_(T.time()),
T_(T),
radiation_(lookup("radiation")),
coeffs_(subDict(type + "Coeffs")),
nFlowIterPerRadIter_(readLabel(lookup("nFlowIterPerRadIter"))),
solverFreq_(readLabel(lookup("solverFreq"))),
absorptionEmission_(absorptionEmissionModel::New(*this, mesh_)),
scatter_(scatterModel::New(*this, mesh_))
{}
{
solverFreq_ = max(1, solverFreq_);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
@ -94,6 +121,20 @@ bool Foam::radiation::radiationModel::read()
}
void Foam::radiation::radiationModel::correct()
{
if (!radiation_)
{
return;
}
if ((time_.timeIndex() == 0) || (time_.timeIndex() % solverFreq_ == 0))
{
calculate();
}
}
Foam::tmp<Foam::fvScalarMatrix> Foam::radiation::radiationModel::Sh
(
basicThermo& thermo

View File

@ -73,21 +73,24 @@ protected:
// Protected data
//- Reference to the mesh database
const fvMesh& mesh_;
//- Reference to the time database
const Time& time_;
//- Reference to the temperature field
const volScalarField& T_;
//- Reference to the mesh
const fvMesh& mesh_;
//- Model specific dictionary input parameters
Switch radiation_;
//- Radiation model dictionary
dictionary coeffs_;
//- Number of iterations in the flow solver per radiation solver
// iteration
label nFlowIterPerRadIter_;
//- Radiation solver frequency - number flow solver iterations per
// radiation solver iteration
label solverFreq_;
// References to the radiation sub-models
@ -132,6 +135,9 @@ public:
// Constructors
//- Null constructor
radiationModel(const volScalarField& T);
//- Construct from components
radiationModel(const word& type, const volScalarField& T);
@ -142,7 +148,7 @@ public:
static autoPtr<radiationModel> New(const volScalarField& T);
// Destructor
//- Destructor
virtual ~radiationModel();
@ -150,8 +156,11 @@ public:
// Edit
//- Main update/correction routine
virtual void correct();
//- Solve radiation equation(s)
virtual void correct() = 0;
virtual void calculate() = 0;
//- Read radiationProperties dictionary
virtual bool read() = 0;