25#ifndef DUMUX_COMMON_FV_SPATIAL_PARAMS_HH
26#define DUMUX_COMMON_FV_SPATIAL_PARAMS_HH
30#include <dune/common/fvector.hh>
31#include <dune/common/exceptions.hh>
42template<
class GridGeometry,
47 using GridView =
typename GridGeometry::GridView;
48 using Element =
typename GridView::template Codim<0>::Entity;
49 using SubControlVolume =
typename GridGeometry::SubControlVolume;
51 static constexpr int dimWorld = GridView::dimensionworld;
53 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
54 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
61 if (getParam<bool>(
"Problem.EnableGravity"))
62 gravity_[dimWorld-1] = -9.81;
74 template<
class ElementSolution>
76 const SubControlVolume& scv,
77 const ElementSolution& elemSol)
const
80 return asImp_().extrusionFactorAtPos(scv.center());
96 template<
class ElementSolution>
98 const SubControlVolume& scv,
99 const ElementSolution& elemSol)
const
102 return asImp_().temperatureAtPos(scv.center());
111 static const Scalar defaultTemperature = [] ()
113 Scalar defaultTemp = 293.15;
114 if (!
hasParam(
"SpatialParams.Temperature"))
116 std::cout <<
" -- Using the default temperature of " << defaultTemp <<
" in the entire domain. "
117 <<
"Overload temperatureAtPos() in your spatial params class to define a custom temperature field."
118 <<
"Or provide the preferred domain temperature via the SpatialParams.Temperature parameter."
121 const Scalar
temperature = getParam<Scalar>(
"SpatialParams.Temperature", defaultTemp);
125 return defaultTemperature;
138 const GravityVector&
gravity(
const GlobalPosition& pos)
const
143 {
return *gridGeometry_; }
148 {
return *
static_cast<Implementation *
>(
this); }
152 {
return *
static_cast<const Implementation *
>(
this); }
155 std::shared_ptr<const GridGeometry> gridGeometry_;
156 GravityVector gravity_;
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
bool hasParam(const std::string ¶m)
Check whether a key exists in the parameter tree.
Definition: parameters.hh:169
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
The base class for spatial parameters used with finite-volume schemes.
Definition: common/fvspatialparams.hh:46
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Return the temperature in the domain at the given position.
Definition: common/fvspatialparams.hh:109
Implementation & asImp_()
Returns the implementation of the spatial parameters (static polymorphism)
Definition: common/fvspatialparams.hh:147
Scalar temperature(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Return the temperature in the given sub-control volume.
Definition: common/fvspatialparams.hh:97
Scalar extrusionFactorAtPos(const GlobalPosition &globalPos) const
Return how much the domain is extruded at a given position.
Definition: common/fvspatialparams.hh:86
const Implementation & asImp_() const
Returns the implementation of the spatial parameters (static polymorphism)
Definition: common/fvspatialparams.hh:151
FVSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: common/fvspatialparams.hh:57
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvspatialparams.hh:142
const GravityVector & gravity(const GlobalPosition &pos) const
Returns the acceleration due to gravity .
Definition: common/fvspatialparams.hh:138
Scalar extrusionFactor(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Return how much the domain is extruded at a given sub-control volume.
Definition: common/fvspatialparams.hh:75