3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Loading...
Searching...
No Matches
freeflow/shallowwater/roughchannel/spatialparams.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 2 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_ROUGH_CHANNEL_SPATIAL_PARAMETERS_HH
25#define DUMUX_ROUGH_CHANNEL_SPATIAL_PARAMETERS_HH
26
32
33namespace Dumux {
34
40template<class GridGeometry, class Scalar, class VolumeVariables>
42: public FVSpatialParams<GridGeometry, Scalar,
43 RoughChannelSpatialParams<GridGeometry, Scalar, VolumeVariables>>
44{
47 using GridView = typename GridGeometry::GridView;
48 using FVElementGeometry = typename GridGeometry::LocalView;
49 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
50 using Element = typename GridView::template Codim<0>::Entity;
51 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
52
53public:
54 RoughChannelSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
55 : ParentType(gridGeometry)
56 {
57 gravity_ = getParam<Scalar>("Problem.Gravity");
58 bedSlope_ = getParam<Scalar>("Problem.BedSlope");
59 frictionLawType_ = getParam<std::string>("Problem.FrictionLaw");
61 }
62
67 {
68 if (frictionLawType_ == "Manning")
69 {
70 Scalar manningN = getParam<Scalar>("Problem.ManningN");
71 frictionLaw_ = std::make_unique<FrictionLawManning<VolumeVariables>>(gravity_, manningN);
72 }
73 else if (frictionLawType_ == "Nikuradse")
74 {
75 Scalar ks = getParam<Scalar>("Problem.Ks"); // equivalent sand roughness
76 frictionLaw_ = std::make_unique<FrictionLawNikuradse<VolumeVariables>>(ks);
77 }
78 else
79 {
80 std::cout<<"The FrictionLaw in params.input is unknown. Valid entries are 'Manning' and 'Nikuradse'!"<<std::endl;
81 }
82 }
83
88 Scalar gravity(const GlobalPosition& globalPos) const
89 {
90 return gravity_;
91 }
92
97 Scalar gravity() const
98 {
99 return gravity_;
100 }
101
108
109 const FrictionLaw<VolumeVariables>& frictionLaw(const Element& element,
110 const SubControlVolume& scv) const
111 {
112 return *frictionLaw_;
113 }
114
122 Scalar bedSurface(const Element& element,
123 const SubControlVolume& scv) const
124 {
125 // todo depends on index e.g. eIdx = scv.elementIndex();
126 return 10.0 - element.geometry().center()[0] * bedSlope_;
127 }
128
129private:
130 Scalar gravity_;
131 Scalar bedSlope_;
132 std::string frictionLawType_;
133 std::unique_ptr<FrictionLaw<VolumeVariables>> frictionLaw_;
134};
135
136} // end namespace Dumux
137
138#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Implementation of the abstract base class for friction laws.
Implementation of the friction law after Manning.
Implementation of the friction law after Nikuradse.
The base class for spatial parameters of multi-phase problems using a fully implicit discretization m...
T getParam(Args &&... args)
A free function to get a parameter from the parameter tree singleton.
Definition parameters.hh:428
make the local view function available whenever we use the grid geometry
Definition adapt.hh:29
Implementation of the abstract base class for friction laws.
Definition frictionlaw.hh:42
Scalar gravity() const
Define the gravitation.
Definition freeflow/shallowwater/roughchannel/spatialparams.hh:97
Scalar bedSurface(const Element &element, const SubControlVolume &scv) const
Define the bed surface.
Definition freeflow/shallowwater/roughchannel/spatialparams.hh:122
RoughChannelSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition freeflow/shallowwater/roughchannel/spatialparams.hh:54
Scalar gravity(const GlobalPosition &globalPos) const
Define the gravitation.
Definition freeflow/shallowwater/roughchannel/spatialparams.hh:88
const FrictionLaw< VolumeVariables > & frictionLaw(const Element &element, const SubControlVolume &scv) const
Get the frictionLaw.
Definition freeflow/shallowwater/roughchannel/spatialparams.hh:109
void initFrictionLaw()
Initialize the FrictionLaw.
Definition freeflow/shallowwater/roughchannel/spatialparams.hh:66