3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
porousmediumflow/mpnc/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 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 *****************************************************************************/
26#ifndef DUMUX_MPNC_LOCAL_RESIDUAL_HH
27#define DUMUX_MPNC_LOCAL_RESIDUAL_HH
28
29#include <dune/istl/bvector.hh>
33
34namespace Dumux {
35
44template<class TypeTag>
46{
47 using ParentType = CompositionalLocalResidual<TypeTag>;
48 using Element = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView::template Codim<0>::Entity;
49 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
51 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
52 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
54 using Indices = typename ModelTraits::Indices;
55
56 enum {numPhases = ModelTraits::numFluidPhases()};
57 enum {phase0NcpIdx = Indices::phase0NcpIdx};
58
59public:
60 using ParentType::ParentType;
61
62 using typename ParentType::ElementResidualVector;
63
64 ElementResidualVector evalFluxAndSource(const Element& element,
65 const FVElementGeometry& fvGeometry,
66 const ElementVolumeVariables& elemVolVars,
67 const ElementFluxVariablesCache& elemFluxVarsCache,
68 const ElementBoundaryTypes &bcTypes) const
69 {
70 ElementResidualVector residual = ParentType::evalFluxAndSource(element, fvGeometry, elemVolVars, elemFluxVarsCache, bcTypes);
71
72 for (auto&& scv : scvs(fvGeometry))
73 {
74 // here we need to set the constraints of the mpnc model into the residual
75 for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
76 residual[scv.localDofIndex()][phase0NcpIdx + phaseIdx] = elemVolVars[scv].phaseNcp(phaseIdx);
77 }
78
79 return residual;
80 }
81};
82
83} // end namespace
84
85#endif
The available discretization methods in Dumux.
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 local residual for problems using compositional fully implicit model.
Definition: porousmediumflow/compositional/localresidual.hh:43
MpNc specific details needed to approximately calculate the local defect in the fully implicit scheme...
Definition: porousmediumflow/mpnc/localresidual.hh:46
ElementResidualVector evalFluxAndSource(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const ElementBoundaryTypes &bcTypes) const
Definition: porousmediumflow/mpnc/localresidual.hh:64
Declares all properties used in Dumux.
Element-wise calculation of the local residual for problems using compositional fully implicit model.