subcontrolvolumeface.hh 4.99 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
 *   See the file COPYING for full copying permissions.                      *
 *                                                                           *
 *   This program is free software: you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published by    *
 *   the Free Software Foundation, either version 3 of the License, or       *
 *   (at your option) any later version.                                     *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
 *   GNU General Public License for more details.                            *
 *                                                                           *
 *   You should have received a copy of the GNU General Public License       *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 *****************************************************************************/
/*!
 * \file
21
 * \ingroup PoreNetworkDiscretization
22
23
24
25
26
27
28
29
30
31
32
 * \brief Base class for a sub control volume face
 */
#ifndef DUMUX_DISCRETIZATION_PNM_SUBCONTROLVOLUMEFACE_HH
#define DUMUX_DISCRETIZATION_PNM_SUBCONTROLVOLUMEFACE_HH

#include <dumux/common/indextraits.hh>
#include <dumux/discretization/subcontrolvolumefacebase.hh>

namespace Dumux::PoreNetwork {

/*!
33
 * \ingroup PoreNetworkDiscretization
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
 * \brief Default traits class
 * \tparam GV the type of the grid view
 */
template<class GridView>
struct PNMDefaultScvfGeometryTraits
{
    using Grid = typename GridView::Grid;
    static constexpr int dim = Grid::dimension;
    static constexpr int dimWorld = Grid::dimensionworld;

    using GridIndexType = typename IndexTraits<GridView>::GridIndex;
    using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;

    using Scalar = typename Grid::ctype;
    using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
    using CornerStorage = std::array<Dune::FieldVector<Scalar, dimWorld>, 1>;
};

/*!
 * \ingroup PoreNetworkDiscretization
 * \brief Class for a sub control volume face for porenetworks
 * \tparam GV the type of the grid view
 * \tparam T the scvf geometry traits
 */
template<class GV,
         class T = PNMDefaultScvfGeometryTraits<GV> >
class PNMSubControlVolumeFace
: public Dumux::SubControlVolumeFaceBase<PNMSubControlVolumeFace<GV, T>, T>
{
    using ThisType = PNMSubControlVolumeFace<GV, T>;
    using ParentType = Dumux::SubControlVolumeFaceBase<ThisType, T>;
    using GridIndexType = typename T::GridIndexType;
    using LocalIndexType = typename T::LocalIndexType;
    using Scalar = typename T::Scalar;

public:
    //! export the type used for global coordinates
    using GlobalPosition = typename T::GlobalPosition;
    //! state the traits public and thus export all types
    using Traits = T;

    //! The default constructor
    PNMSubControlVolumeFace() = default;

    //! Constructor for inner scvfs
    PNMSubControlVolumeFace(const GlobalPosition& center,
                            const GlobalPosition& unitOuterNormal,
                            const Scalar& area,
                            GridIndexType scvfIndex,
83
                            std::array<LocalIndexType, 2>&& scvIndices)
84
85
86
87
    : center_(center),
      unitOuterNormal_(unitOuterNormal),
      area_(area),
      scvfIndex_(scvfIndex),
88
      scvIndices_(std::move(scvIndices))
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
    {}

    //! The center of the sub control volume face
    const GlobalPosition& center() const
    { return center_; }

    //! The integration point for flux evaluations in global coordinates
    const GlobalPosition& ipGlobal() const
    { return center_; }

    //! The area of the sub control volume face
    Scalar area() const
    { return area_; }

    //! We assume to always have a pore body and not a pore throat at the boundary
    bool boundary() const
    { return false; }

    //! The unit outer normal of the sub control volume face
    const GlobalPosition& unitOuterNormal() const
    { return unitOuterNormal_; }

    //! Index of the inside sub control volume for spatial param evaluation
    LocalIndexType insideScvIdx() const
    { return scvIndices_[0]; }

    //! Index of the outside sub control volume for spatial param evaluation
    // This results in undefined behaviour if boundary is true
    LocalIndexType outsideScvIdx() const
    { return scvIndices_[1]; }

    //! The local index of this sub control volume face
    GridIndexType index() const
    { return scvfIndex_; }

private:
    GlobalPosition center_;
    GlobalPosition unitOuterNormal_;
    Scalar area_;
    GridIndexType scvfIndex_;
    std::array<LocalIndexType, 2> scvIndices_;
};

} // end namespace Dumux::PoreNetwork

#endif