3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
extrusion.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
27#ifndef DUMUX_DISCRETIZATION_EXTRUSION_HH
28#define DUMUX_DISCRETIZATION_EXTRUSION_HH
29
30#include <dune/common/std/type_traits.hh>
32
33namespace Dumux {
34
40{
41 template<class SCVF>
42 [[deprecated("Will be removed after 3.6. Use area(fvGeometry, scvf)")]]
43 static constexpr auto area(const SCVF& scvf)
44 { return scvf.area(); }
45
46 template<class SCV>
47 [[deprecated("Will be removed after 3.6. Use volume(fvGeometry, scv)")]]
48 static constexpr auto volume(const SCV& scv)
49 { return scv.volume(); }
50
51 template<class FVGeo, class SCVF>
52 static constexpr auto area(const FVGeo&, const SCVF& scvf)
53 { return scvf.area(); }
54
55 template<class FVGeo, class SCV>
56 static constexpr auto volume(const FVGeo&, const SCV& scv)
57 { return scv.volume(); }
58
59 template<class Geometry>
60 static constexpr auto integrationElement(const Geometry& geo, const typename Geometry::LocalCoordinate& x)
61 { return geo.integrationElement(x); }
62};
63
69template<int radAx = 0>
71{
72 static constexpr int radialAxis = radAx;
73
78 template<class SCVF>
79 [[deprecated("Will be removed after 3.6. Use area(fvGeometry, scvf)")]]
80 static constexpr auto area(const SCVF& scvf)
81 {
82 static_assert(int(SCVF::Traits::Geometry::mydimension) == int(SCVF::Traits::Geometry::coorddimension-1), "Area element to be called with a codim-1-entity!");
83 static_assert(SCVF::Traits::Geometry::coorddimension <= 2, "Axis rotation only makes sense for geometries up to 2D!");
84 static_assert(radialAxis < int(SCVF::Traits::Geometry::coorddimension), "Illegal radial axis!");
85
86 // Guldinus theorem
87 return scvf.area()*2.0*M_PI*scvf.center()[radialAxis];
88 }
89
90 template<class FVGeo, class SCVF>
91 static constexpr auto area(const FVGeo&, const SCVF& scvf)
92 {
93 static_assert(int(SCVF::Traits::Geometry::mydimension) == int(SCVF::Traits::Geometry::coorddimension-1), "Area element to be called with a codim-1-entity!");
94 static_assert(SCVF::Traits::Geometry::coorddimension <= 2, "Axis rotation only makes sense for geometries up to 2D!");
95 static_assert(radialAxis < int(SCVF::Traits::Geometry::coorddimension), "Illegal radial axis!");
96
97 // Guldinus theorem
98 return scvf.area()*2.0*M_PI*scvf.center()[radialAxis];
99 }
100
105 template<class SCV>
106 [[deprecated("Will be removed after 3.6. Use volume(fvGeometry, scv)")]]
107 static constexpr auto volume(const SCV& scv)
108 {
109 static_assert(int(SCV::Traits::Geometry::mydimension) == int(SCV::Traits::Geometry::coorddimension), "Volume element to be called with a codim-0-entity!");
110 static_assert(SCV::Traits::Geometry::coorddimension <= 2, "Axis rotation only makes sense for geometries up to 2D!");
111 static_assert(radialAxis < int(SCV::Traits::Geometry::coorddimension), "Illegal radial axis!");
112
113 // Guldinus theorem
114 return scv.volume()*2.0*M_PI*scv.center()[radialAxis];
115 }
116
117 template<class FVGeo, class SCV>
118 static constexpr auto volume(const FVGeo&, const SCV& scv)
119 {
120 static_assert(int(SCV::Traits::Geometry::mydimension) == int(SCV::Traits::Geometry::coorddimension), "Volume element to be called with a codim-0-entity!");
121 static_assert(SCV::Traits::Geometry::coorddimension <= 2, "Axis rotation only makes sense for geometries up to 2D!");
122 static_assert(radialAxis < int(SCV::Traits::Geometry::coorddimension), "Illegal radial axis!");
123
124 // Guldinus theorem
125 return scv.volume()*2.0*M_PI*scv.center()[radialAxis];
126 }
127
131 template<class Geometry>
132 static constexpr auto integrationElement(const Geometry& geo, const typename Geometry::LocalCoordinate& x)
133 {
134 static_assert(Geometry::coorddimension <= 2, "Axis rotation only makes sense for geometries up to 2D!");
135 static_assert(radialAxis < int(Geometry::coorddimension), "Illegal radial axis!");
136
137 // Multiply with the polar extrusion factor (2*pi) and the determinant of the transformation Jacobian (radius)
138 return geo.integrationElement(x)*2.0*M_PI*geo.global(x)[radialAxis];
139 }
140};
141
147{
152 template<class SCVF>
153 [[deprecated("Will be removed after 3.6. Use area(fvGeometry, scvf)")]]
154 static constexpr auto area(const SCVF& scvf)
155 {
156 static_assert(int(SCVF::Traits::Geometry::mydimension) == int(SCVF::Traits::Geometry::coorddimension-1), "Area element to be called with a codim-1-entity!");
157 static_assert(SCVF::Traits::Geometry::coorddimension == 1, "Spherical rotation only makes sense for 1D geometries!");
158
159 // sphere surface area
160 const auto radius = scvf.center()[0];
161 return 4.0*M_PI*radius*radius;
162 }
163
164 template<class FVGeo, class SCVF>
165 static constexpr auto area(const FVGeo&, const SCVF& scvf)
166 {
167 static_assert(int(SCVF::Traits::Geometry::mydimension) == int(SCVF::Traits::Geometry::coorddimension-1), "Area element to be called with a codim-1-entity!");
168 static_assert(SCVF::Traits::Geometry::coorddimension == 1, "Spherical rotation only makes sense for 1D geometries!");
169
170 // sphere surface area
171 const auto radius = scvf.center()[0];
172 return 4.0*M_PI*radius*radius;
173 }
174
179 template<class SCV>
180 [[deprecated("Will be removed after 3.6. Use volume(fvGeometry, scv)")]]
181 static constexpr auto volume(const SCV& scv)
182 {
183 static_assert(int(SCV::Traits::Geometry::mydimension) == int(SCV::Traits::Geometry::coorddimension), "Volume element to be called with a codim-0-entity!");
184 static_assert(SCV::Traits::Geometry::coorddimension == 1, "Spherical rotation only makes sense for 1D geometries!");
185
186 // subtract two balls
187 const auto radius0 = scv.corner(0)[0];
188 const auto radius1 = scv.corner(1)[0];
189 using std::abs;
190 return 4.0/3.0*M_PI*abs(radius1*radius1*radius1 - radius0*radius0*radius0);
191 }
192
193 template<class FVGeo, class SCV>
194 static constexpr auto volume(const FVGeo& fvGeometry, const SCV& scv)
195 {
196 static_assert(int(SCV::Traits::Geometry::mydimension) == int(SCV::Traits::Geometry::coorddimension), "Volume element to be called with a codim-0-entity!");
197 static_assert(SCV::Traits::Geometry::coorddimension == 1, "Spherical rotation only makes sense for 1D geometries!");
198
199 // subtract two balls
200 if constexpr (Deprecated::hasSCVGeometryInterface<FVGeo>())
201 {
202 const auto geo = fvGeometry.geometry(scv);
203 const auto radius0 = geo.corner(0)[0];
204 const auto radius1 = geo.corner(1)[0];
205 using std::abs;
206 return 4.0/3.0*M_PI*abs(radius1*radius1*radius1 - radius0*radius0*radius0);
207 }
208 else
209 {
210 // fall-back version for old interface (may trigger deprecation warning)
211 const auto geo = scv.geometry();
212 const auto radius0 = geo.corner(0)[0];
213 const auto radius1 = geo.corner(1)[0];
214 using std::abs;
215 return 4.0/3.0*M_PI*abs(radius1*radius1*radius1 - radius0*radius0*radius0);
216 }
217 }
218
222 template<class Geometry>
223 static constexpr auto integrationElement(const Geometry& geo, const typename Geometry::LocalCoordinate& x)
224 {
225 static_assert(Geometry::coorddimension == 1, "Spherical rotation only makes sense for 1D geometries!");
226
227 // Multiply with the constant spherical extrusion factor (int_0^2pi int_0^pi sin(phi) dphi dtheta = 4pi)
228 // and the remaining (radius-dependent) part of determinant of the transformation Jacobian (radius*radius)
229 const auto radius = geo.global(x)[0];
230 return geo.integrationElement(x)*4.0*M_PI*radius*radius;
231 }
232};
233
238template<class T>
240{
241 template<class G>
242 using E = typename G::Extrusion;
243public:
244 using type = typename Dune::Std::detected_or<NoExtrusion, E, T>::type;
245};
246
250template<class T>
252
256template<class T>
257inline constexpr bool isRotationalExtrusion = false;
258
262template<int radialAxis>
263inline constexpr bool isRotationalExtrusion<RotationalExtrusion<radialAxis>> = true;
264
265} // end namespace Dumux
266
267#endif
Helpers for deprecation.
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename Extrusion< T >::type Extrusion_t
Convenience alias for obtaining the extrusion type.
Definition: extrusion.hh:251
constexpr bool isRotationalExtrusion
Convenience trait to check whether the extrusion is rotational.
Definition: extrusion.hh:257
Default implementation that performs no extrusion (extrusion with identity)
Definition: extrusion.hh:40
static constexpr auto area(const FVGeo &, const SCVF &scvf)
Definition: extrusion.hh:52
static constexpr auto volume(const SCV &scv)
Definition: extrusion.hh:48
static constexpr auto integrationElement(const Geometry &geo, const typename Geometry::LocalCoordinate &x)
Definition: extrusion.hh:60
static constexpr auto area(const SCVF &scvf)
Definition: extrusion.hh:43
static constexpr auto volume(const FVGeo &, const SCV &scv)
Definition: extrusion.hh:56
Rotation symmetric extrusion policy for rotating about an external axis.
Definition: extrusion.hh:71
static constexpr auto volume(const FVGeo &, const SCV &scv)
Definition: extrusion.hh:118
static constexpr auto volume(const SCV &scv)
Transformed sub-control-volume volume.
Definition: extrusion.hh:107
static constexpr int radialAxis
Definition: extrusion.hh:72
static constexpr auto area(const SCVF &scvf)
Transformed sub-control-volume face area.
Definition: extrusion.hh:80
static constexpr auto integrationElement(const Geometry &geo, const typename Geometry::LocalCoordinate &x)
Integration element for quadrature rules on the reference element.
Definition: extrusion.hh:132
static constexpr auto area(const FVGeo &, const SCVF &scvf)
Definition: extrusion.hh:91
Rotation symmetric extrusion policy for spherical rotation.
Definition: extrusion.hh:147
static constexpr auto area(const SCVF &scvf)
Transformed sub-control-volume face area.
Definition: extrusion.hh:154
static constexpr auto area(const FVGeo &, const SCVF &scvf)
Definition: extrusion.hh:165
static constexpr auto integrationElement(const Geometry &geo, const typename Geometry::LocalCoordinate &x)
Integration element for quadrature rules on the reference element.
Definition: extrusion.hh:223
static constexpr auto volume(const SCV &scv)
Transformed sub-control-volume volume.
Definition: extrusion.hh:181
static constexpr auto volume(const FVGeo &fvGeometry, const SCV &scv)
Definition: extrusion.hh:194
Traits extracting the public Extrusion type from T Defaults to NoExtrusion if no such type is found.
Definition: extrusion.hh:240
typename Dune::Std::detected_or< NoExtrusion, E, T >::type type
Definition: extrusion.hh:244