fvModels, fvConstraints: Rational separation of fvOptions between physical modelling and numerical constraints
The new fvModels is a general interface to optional physical models in the finite volume framework, providing sources to the governing conservation equations, thus ensuring consistency and conservation. This structure is used not only for simple sources and forces but also provides a general run-time selection interface for more complex models such as radiation and film, in the future this will be extended to Lagrangian, reaction, combustion etc. For such complex models the 'correct()' function is provided to update the state of these models at the beginning of the PIMPLE loop. fvModels are specified in the optional constant/fvModels dictionary and backward-compatibility with fvOption is provided by reading the constant/fvOptions or system/fvOptions dictionary if present. The new fvConstraints is a general interface to optional numerical constraints applied to the matrices of the governing equations after construction and/or to the resulting field after solution. This system allows arbitrary changes to either the matrix or solution to ensure numerical or other constraints and hence violates consistency with the governing equations and conservation but it often useful to ensure numerical stability, particularly during the initial start-up period of a run. Complex manipulations can be achieved with fvConstraints, for example 'meanVelocityForce' used to maintain a specified mean velocity in a cyclic channel by manipulating the momentum matrix and the velocity solution. fvConstraints are specified in the optional system/fvConstraints dictionary and backward-compatibility with fvOption is provided by reading the constant/fvOptions or system/fvOptions dictionary if present. The separation of fvOptions into fvModels and fvConstraints provides a rational and consistent separation between physical and numerical models which is easier to understand and reason about, avoids the confusing issue of location of the controlling dictionary file, improves maintainability and easier to extend to handle current and future requirements for optional complex physical models and numerical constraints.
This commit is contained in:
@ -23,7 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "codedFvOptionTemplate.H"
|
||||
#include "codedFvModelTemplate.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
@ -75,24 +75,24 @@ extern "C"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(${typeName}FvOption${SourceType}, 0);
|
||||
defineTypeNameAndDebug(${typeName}FvModel${SourceType}, 0);
|
||||
|
||||
addRemovableToRunTimeSelectionTable
|
||||
(
|
||||
option,
|
||||
${typeName}FvOption${SourceType},
|
||||
${typeName}FvModel${SourceType},
|
||||
dictionary
|
||||
);
|
||||
|
||||
|
||||
const char* const ${typeName}FvOption${SourceType}::SHA1sum =
|
||||
const char* const ${typeName}FvModel${SourceType}::SHA1sum =
|
||||
"${SHA1sum}";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FvOption${SourceType}::
|
||||
${typeName}FvOption${SourceType}
|
||||
${typeName}FvModel${SourceType}::
|
||||
${typeName}FvModel${SourceType}
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
@ -112,8 +112,8 @@ ${typeName}FvOption${SourceType}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
${typeName}FvOption${SourceType}::
|
||||
~${typeName}FvOption${SourceType}()
|
||||
${typeName}FvModel${SourceType}::
|
||||
~${typeName}FvModel${SourceType}()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -124,7 +124,7 @@ ${typeName}FvOption${SourceType}::
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FvOption${SourceType}::addSup
|
||||
void ${typeName}FvModel${SourceType}::addSup
|
||||
(
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
const word& fieldName
|
||||
@ -132,7 +132,7 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::addSup()\n";
|
||||
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
@ -141,7 +141,7 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FvOption${SourceType}::addSup
|
||||
void ${typeName}FvModel${SourceType}::addSup
|
||||
(
|
||||
const volScalarField& rho,
|
||||
fvMatrix<${TemplateType}>& eqn,
|
||||
@ -150,7 +150,7 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::addSup()\n";
|
||||
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
@ -159,7 +159,7 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FvOption${SourceType}::addSup
|
||||
void ${typeName}FvModel${SourceType}::addSup
|
||||
(
|
||||
const volScalarField& alpha,
|
||||
const volScalarField& rho,
|
||||
@ -169,7 +169,7 @@ void ${typeName}FvOption${SourceType}::addSup
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
Info<<"${typeName}FvOption${SourceType}::addSup()\n";
|
||||
Info<<"${typeName}FvModel${SourceType}::addSup()\n";
|
||||
}
|
||||
|
||||
//{{{ begin code
|
||||
@ -25,12 +25,12 @@ Description
|
||||
Template for use with dynamic code generation of a source.
|
||||
|
||||
SourceFiles
|
||||
codedFvOptionTemplate.C
|
||||
codedFvModelTemplate.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef codedFvOptionTemplate_H
|
||||
#define codedFvOptionTemplate_H
|
||||
#ifndef codedFvModelTemplate_H
|
||||
#define codedFvModelTemplate_H
|
||||
|
||||
#include "cellSetOption.H"
|
||||
|
||||
@ -43,10 +43,10 @@ namespace fv
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
A templated CodedFvOption
|
||||
A templated CodedFvModel
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ${typeName}FvOption${SourceType}
|
||||
class ${typeName}FvModel${SourceType}
|
||||
:
|
||||
public cellSetOption
|
||||
{
|
||||
@ -62,7 +62,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
${typeName}FvOption${SourceType}
|
||||
${typeName}FvModel${SourceType}
|
||||
(
|
||||
const word& name,
|
||||
const word& modelType,
|
||||
@ -72,7 +72,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~${typeName}FvOption${SourceType}();
|
||||
virtual ~${typeName}FvModel${SourceType}();
|
||||
|
||||
|
||||
// Member Functions
|
||||
Reference in New Issue
Block a user