mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Updated radiation model selection - defaults to 'none' if radiationProperties not found
This commit is contained in:
@ -52,7 +52,7 @@ Foam::radiation::noRadiation::noRadiation
|
||||
const volScalarField& T
|
||||
)
|
||||
:
|
||||
radiationModel(dict, T)
|
||||
radiationModel(T)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,33 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::IOobject Foam::radiation::radiationModel::createIOobject
|
||||
(
|
||||
const fvMesh& mesh
|
||||
) const
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"radiationProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
);
|
||||
|
||||
if (io.headerOk())
|
||||
{
|
||||
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
return io;
|
||||
}
|
||||
else
|
||||
{
|
||||
io.readOpt() = IOobject::NO_READ;
|
||||
return io;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::radiation::radiationModel::initialise()
|
||||
{
|
||||
if (radiation_)
|
||||
@ -62,35 +89,6 @@ void Foam::radiation::radiationModel::initialise()
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"radiationProperties",
|
||||
T.time().constant(),
|
||||
T.mesh(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
mesh_(T.mesh()),
|
||||
time_(T.time()),
|
||||
T_(T),
|
||||
radiation_(false),
|
||||
coeffs_(dictionary::null),
|
||||
solverFreq_(0),
|
||||
firstIter_(true),
|
||||
absorptionEmission_(NULL),
|
||||
scatter_(NULL)
|
||||
{}
|
||||
|
||||
|
||||
Foam::radiation::radiationModel::radiationModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
const volScalarField& T
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
@ -101,8 +99,7 @@ Foam::radiation::radiationModel::radiationModel
|
||||
T.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
dict
|
||||
)
|
||||
),
|
||||
mesh_(T.mesh()),
|
||||
time_(T.time()),
|
||||
@ -122,17 +119,7 @@ Foam::radiation::radiationModel::radiationModel
|
||||
const volScalarField& T
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"radiationProperties",
|
||||
T.time().constant(),
|
||||
T.mesh(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
IOdictionary(createIOobject(T.mesh())),
|
||||
mesh_(T.mesh()),
|
||||
time_(T.time()),
|
||||
T_(T),
|
||||
@ -143,6 +130,11 @@ Foam::radiation::radiationModel::radiationModel
|
||||
absorptionEmission_(NULL),
|
||||
scatter_(NULL)
|
||||
{
|
||||
if (readOpt() == IOobject::NO_READ)
|
||||
{
|
||||
radiation_ = false;
|
||||
}
|
||||
|
||||
initialise();
|
||||
}
|
||||
|
||||
|
||||
@ -109,6 +109,9 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Create IO object if dictionary is present
|
||||
IOobject createIOobject(const fvMesh& mesh) const;
|
||||
|
||||
//- Initialise
|
||||
void initialise();
|
||||
|
||||
@ -156,9 +159,6 @@ public:
|
||||
//- Null constructor
|
||||
radiationModel(const volScalarField& T);
|
||||
|
||||
//- Construct with dictionary
|
||||
radiationModel(const dictionary& dict, const volScalarField& T);
|
||||
|
||||
//- Construct from components
|
||||
radiationModel(const word& type, const volScalarField& T);
|
||||
|
||||
|
||||
@ -33,23 +33,27 @@ Foam::radiation::radiationModel::New
|
||||
const volScalarField& T
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
const word modelType
|
||||
IOobject radIO
|
||||
(
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"radiationProperties",
|
||||
T.time().constant(),
|
||||
T.mesh(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("radiationModel")
|
||||
"radiationProperties",
|
||||
T.time().constant(),
|
||||
T.mesh(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
word modelType("none");
|
||||
if (radIO.headerOk())
|
||||
{
|
||||
IOdictionary(radIO).lookup("radiationModel") >> modelType;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Radiation model not active: radiationProperties not found"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
Info<< "Selecting radiationModel " << modelType << endl;
|
||||
|
||||
TConstructorTable::iterator cstrIter =
|
||||
|
||||
Reference in New Issue
Block a user