15#ifndef DUMUX_DISCRETIZATION_EXTRUSION_HH
16#define DUMUX_DISCRETIZATION_EXTRUSION_HH
18#include <dune/common/std/type_traits.hh>
28 template<
class FVGeo,
class SCVF>
29 static constexpr auto area(
const FVGeo&,
const SCVF& scvf)
30 {
return scvf.area(); }
32 template<
class FVGeo,
class SCV>
33 static constexpr auto volume(
const FVGeo&,
const SCV& scv)
34 {
return scv.volume(); }
36 template<
class Geometry>
37 static constexpr auto integrationElement(
const Geometry& geo,
const typename Geometry::LocalCoordinate& x)
38 {
return geo.integrationElement(x); }
46template<
int radAx = 0>
55 template<
class FVGeo,
class SCVF>
56 static constexpr auto area(
const FVGeo&,
const SCVF& scvf)
58 static_assert(int(SCVF::Traits::Geometry::mydimension) == int(SCVF::Traits::Geometry::coorddimension-1),
"Area element to be called with a codim-1-entity!");
59 static_assert(SCVF::Traits::Geometry::coorddimension <= 2,
"Axis rotation only makes sense for geometries up to 2D!");
60 static_assert(
radialAxis < int(SCVF::Traits::Geometry::coorddimension),
"Illegal radial axis!");
63 return scvf.area()*2.0*M_PI*scvf.center()[
radialAxis];
70 template<
class FVGeo,
class SCV>
71 static constexpr auto volume(
const FVGeo&,
const SCV& scv)
73 static_assert(int(SCV::Traits::Geometry::mydimension) == int(SCV::Traits::Geometry::coorddimension),
"Volume element to be called with a codim-0-entity!");
74 static_assert(SCV::Traits::Geometry::coorddimension <= 2,
"Axis rotation only makes sense for geometries up to 2D!");
75 static_assert(
radialAxis < int(SCV::Traits::Geometry::coorddimension),
"Illegal radial axis!");
78 return scv.volume()*2.0*M_PI*scv.center()[
radialAxis];
84 template<
class Geometry>
85 static constexpr auto integrationElement(
const Geometry& geo,
const typename Geometry::LocalCoordinate& x)
87 static_assert(Geometry::coorddimension <= 2,
"Axis rotation only makes sense for geometries up to 2D!");
88 static_assert(
radialAxis < int(Geometry::coorddimension),
"Illegal radial axis!");
91 return geo.integrationElement(x)*2.0*M_PI*geo.global(x)[
radialAxis];
105 template<
class FVGeo,
class SCVF>
106 static constexpr auto area(
const FVGeo&,
const SCVF& scvf)
108 static_assert(int(SCVF::Traits::Geometry::mydimension) == int(SCVF::Traits::Geometry::coorddimension-1),
"Area element to be called with a codim-1-entity!");
109 static_assert(SCVF::Traits::Geometry::coorddimension == 1,
"Spherical rotation only makes sense for 1D geometries!");
112 const auto radius = scvf.center()[0];
113 return 4.0*M_PI*radius*radius;
120 template<
class FVGeo,
class SCV>
121 static constexpr auto volume(
const FVGeo& fvGeometry,
const SCV& scv)
123 static_assert(int(SCV::Traits::Geometry::mydimension) == int(SCV::Traits::Geometry::coorddimension),
"Volume element to be called with a codim-0-entity!");
124 static_assert(SCV::Traits::Geometry::coorddimension == 1,
"Spherical rotation only makes sense for 1D geometries!");
127 const auto geo = fvGeometry.geometry(scv);
128 const auto radius0 = geo.corner(0)[0];
129 const auto radius1 = geo.corner(1)[0];
131 return 4.0/3.0*M_PI*abs(radius1*radius1*radius1 - radius0*radius0*radius0);
137 template<
class Geometry>
138 static constexpr auto integrationElement(
const Geometry& geo,
const typename Geometry::LocalCoordinate& x)
140 static_assert(Geometry::coorddimension == 1,
"Spherical rotation only makes sense for 1D geometries!");
144 const auto radius = geo.global(x)[0];
145 return geo.integrationElement(x)*4.0*M_PI*radius*radius;
157 using E =
typename G::Extrusion;
159 using type =
typename Dune::Std::detected_or<NoExtrusion, E, T>::type;
177template<
int radialAxis>
178inline constexpr bool isRotationalExtrusion<RotationalExtrusion<radialAxis>> =
true;
Traits extracting the public Extrusion type from T Defaults to NoExtrusion if no such type is found.
Definition: extrusion.hh:155
typename Dune::Std::detected_or< NoExtrusion, E, T >::type type
Definition: extrusion.hh:159
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:166
constexpr bool isRotationalExtrusion
Convenience trait to check whether the extrusion is rotational.
Definition: extrusion.hh:172
Default implementation that performs no extrusion (extrusion with identity)
Definition: extrusion.hh:27
static constexpr auto area(const FVGeo &, const SCVF &scvf)
Definition: extrusion.hh:29
static constexpr auto integrationElement(const Geometry &geo, const typename Geometry::LocalCoordinate &x)
Definition: extrusion.hh:37
static constexpr auto volume(const FVGeo &, const SCV &scv)
Definition: extrusion.hh:33
Rotation symmetric extrusion policy for rotating about an external axis.
Definition: extrusion.hh:48
static constexpr auto volume(const FVGeo &, const SCV &scv)
Transformed sub-control-volume volume.
Definition: extrusion.hh:71
static constexpr int radialAxis
Definition: extrusion.hh:49
static constexpr auto integrationElement(const Geometry &geo, const typename Geometry::LocalCoordinate &x)
Integration element for quadrature rules on the reference element.
Definition: extrusion.hh:85
static constexpr auto area(const FVGeo &, const SCVF &scvf)
Transformed sub-control-volume face area.
Definition: extrusion.hh:56
Rotation symmetric extrusion policy for spherical rotation.
Definition: extrusion.hh:100
static constexpr auto area(const FVGeo &, const SCVF &scvf)
Transformed sub-control-volume face area.
Definition: extrusion.hh:106
static constexpr auto integrationElement(const Geometry &geo, const typename Geometry::LocalCoordinate &x)
Integration element for quadrature rules on the reference element.
Definition: extrusion.hh:138
static constexpr auto volume(const FVGeo &fvGeometry, const SCV &scv)
Transformed sub-control-volume volume.
Definition: extrusion.hh:121