3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test_1pspatialparams.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 TEST_1P_SPATIALPARAMS_HH
25#define TEST_1P_SPATIALPARAMS_HH
26
28
29namespace Dumux
30{
31
36template<class TypeTag>
38{
40 using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
41 using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
42 using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
43 using IndexSet = typename GridView::IndexSet;
44 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
45 using CoordScalar = typename Grid::ctype;
46
47 enum
48 {dim=Grid::dimension, dimWorld=Grid::dimensionworld};
49 using Element = typename Grid::Traits::template Codim<0>::Entity;
50
51 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
52 using FieldMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
53
54public:
55
56 const FieldMatrix& intrinsicPermeability (const Element& element) const
57 {
58 return permeability_[indexSet_.index(element)];
59 }
60
61 double porosity(const Element& element) const
62 {
63 return 0.2;
64 }
65
66 void initialize(const double delta)
67 {
68 delta_ = delta;
69 permeability_.resize(gridView_.size(0));
70
71 for(const auto& element : elements(gridView_))
72 {
73 setPermeability_(permeability_[indexSet_.index(element)], element.geometry().center());
74 }
75
76 }
77
78 TestOnePSpatialParams(const Problem& problem)
79 : ParentType(problem), gridView_(problem.gridView()), indexSet_(problem.gridView().indexSet())
80 { }
81
82private:
83 void setPermeability_(FieldMatrix& perm, const GlobalPosition& globalPos) const
84 {
85 double rt = globalPos[0]*globalPos[0]+globalPos[1]*globalPos[1];
86 perm[0][0] = (delta_*globalPos[0]*globalPos[0] + globalPos[1]*globalPos[1])/rt;
87 perm[0][1] = -(1.0 - delta_)*globalPos[0]*globalPos[1]/rt;
88 perm[1][0] = perm[0][1];
89 perm[1][1] = (globalPos[0]*globalPos[0] + delta_*globalPos[1]*globalPos[1])/rt;
90 }
91
92 const GridView gridView_;
93 const IndexSet& indexSet_;
94 std::vector<FieldMatrix> permeability_;
95 double delta_;
96};
97
98} // end namespace
99#endif
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
The base class for spatial parameters of problems using the fv method.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
The base class for spatial parameters of problems using the fv method.
Definition: sequentialfv1p.hh:42
spatial parameters for the test problem for 1-p diffusion models.
Definition: test_1pspatialparams.hh:38
const FieldMatrix & intrinsicPermeability(const Element &element) const
Definition: test_1pspatialparams.hh:56
void initialize(const double delta)
Definition: test_1pspatialparams.hh:66
TestOnePSpatialParams(const Problem &problem)
Definition: test_1pspatialparams.hh:78
double porosity(const Element &element) const
Definition: test_1pspatialparams.hh:61