version 3.8
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// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
14#ifndef DUMUX_MPNC_LOCAL_RESIDUAL_HH
15#define DUMUX_MPNC_LOCAL_RESIDUAL_HH
16
17#include <dune/istl/bvector.hh>
21
22namespace Dumux {
23
32template<class TypeTag>
34{
35 using ParentType = CompositionalLocalResidual<TypeTag>;
36 using Element = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView::template Codim<0>::Entity;
37 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
39 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
40 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
42 using Indices = typename ModelTraits::Indices;
43
44 enum {numPhases = ModelTraits::numFluidPhases()};
45 enum {phase0NcpIdx = Indices::phase0NcpIdx};
46
47public:
48 using ParentType::ParentType;
49
50 using typename ParentType::ElementResidualVector;
51
52 ElementResidualVector evalFluxAndSource(const Element& element,
53 const FVElementGeometry& fvGeometry,
54 const ElementVolumeVariables& elemVolVars,
55 const ElementFluxVariablesCache& elemFluxVarsCache,
56 const ElementBoundaryTypes &bcTypes) const
57 {
58 ElementResidualVector residual = ParentType::evalFluxAndSource(element, fvGeometry, elemVolVars, elemFluxVarsCache, bcTypes);
59
60 for (auto&& scv : scvs(fvGeometry))
61 {
62 // here we need to set the constraints of the mpnc model into the residual
63 for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
64 residual[scv.localDofIndex()][phase0NcpIdx + phaseIdx] = elemVolVars[scv].phaseNcp(phaseIdx);
65 }
66
67 return residual;
68 }
69};
70
71} // end namespace
72
73#endif
Element-wise calculation of the local residual for problems using compositional fully implicit model.
Definition: porousmediumflow/compositional/localresidual.hh:33
MpNc specific details needed to approximately calculate the local defect in the fully implicit scheme...
Definition: porousmediumflow/mpnc/localresidual.hh:34
ElementResidualVector evalFluxAndSource(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const ElementBoundaryTypes &bcTypes) const
Definition: porousmediumflow/mpnc/localresidual.hh:52
Defines all properties used in Dumux.
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
Definition: adapt.hh:17
Element-wise calculation of the local residual for problems using compositional fully implicit model.