Zero-equation turbulence problem base class. More...
#include <dumux/freeflow/rans/zeroeq/problem.hh>
Zero-equation turbulence problem base class.
This implements some base functionality for zero-equation models and a routine for the determining the eddy viscosity of the Baldwin-Lomax model.
Public Types | |
using | SpatialParams = GetPropType< TypeTag, Properties::SpatialParams > |
Public Member Functions | |
RANSProblemImpl (std::shared_ptr< const GridGeometry > gridGeometry, const std::string ¶mGroup="") | |
The constructor. More... | |
void | updateStaticWallProperties () |
Correct size of the static (solution independent) wall variables. More... | |
template<class SolutionVector > | |
void | updateDynamicWallProperties (const SolutionVector &curSol) |
Update the dynamic (solution dependent) relations to the walls. More... | |
void | updateBaldwinLomaxProperties () |
Update the relations and coefficients for the Baldwin-Lomax turbulence model. More... | |
std::string | eddyViscosityModel () const |
int | additionalRoughnessLength (const int elementIdx) const |
Scalar | kinematicEddyViscosity (const int elementIdx) const |
bool | useWallFunction (const Element &element, const SubControlVolumeFace &scvf, const int &eqIdx) const |
Returns whether a wall function should be used at a given face. More... | |
template<class ElementVolumeVariables , class ElementFaceVariables > | |
FacePrimaryVariables | wallFunction (const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf, const SubControlVolumeFace &lateralBoundaryFace) const |
Returns an additional wall function momentum flux. More... | |
template<class ElementVolumeVariables , class ElementFaceVariables > | |
CellCenterPrimaryVariables | wallFunction (const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf) const |
Returns an additional wall function flux for cell-centered quantities. More... | |
bool | isFlatWallBounded () const |
Returns whether a given sub control volume face is on a wall. More... | |
const Scalar | karmanConstant () const |
Returns the Karman constant. More... | |
const Scalar | betaOmega () const |
Returns the \( \beta_{\omega} \) constant. More... | |
Scalar | turbulentPrandtlNumber () const |
Return the turbulent Prandtl number \( [-] \) which is used to convert the eddy viscosity to an eddy thermal conductivity. More... | |
Scalar | turbulentSchmidtNumber () const |
Return the turbulent Schmidt number \( [-] \) which is used to convert the eddy viscosity to an eddy diffusivity. More... | |
int | wallNormalAxis (const int elementIdx) const |
int | flowDirectionAxis (const int elementIdx) const |
unsigned int | wallElementIndex (const int elementIdx) const |
Scalar | wallDistance (const int elementIdx) const |
GlobalPosition | cellCenter (const int elementIdx) const |
unsigned int | neighborIndex (const int elementIdx, const int axisIdx, const int sideIdx) const |
DimVector | ccVelocityVector (const int elementIdx) const |
Scalar | ccVelocity (const int elementIdx, const int axisIdx) const |
DimVector | velocityMaximum (const int elementIdx) const |
DimVector | velocityMinimum (const int elementIdx) const |
DimMatrix | velocityGradientTensor (const int elementIdx) const |
Scalar | velocityGradient (const int elementIdx, const int i, const int j) const |
Scalar | stressTensorScalarProduct (const int elementIdx) const |
Scalar | vorticityTensorScalarProduct (const int elementIdx) const |
Scalar | storedViscosity (const int elementIdx) const |
Scalar | storedDensity (const int elementIdx) const |
Scalar | kinematicViscosity (const int elementIdx) const |
const GravityVector & | gravity () const |
Returns the acceleration due to gravity. More... | |
bool | enableInertiaTerms () const |
Returns whether interia terms should be considered. More... | |
template<class SolutionVector , class G = GridGeometry> | |
std::enable_if< G::discMethod==DiscretizationMethods::staggered, void >::type | applyInitialFaceSolution (SolutionVector &sol, const SubControlVolumeFace &scvf, const PrimaryVariables &initSol) const |
Applies the initial face solution (velocities on the faces). Specialization for staggered grid discretization. More... | |
Scalar | pseudo3DWallFriction (const Scalar velocity, const Scalar viscosity, const Scalar height, const Scalar factor=8.0) const |
An additional drag term can be included as source term for the momentum balance to mimic 3D flow behavior in 2D: More... | |
template<class ElementVolumeVariables , class ElementFaceVariables , class G = GridGeometry> | |
std::enable_if< G::discMethod==DiscretizationMethods::staggered, Scalar >::type | pseudo3DWallFriction (const SubControlVolumeFace &scvf, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const Scalar height, const Scalar factor=8.0) const |
Convenience function for staggered grid implementation. More... | |
Scalar | permeability (const Element &element, const SubControlVolumeFace &scvf) const |
Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boundary condition. More... | |
Scalar | alphaBJ (const SubControlVolumeFace &scvf) const |
Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition. More... | |
Scalar | betaBJ (const Element &element, const SubControlVolumeFace &scvf, const GlobalPosition &tangentialVector) const |
Returns the beta value which is the alpha value divided by the square root of the (scalar-valued) interface permeability. More... | |
VelocityVector | porousMediumVelocity (const Element &element, const SubControlVolumeFace &scvf) const |
Returns the velocity in the porous medium (which is 0 by default according to Saffmann). More... | |
const Scalar | beaversJosephVelocity (const Element &element, const SubControlVolume &scv, const SubControlVolumeFace &ownScvf, const SubControlVolumeFace &faceOnPorousBoundary, const Scalar velocitySelf, const Scalar tangentialVelocityGradient) const |
Returns the slip velocity at a porous boundary based on the Beavers-Joseph(-Saffman) condition. More... | |
bool | isDirichletCell (const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv, int pvIdx) const |
Returns whether a fixed Dirichlet value shall be used at a given cell. More... | |
template<class ElementVolumeVariables , class ElementFaceVariables , class Entity > | |
NumEqVector | source (const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elementFaceVars, const Entity &e) const |
Evaluate the source term for all phases within a given sub-control-volume (-face). More... | |
NumEqVector | neumann (const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const SubControlVolumeFace &scvf) const |
Evaluate the boundary conditions for a neumann boundary segment. More... | |
template<class Entity > | |
PrimaryVariables | initial (const Entity &entity) const |
Evaluate the initial value for an element (for cell-centered primary variables) or face (for velocities) More... | |
template<class SolutionVector > | |
void | applyInitialSolution (SolutionVector &sol) const |
Applies the initial solution for all degrees of freedom of the grid. More... | |
template<class SolutionVector > | |
void | applyInitialCellCenterSolution (SolutionVector &sol, const SubControlVolume &scv, const PrimaryVariables &initSol) const |
Applies the initial cell center solution. More... | |
const SpatialParams & | spatialParams () const |
Return a reference to the underlying spatial parameters. More... | |
SpatialParams & | spatialParams () |
Return a reference to the underlying spatial parameters. More... | |
const std::string & | name () const |
The problem name. More... | |
void | setName (const std::string &newName) |
Set the problem name. More... | |
Public Attributes | |
bool | calledUpdateStaticWallProperties = false |
Boundary conditions and sources defining the problem | |
template<class ElementVolumeVariables > | |
NumEqVector | source (const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const |
Evaluate the source term for all phases within a given sub-control-volume. More... | |
template<class ElementVolumeVariables , class ElementFluxVariablesCache > | |
NumEqVector | neumann (const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const |
Evaluate the boundary conditions for a neumann boundary segment. More... | |
auto | boundaryTypes (const Element &element, const SubControlVolume &scv) const |
Specifies which kind of boundary condition should be used for which equation on a given boundary segment. More... | |
auto | boundaryTypes (const Element &element, const SubControlVolumeFace &scvf) const |
Specifies which kind of boundary condition should be used for which equation on a given boundary segment. More... | |
BoundaryTypes | boundaryTypesAtPos (const GlobalPosition &globalPos) const |
Specifies which kind of boundary condition should be used for which equation on a given boundary segment. More... | |
PrimaryVariables | dirichlet (const Element &element, const SubControlVolumeFace &scvf) const |
Evaluate the boundary conditions for a dirichlet control volume face. More... | |
PrimaryVariables | dirichlet (const Element &element, const SubControlVolume &scv) const |
Evaluate the boundary conditions for a dirichlet control volume. More... | |
PrimaryVariables | dirichletAtPos (const GlobalPosition &globalPos) const |
Evaluate the boundary conditions for a dirichlet control volume. More... | |
NumEqVector | neumannAtPos (const GlobalPosition &globalPos) const |
Evaluate the boundary conditions for a neumann boundary segment. More... | |
NumEqVector | sourceAtPos (const GlobalPosition &globalPos) const |
Evaluate the source term for all phases within a given sub-control-volume. More... | |
void | addPointSources (std::vector< PointSource > &pointSources) const |
Applies a vector of point sources. The point sources are possibly solution dependent. More... | |
template<class ElementVolumeVariables > | |
void | pointSource (PointSource &source, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const |
Evaluate the point sources (added by addPointSources) for all phases within a given sub-control-volume. More... | |
void | pointSourceAtPos (PointSource &pointSource, const GlobalPosition &globalPos) const |
Evaluate the point sources (added by addPointSources) for all phases within a given sub-control-volume. More... | |
template<class MatrixBlock , class VolumeVariables > | |
void | addSourceDerivatives (MatrixBlock &block, const Element &element, const FVElementGeometry &fvGeometry, const VolumeVariables &volVars, const SubControlVolume &scv) const |
Add source term derivative to the Jacobian. More... | |
template<class ElementVolumeVariables > | |
NumEqVector | scvPointSources (const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const |
Adds contribution of point sources for a specific sub control volume to the values. Caution: Only overload this method in the implementation if you know what you are doing. More... | |
void | computePointSourceMap () |
Compute the point source map, i.e. which scvs have point source contributions. More... | |
const PointSourceMap & | pointSourceMap () const |
Get the point source map. It stores the point sources per scv. More... | |
PrimaryVariables | initialAtPos (const GlobalPosition &globalPos) const |
Evaluate the initial value for a control volume. More... | |
const GridGeometry & | gridGeometry () const |
The finite volume grid geometry. More... | |
const std::string & | paramGroup () const |
The parameter group in which to retrieve runtime parameters. More... | |
static constexpr bool | enableInternalDirichletConstraints () |
If internal Dirichlet constraints are enabled Enables / disables internal (non-boundary) Dirichlet constraints. If this is overloaded to return true, the assembler calls problem.hasInternalDirichletConstraint(element, scv). This means you have to implement the following member function. More... | |
|
inherited |
|
inline |
The constructor.
gridGeometry | The finite volume grid geometry |
paramGroup | The parameter group in which to look for runtime parameters first (default is "") |
|
inline |
|
inlineinherited |
Applies a vector of point sources. The point sources are possibly solution dependent.
pointSources | A vector of PointSource s that contain source values for all phases and space positions. |
For this method, the values method of the point source has to return the absolute rate values in units \( [ \textnormal{unit of conserved quantity} / s ] \). Positive values mean that the conserved quantity is created, negative ones mean that it vanishes. E.g. for the mass balance that would be a mass rate in \( [ kg / s ] \).
|
inlineinherited |
Add source term derivative to the Jacobian.
|
inlineinherited |
Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition.
This member function must be overloaded in the problem implementation, if the BJS boundary condition is used.
|
inlineinherited |
Applies the initial cell center solution.
|
inlineinherited |
Applies the initial face solution (velocities on the faces). Specialization for staggered grid discretization.
|
inlineinherited |
Applies the initial solution for all degrees of freedom of the grid.
|
inlineinherited |
Returns the slip velocity at a porous boundary based on the Beavers-Joseph(-Saffman) condition.
|
inlineinherited |
Returns the beta value which is the alpha value divided by the square root of the (scalar-valued) interface permeability.
|
inlineinherited |
Returns the \( \beta_{\omega} \) constant.
|
inlineinherited |
Specifies which kind of boundary condition should be used for which equation on a given boundary segment.
element | The finite element |
scv | The sub control volume |
|
inlineinherited |
Specifies which kind of boundary condition should be used for which equation on a given boundary segment.
element | The finite element |
scvf | The sub control volume face |
|
inlineinherited |
Specifies which kind of boundary condition should be used for which equation on a given boundary segment.
globalPos | The position of the finite volume in global coordinates |
As a default, i.e. if the user's problem does not overload any boundaryTypes method set Dirichlet boundary conditions everywhere for all primary variables
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Compute the point source map, i.e. which scvs have point source contributions.
|
inlineinherited |
Evaluate the boundary conditions for a dirichlet control volume.
element | The finite element |
scv | the sub control volume |
|
inlineinherited |
Evaluate the boundary conditions for a dirichlet control volume face.
element | The finite element |
scvf | the sub control volume face |
|
inlineinherited |
Evaluate the boundary conditions for a dirichlet control volume.
globalPos | The position of the center of the finite volume for which the dirichlet condition ought to be set in global coordinates |
|
inline |
|
inlineinherited |
Returns whether interia terms should be considered.
|
inlinestaticconstexprinherited |
If internal Dirichlet constraints are enabled Enables / disables internal (non-boundary) Dirichlet constraints. If this is overloaded to return true, the assembler calls problem.hasInternalDirichletConstraint(element, scv). This means you have to implement the following member function.
bool hasInternalDirichletConstraint(const Element& element, const SubControlVolume& scv) const;
which returns an indexable container of booleans defining for each equation if the corresponding dof associated with the element/scv pair is constraint. If true is returned for a dof, the assembler calls problem.internalDirichlet(element, scv). This means you have to additionally implement the following member function
PrimaryVariables internalDirichlet(const Element& element, const SubControlVolume& scv) const;
which returns the enforced Dirichlet values the dof associated with the element/scv pair.
|
inlineinherited |
|
inlineinherited |
Returns the acceleration due to gravity.
If the Problem.EnableGravity
parameter is true, this means \(\boldsymbol{g} = ( 0,\dots,\ -9.81)^T \), else \(\boldsymbol{g} = ( 0,\dots, 0)^T \)
|
inlineinherited |
The finite volume grid geometry.
|
inlineinherited |
Evaluate the initial value for an element (for cell-centered primary variables) or face (for velocities)
entity | The dof entity (element or vertex) |
|
inlineinherited |
Evaluate the initial value for a control volume.
globalPos | The global position |
|
inlineinherited |
Returns whether a fixed Dirichlet value shall be used at a given cell.
element | The finite element |
fvGeometry | The finite-volume geometry |
scv | The sub control volume |
pvIdx | The primary variable index |
|
inlineinherited |
Returns whether a given sub control volume face is on a wall.
scvf | The sub control volume face. |
|
inlineinherited |
Returns the Karman constant.
|
inline |
|
inlineinherited |
|
inlineinherited |
The problem name.
This is used as a prefix for files generated by the simulation. It could be either overwritten by the problem files, or simply declared over the setName() function in the application file.
|
inlineinherited |
|
inlineinherited |
Evaluate the boundary conditions for a neumann boundary segment.
This is the method for the case where the Neumann condition is potentially solution dependent
element | The finite element |
fvGeometry | The finite-volume geometry |
elemVolVars | All volume variables for the element |
elemFaceVars | All face variables for the element |
scvf | The sub control volume face |
Negative values mean influx. E.g. for the mass balance that would the mass flux in \( [ kg / (m^2 \cdot s)] \).
|
inlineinherited |
Evaluate the boundary conditions for a neumann boundary segment.
This is the method for the case where the Neumann condition is potentially solution dependent
element | The finite element |
fvGeometry | The finite-volume geometry |
elemVolVars | All volume variables for the element |
elemFluxVarsCache | Flux variables caches for all faces in stencil |
scvf | The sub control volume face |
Negative values mean influx. E.g. for the mass balance that would be the mass flux in \( [ kg / (m^2 \cdot s)] \).
|
inlineinherited |
Evaluate the boundary conditions for a neumann boundary segment.
globalPos | The position of the boundary face's integration point in global coordinates |
Negative values mean influx. E.g. for the mass balance that would be the mass flux in \( [ kg / (m^2 \cdot s)] \).
As a default, i.e. if the user's problem does not overload any neumann method return no-flow Neumann boundary conditions at all Neumann boundaries
|
inlineinherited |
The parameter group in which to retrieve runtime parameters.
|
inlineinherited |
Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boundary condition.
This member function must be overloaded in the problem implementation, if the BJS boundary condition is used.
|
inlineinherited |
Evaluate the point sources (added by addPointSources) for all phases within a given sub-control-volume.
This is the method for the case where the point source is solution dependent
source | A single point source |
element | The finite element |
fvGeometry | The finite-volume geometry |
elemVolVars | All volume variables for the element |
scv | The sub control volume |
For this method, the values() method of the point sources returns the absolute conserved quantity rate generated or annihilate in units \( [ \textnormal{unit of conserved quantity} / s ] \). Positive values mean that the conserved quantity is created, negative ones mean that it vanishes. E.g. for the mass balance that would be a mass rate in \( [ kg / s ] \).
|
inlineinherited |
Evaluate the point sources (added by addPointSources) for all phases within a given sub-control-volume.
This is the method for the case where the point source is space dependent
pointSource | A single point source |
globalPos | The point source position in global coordinates |
For this method, the values() method of the point sources returns the absolute conserved quantity rate generated or annihilate in units \( [ \textnormal{unit of conserved quantity} / s ] \). Positive values mean that the conserved quantity is created, negative ones mean that it vanishes. E.g. for the mass balance that would be a mass rate in \( [ kg / s ] \).
|
inlineinherited |
Get the point source map. It stores the point sources per scv.
|
inlineinherited |
Returns the velocity in the porous medium (which is 0 by default according to Saffmann).
|
inlineinherited |
An additional drag term can be included as source term for the momentum balance to mimic 3D flow behavior in 2D:
\[ f_{drag} = -(8 \mu / h^2)v \]
Here, \(h\) corresponds to the extruded height that is bounded by the imaginary walls. See Flekkoy et al. (1995) [24]
A value of 8.0 is used as a default factor, corresponding to the velocity profile at the center plane of the virtual height (maximum velocity). Setting this value to 12.0 corresponds to an depth-averaged velocity (Venturoli and Boek, 2006) [74].
|
inlineinherited |
Convenience function for staggered grid implementation.
|
inlineinherited |
Adds contribution of point sources for a specific sub control volume to the values. Caution: Only overload this method in the implementation if you know what you are doing.
|
inlineinherited |
Set the problem name.
This static method sets the simulation name, which should be called before the application problem is declared! If not, the default name "sim" will be used.
newName | The problem's name |
|
inlineinherited |
Evaluate the source term for all phases within a given sub-control-volume (-face).
This is the method for the case where the source term is potentially solution dependent and requires some quantities that are specific to the fully-implicit method.
element | The finite element |
fvGeometry | The finite-volume geometry |
elemVolVars | All volume variables for the element |
elementFaceVars | All face variables for the element |
e | The geometrical entity on which the source shall be applied (scv or scvf) |
For this method, the return parameter stores the conserved quantity rate generated or annihilate per volume unit. Positive values mean that the conserved quantity is created, negative ones mean that it vanishes.
|
inlineinherited |
Evaluate the source term for all phases within a given sub-control-volume.
This is the method for the case where the source term is potentially solution dependent and requires some quantities that are specific to the fully-implicit method.
element | The finite element |
fvGeometry | The finite-volume geometry |
elemVolVars | All volume variables for the element |
scv | The sub control volume |
For this method, the return parameter stores the conserved quantity rate generated or annihilate per volume unit. Positive values mean that the conserved quantity is created, negative ones mean that it vanishes. E.g. for the mass balance that would be a mass rate in \( [ kg / (m^3 \cdot s)] \).
|
inlineinherited |
Evaluate the source term for all phases within a given sub-control-volume.
globalPos | The position of the center of the finite volume for which the source term ought to be specified in global coordinates |
For this method, the values parameter stores the conserved quantity rate generated or annihilate per volume unit. Positive values mean that the conserved quantity is created, negative ones mean that it vanishes. E.g. for the mass balance that would be a mass rate in \( [ kg / (m^3 \cdot s)] \).
As a default, i.e. if the user's problem does not overload any source method return 0.0 (no source terms)
|
inlineinherited |
Return a reference to the underlying spatial parameters.
|
inlineinherited |
Return a reference to the underlying spatial parameters.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Return the turbulent Prandtl number \( [-] \) which is used to convert the eddy viscosity to an eddy thermal conductivity.
|
inlineinherited |
Return the turbulent Schmidt number \( [-] \) which is used to convert the eddy viscosity to an eddy diffusivity.
|
inline |
Update the relations and coefficients for the Baldwin-Lomax turbulence model.
|
inline |
Update the dynamic (solution dependent) relations to the walls.
This calculates the roughness related properties
curSol | The solution vector. |
|
inline |
Correct size of the static (solution independent) wall variables.
|
inlineinherited |
Returns whether a wall function should be used at a given face.
element | The element. |
scvf | The sub control volume face. |
eqIdx | The equation index. |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Returns an additional wall function flux for cell-centered quantities.
|
inlineinherited |
Returns an additional wall function momentum flux.
|
inlineinherited |
|
inherited |