Line | Branch | Exec | Source |
---|---|---|---|
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 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup MPNCModel | ||
10 | * \brief MpNc specific details needed to approximately calculate the local | ||
11 | * defect in the fully implicit scheme. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_MPNC_LOCAL_RESIDUAL_HH | ||
15 | #define DUMUX_MPNC_LOCAL_RESIDUAL_HH | ||
16 | |||
17 | #include <dune/istl/bvector.hh> | ||
18 | #include <dumux/common/properties.hh> | ||
19 | #include <dumux/discretization/method.hh> | ||
20 | #include <dumux/porousmediumflow/compositional/localresidual.hh> | ||
21 | |||
22 | namespace Dumux { | ||
23 | |||
24 | /*! | ||
25 | * \ingroup MPNCModel | ||
26 | * \brief MpNc specific details needed to approximately calculate the local | ||
27 | * defect in the fully implicit scheme. | ||
28 | * | ||
29 | * This class is used to fill the gaps in ImplicitLocalResidual for the | ||
30 | * MpNc flow. | ||
31 | */ | ||
32 | template<class TypeTag> | ||
33 | class MPNCLocalResidual : public CompositionalLocalResidual<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; | ||
38 | using ElementBoundaryTypes = GetPropType<TypeTag, Properties::ElementBoundaryTypes>; | ||
39 | using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; | ||
40 | using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; | ||
41 | using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; | ||
42 | using Indices = typename ModelTraits::Indices; | ||
43 | |||
44 | enum {numPhases = ModelTraits::numFluidPhases()}; | ||
45 | enum {phase0NcpIdx = Indices::phase0NcpIdx}; | ||
46 | |||
47 | public: | ||
48 |
2/4✓ Branch 1 taken 84312 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 84312 times.
✗ Branch 5 not taken.
|
168624 | using ParentType::ParentType; |
49 | |||
50 | using typename ParentType::ElementResidualVector; | ||
51 | |||
52 | 1342392 | ElementResidualVector evalFluxAndSource(const Element& element, | |
53 | const FVElementGeometry& fvGeometry, | ||
54 | const ElementVolumeVariables& elemVolVars, | ||
55 | const ElementFluxVariablesCache& elemFluxVarsCache, | ||
56 | const ElementBoundaryTypes &bcTypes) const | ||
57 | { | ||
58 | 1342392 | ElementResidualVector residual = ParentType::evalFluxAndSource(element, fvGeometry, elemVolVars, elemFluxVarsCache, bcTypes); | |
59 | |||
60 |
4/4✓ Branch 0 taken 4856928 times.
✓ Branch 1 taken 1342392 times.
✓ Branch 2 taken 4686048 times.
✓ Branch 3 taken 1171512 times.
|
7541712 | for (auto&& scv : scvs(fvGeometry)) |
61 | { | ||
62 | // here we need to set the constraints of the mpnc model into the residual | ||
63 |
2/2✓ Branch 0 taken 9713856 times.
✓ Branch 1 taken 4856928 times.
|
14570784 | for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) |
64 | 48227520 | residual[scv.localDofIndex()][phase0NcpIdx + phaseIdx] = elemVolVars[scv].phaseNcp(phaseIdx); | |
65 | } | ||
66 | |||
67 | 1342392 | return residual; | |
68 | } | ||
69 | }; | ||
70 | |||
71 | } // end namespace | ||
72 | |||
73 | #endif | ||
74 |