Skip to content
Snippets Groups Projects
Commit be09967a authored by sergio's avatar sergio Committed by Sergio Ferraris
Browse files

ENH: regionFaModel: various updates

parent efd3f592
No related branches found
No related tags found
1 merge request!475finiteArea: new models and solvers for films
...@@ -41,6 +41,9 @@ namespace regionModels ...@@ -41,6 +41,9 @@ namespace regionModels
} }
} }
const Foam::word
Foam::regionModels::regionFaModel::regionFaModelName("regionFaModel");
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::regionModels::regionFaModel::constructMeshObjects() void Foam::regionModels::regionFaModel::constructMeshObjects()
...@@ -60,12 +63,31 @@ void Foam::regionModels::regionFaModel::initialise() ...@@ -60,12 +63,31 @@ void Foam::regionModels::regionFaModel::initialise()
} }
vsmPtr_.reset(new volSurfaceMapping(regionMeshPtr_())); 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_) if (active_)
{ {
...@@ -102,6 +124,17 @@ Foam::regionModels::regionFaModel::regionFaModel ...@@ -102,6 +124,17 @@ Foam::regionModels::regionFaModel::regionFaModel
bool readFields 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()), primaryMesh_(patch.boundaryMesh().mesh()),
patch_(patch), patch_(patch),
time_(patch.boundaryMesh().mesh().time()), time_(patch.boundaryMesh().mesh().time()),
...@@ -110,19 +143,17 @@ Foam::regionModels::regionFaModel::regionFaModel ...@@ -110,19 +143,17 @@ Foam::regionModels::regionFaModel::regionFaModel
modelName_(modelName), modelName_(modelName),
regionMeshPtr_(nullptr), regionMeshPtr_(nullptr),
coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")), coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")),
outputPropertiesPtr_(nullptr),
vsmPtr_(nullptr), vsmPtr_(nullptr),
patchID_(patch.index()), patchID_(patch.index()),
regionName_(dict.lookup("region")) regionName_(dict.lookup("region"))
{ {
if (active_) constructMeshObjects();
{ initialise();
constructMeshObjects();
initialise();
if (readFields) if (readFields)
{ {
read(dict); init(dict);
}
} }
} }
...@@ -165,8 +196,9 @@ void Foam::regionModels::regionFaModel::postEvolveRegion() ...@@ -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 ...@@ -88,6 +88,8 @@ namespace regionModels
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class regionFaModel class regionFaModel
:
public IOdictionary
{ {
// Private Member Functions // Private Member Functions
...@@ -97,6 +99,9 @@ class regionFaModel ...@@ -97,6 +99,9 @@ class regionFaModel
//- Initialise the region //- Initialise the region
void initialise(); void initialise();
//- Read control parameters from dictionary
bool init(const dictionary& dict);
protected: protected:
...@@ -126,6 +131,9 @@ protected: ...@@ -126,6 +131,9 @@ protected:
//- Model coefficients dictionary //- Model coefficients dictionary
dictionary coeffs_; dictionary coeffs_;
//- Dictionary of output properties
autoPtr<IOdictionary> outputPropertiesPtr_;
//-Volume-to surface mapping //-Volume-to surface mapping
autoPtr<volSurfaceMapping> vsmPtr_; autoPtr<volSurfaceMapping> vsmPtr_;
...@@ -140,18 +148,15 @@ protected: ...@@ -140,18 +148,15 @@ protected:
word regionName_; word regionName_;
// Protected Member Functions
//- Read control parameters from dictionary
virtual bool read(const dictionary& dict);
public: public:
//- Runtime type information //- Runtime type information
TypeName("regionFaModel"); TypeName("regionFaModel");
//- Default name regionFaModel
static const word regionFaModelName;
// Constructors // Constructors
//- Construct from mesh and name and dict //- Construct from mesh and name and dict
...@@ -203,18 +208,23 @@ public: ...@@ -203,18 +208,23 @@ public:
//- Return the model coefficients dictionary //- Return the model coefficients dictionary
inline const dictionary& coeffs() const; 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 //- Return the solution dictionary
inline const dictionary& solution() const; inline const dictionary& solution() const;
//- Return volSurfaceMapping //- Return patch ID
const volSurfaceMapping& vsm() const; inline label patchID() const;
// Addressing // Help Functions
//- Return the list of patch IDs on the primary region coupled //- Return mapping between surface and volume fields
//- to this region const volSurfaceMapping& vsm() const;
inline label patchID();
// Evolution // Evolution
...@@ -231,11 +241,14 @@ public: ...@@ -231,11 +241,14 @@ public:
//- Post-evolve region //- Post-evolve region
virtual void postEvolveRegion(); virtual void postEvolveRegion();
//- Courant number of the region
virtual scalar CourantNumber() const;
// IO // IO
//- Provide some feedback //- Provide some feedback
virtual void info(); virtual void info() = 0;
}; };
......
...@@ -101,6 +101,32 @@ inline const Foam::dictionary& Foam::regionModels::regionFaModel::coeffs() const ...@@ -101,6 +101,32 @@ inline const Foam::dictionary& Foam::regionModels::regionFaModel::coeffs() const
return coeffs_; 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& inline const Foam::dictionary&
Foam::regionModels::regionFaModel::solution() const Foam::regionModels::regionFaModel::solution() const
...@@ -109,7 +135,7 @@ 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_; return patchID_;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment