3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
rotationsymmetricscv.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 *****************************************************************************/
24#ifndef DUMUX_DISCRETIZATION_ROTATION_SYMMETRIC_SUBCONTROLVOLUME_HH
25#define DUMUX_DISCRETIZATION_ROTATION_SYMMETRIC_SUBCONTROLVOLUME_HH
26
27#include <cmath>
29
30namespace Dumux {
31
38template<class SubControlVolume, RotationPolicy rotationPolicy>
40
47template<class SubControlVolume>
49: public SubControlVolume
50{
51 using Scalar = typename SubControlVolume::Traits::Scalar;
52 static_assert(SubControlVolume::Traits::Geometry::mydimension == 1, "Rotation symmetric scv with disc policy only works with 1d grids!");
53 static_assert(SubControlVolume::Traits::Geometry::coorddimension == 1, "Rotation symmetric scv with disc policy only works with 1d grids!");
54public:
56 using SubControlVolume::SubControlVolume;
57
59 Scalar volume() const
60 {
61 using std::abs;
62 const auto radius0 = this->corner(0)[0];
63 const auto radius1 = this->corner(1)[0];
64 return M_PI*abs(radius1*radius1 - radius0*radius0);
65 }
66};
67
74template<class SubControlVolume>
76: public SubControlVolume
77{
78 using Scalar = typename SubControlVolume::Traits::Scalar;
79 static_assert(SubControlVolume::Traits::Geometry::mydimension == 1, "Rotation symmetric scv with ball policy only works with 1d grids!");
80 static_assert(SubControlVolume::Traits::Geometry::coorddimension == 1, "Rotation symmetric scv with ball policy only works with 1d grids!");
81public:
83 using SubControlVolume::SubControlVolume;
84
86 Scalar volume() const
87 {
88 using std::abs;
89 const auto radius0 = this->corner(0)[0];
90 const auto radius1 = this->corner(1)[0];
91 return 4.0/3.0*M_PI*abs(radius1*radius1*radius1 - radius0*radius0*radius0);
92 }
93};
94
102template<class SubControlVolume>
104: public SubControlVolume
105{
106 using Scalar = typename SubControlVolume::Traits::Scalar;
107 static_assert(SubControlVolume::Traits::Geometry::mydimension == 2, "Rotation symmetric scv with toroid policy only works with 2d grids!");
108 static_assert(SubControlVolume::Traits::Geometry::coorddimension == 2, "Rotation symmetric scv with toroid policy only works with 2d grids!");
109public:
111 using SubControlVolume::SubControlVolume;
112
114 Scalar volume() const
115 {
116 const auto radius = this->center()[0];
117 return SubControlVolume::volume()*2.0*M_PI*radius;
118 }
119};
120
121} // end namespace Dumux
122
123#endif
Rotation policy for defining rotational symmetric grid geometries.
RotationPolicy
Rotation policies.
Definition: rotationpolicy.hh:37
Definition: adapt.hh:29
Wrapper to make a sub control volume rotation symmetric.
Definition: rotationsymmetricscv.hh:39
Scalar volume() const
The volume of the sub control volume (difference between two disks)
Definition: rotationsymmetricscv.hh:59
Scalar volume() const
The volume of the sub control volume (difference between two balls)
Definition: rotationsymmetricscv.hh:86
Scalar volume() const
The volume of the sub control volume (Guldinus theorem)
Definition: rotationsymmetricscv.hh:114