3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
freeflow/shallowwater/localresidual.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_FREEFLOW_SHALLOW_WATER_LOCAL_RESIDUAL_HH
25#define DUMUX_FREEFLOW_SHALLOW_WATER_LOCAL_RESIDUAL_HH
26
28
29namespace Dumux{
30
35template<class TypeTag>
37: public GetPropType<TypeTag, Properties::BaseLocalResidual>
38{
44 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
45 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
46 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
47 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
48 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
49 using Element = typename GridView::template Codim<0>::Entity;
52
53public:
54
55 using ParentType::ParentType;
56
68 NumEqVector computeStorage(const Problem& problem,
69 const SubControlVolume& scv,
70 const VolumeVariables& volVars) const
71 {
72 // partial time derivative of the phase mass
73 NumEqVector storage(0.0);
74 storage[Indices::massBalanceIdx] = volVars.waterDepth();
75 storage[Indices::momentumXBalanceIdx] = volVars.waterDepth() * volVars.velocity(0);
76 storage[Indices::momentumYBalanceIdx] = volVars.waterDepth() * volVars.velocity(1);
77 return storage;
78 }
79
90 NumEqVector computeFlux(const Problem& problem,
91 const Element& element,
92 const FVElementGeometry& fvGeometry,
93 const ElementVolumeVariables& elemVolVars,
94 const SubControlVolumeFace& scvf,
95 const ElementFluxVariablesCache& elemFluxVarsCache) const
96 {
97 NumEqVector flux(0.0);
98 FluxVariables fluxVars;
99 flux += fluxVars.advectiveFlux(problem, element, fvGeometry, elemVolVars, scvf);
100 flux += fluxVars.diffusiveFlux(problem, element, fvGeometry, elemVolVars, scvf);
101 return flux;
102 }
103};
104} // end namespace Dumux
105
106#endif
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
Element-wise calculation of the residual for the shallow water equations.
Definition: freeflow/shallowwater/localresidual.hh:38
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluate the mass flux over a face of a sub control volume.
Definition: freeflow/shallowwater/localresidual.hh:90
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluate the rate of change of all conservation quantites (e.g. mass, momentum) within a sub-control ...
Definition: freeflow/shallowwater/localresidual.hh:68
Declares all properties used in Dumux.