3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
1p_richards/spatialparams_root.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 *****************************************************************************/
25#ifndef DUMUX_ROOT_SPATIALPARAMS_HH
26#define DUMUX_ROOT_SPATIALPARAMS_HH
27
32
33namespace Dumux {
34
39template<class GridGeometry, class Scalar>
40class RootSpatialParams
41: public FVSpatialParamsOneP<GridGeometry, Scalar, RootSpatialParams<GridGeometry, Scalar>>
42{
43 using ThisType = RootSpatialParams<GridGeometry, Scalar>;
44 using ParentType = FVSpatialParamsOneP<GridGeometry, Scalar, ThisType>;
45 using Grid = typename GridGeometry::Grid;
46 using GridView = typename GridGeometry::GridView;
47 using Element = typename GridView::template Codim<0>::Entity;
48 using SubControlVolume = typename GridGeometry::SubControlVolume;
49 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
50
52 enum DGFParamIndices {
53 orderIdx = 0,
54 rootIdIdx = 1,
55 surfaceIdx = 2,
56 massIdx = 3,
57 plantIdx = 5
58 };
59
60public:
61 // export permeability type
62 using PermeabilityType = Scalar;
63
64 RootSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry,
65 std::shared_ptr<const GridData<Grid>> gridData)
66 : ParentType(gridGeometry), gridData_(gridData)
67 {
68 porosity_ = getParam<Scalar>("Root.SpatialParams.Porosity", 0.4);
69 constantKx_ = getParam<Scalar>("SpatialParams.Kx", 5.0968e-17);
70 constantKr_ = getParam<Scalar>("SpatialParams.Kr", 2.04e-13);
71
72 const auto& gv = gridGeometry->gridView();
73 radii_.resize(gv.size(0));
74 for (const auto& element : elements(gv))
75 {
76 const auto eIdx = gv.indexSet().index(element);
77 auto level0element = element;
78 for(auto levelIdx = element.level(); levelIdx != 0; levelIdx--)
79 level0element = level0element.father();
80 const Scalar rootLength = element.geometry().volume();
81 const Scalar rootSurface = gridData_->parameters(level0element)[DGFParamIndices::surfaceIdx]/(1 << element.level());
82 radii_[eIdx] = rootSurface / rootLength / 2.0 / M_PI;
83 }
84 }
85
92 template<class ElementSolution>
93 PermeabilityType permeability(const Element& element,
94 const SubControlVolume& scv,
95 const ElementSolution& elemSol) const
96 {
97 const Scalar r = radius(this->gridGeometry().elementMapper().index(element));
98 return constantKx_ / (M_PI*r*r) * Components::SimpleH2O<Scalar>::liquidViscosity(285.15, 1e5);
99 }
100
106 Scalar radius(std::size_t eIdxGlobal) const
107 {
108 return radii_[eIdxGlobal];
109 }
110
116 Scalar Kr(std::size_t eIdxGlobal) const
117 {
118 return constantKr_;
119 }
120
121 const std::vector<Scalar>& getRadii() const
122 { return radii_; }
123
129 Scalar porosityAtPos(const GlobalPosition& globalPos) const
130 {
131 return porosity_;
132 }
133
134private:
135 std::shared_ptr<const GridData<Grid>> gridData_;
136 Scalar porosity_, constantKx_, constantKr_;
137 std::vector<Scalar> radii_;
138};
139
140} // end namespace Dumux
141
142#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Class for grid data attached to dgf or gmsh grid files.
A much simpler (and thus potentially less buggy) version of pure water.
The base class for spatial parameters of one-phase problems using a fully implicit discretization met...
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Class for grid data attached to dgf or gmsh grid files.
Definition: griddata.hh:66
A much simpler (and thus potentially less buggy) version of pure water.
Definition: simpleh2o.hh:51
The base class for spatial parameters of one-phase problems using a fully implicit discretization met...
Definition: fv1p.hh:77
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: fv1p.hh:334
const std::vector< Scalar > & getRadii() const
Definition: 1p_richards/spatialparams_root.hh:121
Scalar Kr(std::size_t eIdxGlobal) const
Returns the radial permeability.
Definition: 1p_richards/spatialparams_root.hh:116
Scalar PermeabilityType
Definition: 1p2c_richards2c/spatialparams_root.hh:62
Scalar radius(std::size_t eIdxGlobal) const
Returns the radius of the circular pipe for the current sub-control volume in [m].
Definition: 1p2c_richards2c/spatialparams_root.hh:106
Scalar porosityAtPos(const GlobalPosition &globalPos) const
Returns the porosity .
Definition: 1p_richards/spatialparams_root.hh:129
RootSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< const GridData< Grid > > gridData)
Definition: 1p_richards/spatialparams_root.hh:64
PermeabilityType permeability(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns the intrinsic permeability for the current sub-control volume in [m^2].
Definition: 1p_richards/spatialparams_root.hh:93