mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added new contructor and selection table for radiation models
This commit is contained in:
@ -35,6 +35,7 @@ namespace Foam
|
|||||||
namespace radiation
|
namespace radiation
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(radiationModel, 0);
|
defineTypeNameAndDebug(radiationModel, 0);
|
||||||
|
defineRunTimeSelectionTable(radiationModel, T);
|
||||||
defineRunTimeSelectionTable(radiationModel, dictionary);
|
defineRunTimeSelectionTable(radiationModel, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,6 +68,36 @@ Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::radiation::radiationModel::radiationModel
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const volScalarField& T
|
||||||
|
)
|
||||||
|
:
|
||||||
|
IOdictionary
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"radiationProperties",
|
||||||
|
T.time().constant(),
|
||||||
|
T.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
dict
|
||||||
|
),
|
||||||
|
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
|
Foam::radiation::radiationModel::radiationModel
|
||||||
(
|
(
|
||||||
const word& type,
|
const word& type,
|
||||||
@ -98,6 +129,39 @@ Foam::radiation::radiationModel::radiationModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::radiation::radiationModel::radiationModel
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const dictionary& dict,
|
||||||
|
const volScalarField& T
|
||||||
|
)
|
||||||
|
:
|
||||||
|
IOdictionary
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"radiationProperties",
|
||||||
|
T.time().constant(),
|
||||||
|
T.mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
dict
|
||||||
|
),
|
||||||
|
mesh_(T.mesh()),
|
||||||
|
time_(T.time()),
|
||||||
|
T_(T),
|
||||||
|
radiation_(lookup("radiation")),
|
||||||
|
coeffs_(subDict(type + "Coeffs")),
|
||||||
|
solverFreq_(lookupOrDefault<label>("solverFreq", 1)),
|
||||||
|
firstIter_(true),
|
||||||
|
absorptionEmission_(absorptionEmissionModel::New(*this, mesh_)),
|
||||||
|
scatter_(scatterModel::New(*this, mesh_))
|
||||||
|
{
|
||||||
|
solverFreq_ = max(1, solverFreq_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::radiation::radiationModel::~radiationModel()
|
Foam::radiation::radiationModel::~radiationModel()
|
||||||
|
|||||||
@ -35,6 +35,7 @@ Description
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
radiationModel.C
|
radiationModel.C
|
||||||
|
radiationModelNew.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -123,16 +124,28 @@ public:
|
|||||||
|
|
||||||
// Declare runtime constructor selection table
|
// Declare runtime constructor selection table
|
||||||
|
|
||||||
declareRunTimeSelectionTable
|
declareRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
autoPtr,
|
autoPtr,
|
||||||
radiationModel,
|
radiationModel,
|
||||||
dictionary,
|
T,
|
||||||
(
|
(
|
||||||
const volScalarField& T
|
const volScalarField& T
|
||||||
),
|
),
|
||||||
(T)
|
(T)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
radiationModel,
|
||||||
|
dictionary,
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const volScalarField& T
|
||||||
|
),
|
||||||
|
(dict, T)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -140,14 +153,32 @@ public:
|
|||||||
//- Null constructor
|
//- Null constructor
|
||||||
radiationModel(const volScalarField& T);
|
radiationModel(const volScalarField& T);
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
radiationModel(const dictionary& dict, const volScalarField& T);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
radiationModel(const word& type, const volScalarField& T);
|
radiationModel(const word& type, const volScalarField& T);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
radiationModel
|
||||||
|
(
|
||||||
|
const word& type,
|
||||||
|
const dictionary& dict,
|
||||||
|
const volScalarField& T
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Return a reference to the selected radiation model
|
//- Return a reference to the selected radiation model
|
||||||
static autoPtr<radiationModel> New(const volScalarField& T);
|
static autoPtr<radiationModel> New(const volScalarField& T);
|
||||||
|
|
||||||
|
//- Return a reference to the selected radiation model
|
||||||
|
static autoPtr<radiationModel> New
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const volScalarField& T
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,7 +23,6 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "error.H"
|
|
||||||
#include "radiationModel.H"
|
#include "radiationModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -53,10 +52,10 @@ Foam::radiation::radiationModel::New
|
|||||||
|
|
||||||
Info<< "Selecting radiationModel " << modelType << endl;
|
Info<< "Selecting radiationModel " << modelType << endl;
|
||||||
|
|
||||||
dictionaryConstructorTable::iterator cstrIter =
|
TConstructorTable::iterator cstrIter =
|
||||||
dictionaryConstructorTablePtr_->find(modelType);
|
TConstructorTablePtr_->find(modelType);
|
||||||
|
|
||||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
if (cstrIter == TConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
@ -64,7 +63,7 @@ Foam::radiation::radiationModel::New
|
|||||||
) << "Unknown radiationModel type "
|
) << "Unknown radiationModel type "
|
||||||
<< modelType << nl << nl
|
<< modelType << nl << nl
|
||||||
<< "Valid radiationModel types are:" << nl
|
<< "Valid radiationModel types are:" << nl
|
||||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
<< TConstructorTablePtr_->sortedToc()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,4 +71,34 @@ Foam::radiation::radiationModel::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::radiation::radiationModel>
|
||||||
|
Foam::radiation::radiationModel::New
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
const volScalarField& T
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const word modelType(dict.lookup("radiationModel"));
|
||||||
|
|
||||||
|
Info<< "Selecting radiationModel " << modelType << endl;
|
||||||
|
|
||||||
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(modelType);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"radiationModel::New(const dictionary&, const volScalarField&)"
|
||||||
|
) << "Unknown radiationModel type "
|
||||||
|
<< modelType << nl << nl
|
||||||
|
<< "Valid radiationModel types are:" << nl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<radiationModel>(cstrIter()(dict, T));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
Reference in New Issue
Block a user