24#ifndef DUMUX_ROUGH_CHANNEL_TEST_PROBLEM_HH
25#define DUMUX_ROUGH_CHANNEL_TEST_PROBLEM_HH
27#include <dune/grid/yaspgrid.hh>
38template <
class TypeTag>
39class RoughChannelProblem;
49template<
class TypeTag>
50struct Grid<TypeTag, TTag::RoughChannel>
51{
using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; };
54template<
class TypeTag>
55struct Problem<TypeTag, TTag::RoughChannel>
59template<
class TypeTag>
66 using VolumeVariables =
typename ElementVolumeVariables::VolumeVariables;
71template<
class TypeTag>
73{
static constexpr bool value =
true; };
75template<
class TypeTag>
77{
static constexpr bool value =
false; };
111template <
class TypeTag>
123 using ElementFluxVariablesCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
124 using VolumeVariables =
typename ElementVolumeVariables::VolumeVariables;
126 using SubControlVolumeFace =
typename FVElementGeometry::SubControlVolumeFace;
128 using Element =
typename GridView::template Codim<0>::Entity;
129 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
131 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
137 name_ = getParam<std::string>(
"Problem.Name");
140 constManningN_ = getParam<Scalar>(
"Problem.ManningN");
141 bedSlope_ = getParam<Scalar>(
"Problem.BedSlope");
142 discharge_ = getParam<Scalar>(
"Problem.Discharge");
149 return exactWaterDepth_;
155 return exactVelocityX_;
165 return pow(abs(discharge)*manningN/sqrt(bedSlope), 0.6);
173 for (
const auto& element : elements(this->
gridGeometry().gridView()))
176 const Scalar u = abs(discharge_)/h;
178 const auto eIdx = this->
gridGeometry().elementMapper().index(element);
179 exactWaterDepth_[eIdx] = h;
180 exactVelocityX_[eIdx] = u;
194 const std::string&
name()
const
217 NumEqVector
source(
const Element& element,
218 const FVElementGeometry& fvGeometry,
219 const ElementVolumeVariables& elemVolVars,
220 const SubControlVolume &scv)
const
241 const FVElementGeometry& fvGeometry,
242 const ElementVolumeVariables& elemVolVars,
243 const SubControlVolume &scv)
const
247 const auto& volVars = elemVolVars[scv];
248 Dune::FieldVector<Scalar, 2> bottomShearStress = this->
spatialParams().frictionLaw(element, scv).shearStress(volVars);
272 BoundaryTypes bcTypes;
273 bcTypes.setAllNeumann();
290 const FVElementGeometry& fvGeometry,
291 const ElementVolumeVariables& elemVolVars,
292 const ElementFluxVariablesCache& elemFluxVarsCache,
293 const SubControlVolumeFace& scvf)
const
295 NeumannFluxes values(0.0);
297 const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
298 const auto& insideVolVars = elemVolVars[insideScv];
299 const auto& nxy = scvf.unitOuterNormal();
300 const auto gravity = this->
spatialParams().gravity(scvf.center());
301 std::array<Scalar, 3> boundaryStateVariables;
304 if (scvf.center()[0] < 0.0 + eps_)
307 insideVolVars.waterDepth(),
308 insideVolVars.velocity(0),
309 insideVolVars.velocity(1),
314 else if (scvf.center()[0] > 100.0 - eps_)
317 insideVolVars.waterDepth(),
318 insideVolVars.velocity(0),
319 insideVolVars.velocity(1),
326 boundaryStateVariables[0] = insideVolVars.waterDepth();
327 boundaryStateVariables[1] = -insideVolVars.velocity(0);
328 boundaryStateVariables[2] = -insideVolVars.velocity(1);
332 boundaryStateVariables[0],
333 insideVolVars.velocity(0),
334 boundaryStateVariables[1],
335 insideVolVars.velocity(1),
336 boundaryStateVariables[2],
337 insideVolVars.bedSurface(),
338 insideVolVars.bedSurface(),
342 values[Indices::massBalanceIdx] = riemannFlux[0];
343 values[Indices::velocityXIdx] = riemannFlux[1];
344 values[Indices::velocityYIdx] = riemannFlux[2];
366 PrimaryVariables values(0.0);
368 values[0] = hBoundary_;
369 values[1] = abs(discharge_)/hBoundary_;
378 std::vector<Scalar> exactWaterDepth_;
379 std::vector<Scalar> exactVelocityX_;
381 Scalar constManningN_;
384 static constexpr Scalar eps_ = 1.0e-6;
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Properties for all models using cell-centered finite volume scheme with TPFA.
Compute boundary conditions for the Riemann Solver.
std::array< Scalar, 3 > riemannProblem(const Scalar waterDepthLeft, const Scalar waterDepthRight, Scalar velocityXLeft, Scalar velocityXRight, Scalar velocityYLeft, Scalar velocityYRight, const Scalar bedSurfaceLeft, const Scalar bedSurfaceRight, const Scalar gravity, const GlobalPosition &nxy)
Construct Riemann Problem and solve it.
Definition: riemannproblem.hh:66
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
std::array< Scalar, 3 > fixedDischargeBoundary(const Scalar dischargeBoundary, const Scalar waterDepthInside, const Scalar velocityXInside, const Scalar velocityYInside, const Scalar gravity, const GlobalPosition &nxy)
Compute the outer cell state for a fixed discharge boundary.
Definition: boundaryfluxes.hh:86
std::array< Scalar, 3 > fixedWaterDepthBoundary(const Scalar waterDepthBoundary, const Scalar waterDepthInside, const Scalar velocityXInside, const Scalar velocityYInside, const Scalar gravity, const GlobalPosition &nxy)
Compute the outer cell state for fixed water depth boundary.
Definition: boundaryfluxes.hh:52
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Definition: common/properties.hh:169
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
The type of the spatial parameters object.
Definition: common/properties.hh:221
Shallow water problem base class.
Definition: dumux/freeflow/shallowwater/problem.hh:39
const SpatialParams & spatialParams() const
Returns the spatial parameters object.
Definition: dumux/freeflow/shallowwater/problem.hh:78
A simple flow in a rough channel with friction law after Manning.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:113
NeumannFluxes neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Specifies the neumann boundary.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:289
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:270
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluate the source term for all balance equations within a given sub-control-volume.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:217
const std::vector< Scalar > & getExactWaterDepth()
Get the analytical water depth.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:147
const std::string & name() const
The problem name.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:194
const std::vector< Scalar > & getExactVelocityX()
Get the analytical velocity.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:153
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluate the initial values for a control volume.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:364
NumEqVector bottomFrictionSource(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Compute the source term due to bottom friction.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:240
void updateAnalyticalSolution()
Udpate the analytical solution.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:169
RoughChannelProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:134
Scalar gauklerManningStrickler(Scalar discharge, Scalar manningN, Scalar bedSlope)
Calculate the water depth with Gaukler-Manning-Strickler.
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:159
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:46
std::tuple< ShallowWater, CCTpfaModel > InheritsFrom
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:46
Dune::YaspGrid< 2, Dune::TensorProductCoordinates< GetPropType< TypeTag, Properties::Scalar >, 2 > > type
Definition: test/freeflow/shallowwater/roughchannel/problem.hh:51
The spatial parameters class for the rough channel test.
Definition: freeflow/shallowwater/roughchannel/spatialparams.hh:44
A two-dimensional shallow water equations model The two-dimensonal shallow water equations (SWEs) can...
Definition of the spatial parameters for the MaxwellStefan problem.