mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: regionFaModel: various updates
This commit is contained in:
@ -41,6 +41,9 @@ namespace regionModels
|
||||
}
|
||||
}
|
||||
|
||||
const Foam::word
|
||||
Foam::regionModels::regionFaModel::regionFaModelName("regionFaModel");
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::regionModels::regionFaModel::constructMeshObjects()
|
||||
@ -60,12 +63,31 @@ void Foam::regionModels::regionFaModel::initialise()
|
||||
}
|
||||
|
||||
vsmPtr_.reset(new volSurfaceMapping(regionMeshPtr_()));
|
||||
|
||||
if (!outputPropertiesPtr_)
|
||||
{
|
||||
const fileName uniformPath(word("uniform")/regionFaModelName);
|
||||
|
||||
outputPropertiesPtr_.reset
|
||||
(
|
||||
new IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
regionName_ + "OutputProperties",
|
||||
time_.timeName(),
|
||||
uniformPath/regionName_,
|
||||
primaryMesh_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::regionModels::regionFaModel::read(const dictionary& dict)
|
||||
bool Foam::regionModels::regionFaModel::init(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
@ -102,6 +124,17 @@ Foam::regionModels::regionFaModel::regionFaModel
|
||||
bool readFields
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(regionFaModelName, patch.name()),
|
||||
patch.boundaryMesh().mesh().time().constant(),
|
||||
patch.boundaryMesh().mesh().time(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
primaryMesh_(patch.boundaryMesh().mesh()),
|
||||
patch_(patch),
|
||||
time_(patch.boundaryMesh().mesh().time()),
|
||||
@ -110,19 +143,17 @@ Foam::regionModels::regionFaModel::regionFaModel
|
||||
modelName_(modelName),
|
||||
regionMeshPtr_(nullptr),
|
||||
coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")),
|
||||
outputPropertiesPtr_(nullptr),
|
||||
vsmPtr_(nullptr),
|
||||
patchID_(patch.index()),
|
||||
regionName_(dict.lookup("region"))
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
constructMeshObjects();
|
||||
initialise();
|
||||
constructMeshObjects();
|
||||
initialise();
|
||||
|
||||
if (readFields)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
if (readFields)
|
||||
{
|
||||
init(dict);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,8 +196,9 @@ void Foam::regionModels::regionFaModel::postEvolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::regionModels::regionFaModel::info()
|
||||
{}
|
||||
|
||||
Foam::scalar Foam::regionModels::regionFaModel::CourantNumber() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -88,6 +88,8 @@ namespace regionModels
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class regionFaModel
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
@ -97,6 +99,9 @@ class regionFaModel
|
||||
//- Initialise the region
|
||||
void initialise();
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
bool init(const dictionary& dict);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -126,6 +131,9 @@ protected:
|
||||
//- Model coefficients dictionary
|
||||
dictionary coeffs_;
|
||||
|
||||
//- Dictionary of output properties
|
||||
autoPtr<IOdictionary> outputPropertiesPtr_;
|
||||
|
||||
//-Volume-to surface mapping
|
||||
autoPtr<volSurfaceMapping> vsmPtr_;
|
||||
|
||||
@ -140,18 +148,15 @@ protected:
|
||||
word regionName_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("regionFaModel");
|
||||
|
||||
|
||||
//- Default name regionFaModel
|
||||
static const word regionFaModelName;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and name and dict
|
||||
@ -203,20 +208,25 @@ public:
|
||||
//- Return the model coefficients dictionary
|
||||
inline const dictionary& coeffs() const;
|
||||
|
||||
//- Return const access to the output properties dictionary
|
||||
inline const IOdictionary& outputProperties() const;
|
||||
|
||||
//- Return output properties dictionary
|
||||
inline IOdictionary& outputProperties();
|
||||
|
||||
//- Return the solution dictionary
|
||||
inline const dictionary& solution() const;
|
||||
|
||||
//- Return volSurfaceMapping
|
||||
//- Return patch ID
|
||||
inline label patchID() const;
|
||||
|
||||
|
||||
// Help Functions
|
||||
|
||||
//- Return mapping between surface and volume fields
|
||||
const volSurfaceMapping& vsm() const;
|
||||
|
||||
|
||||
// Addressing
|
||||
|
||||
//- Return the list of patch IDs on the primary region coupled
|
||||
//- to this region
|
||||
inline label patchID();
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Main driver routing to evolve the region - calls other evolves
|
||||
@ -231,11 +241,14 @@ public:
|
||||
//- Post-evolve region
|
||||
virtual void postEvolveRegion();
|
||||
|
||||
//- Courant number of the region
|
||||
virtual scalar CourantNumber() const;
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Provide some feedback
|
||||
virtual void info();
|
||||
virtual void info() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -101,6 +101,32 @@ inline const Foam::dictionary& Foam::regionModels::regionFaModel::coeffs() const
|
||||
return coeffs_;
|
||||
}
|
||||
|
||||
inline const Foam::IOdictionary&
|
||||
Foam::regionModels::regionFaModel::outputProperties() const
|
||||
{
|
||||
if (!outputPropertiesPtr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "outputProperties dictionary not available"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
return *outputPropertiesPtr_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::IOdictionary&
|
||||
Foam::regionModels::regionFaModel::outputProperties()
|
||||
{
|
||||
if (!outputPropertiesPtr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "outputProperties dictionary not available"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return *outputPropertiesPtr_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary&
|
||||
Foam::regionModels::regionFaModel::solution() const
|
||||
@ -109,7 +135,7 @@ Foam::regionModels::regionFaModel::solution() const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::regionModels::regionFaModel::patchID()
|
||||
inline Foam::label Foam::regionModels::regionFaModel::patchID() const
|
||||
{
|
||||
return patchID_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user