GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/assembly/staggeredfvassembler.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 9 10 90.0%
Functions: 27 27 100.0%
Branches: 34 86 39.5%

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 Assembly
10 * \ingroup StaggeredDiscretization
11 * \brief A linear system assembler (residual and Jacobian) for staggered finite volume schemes
12 */
13 #ifndef DUMUX_STAGGERED_FV_ASSEMBLER_HH
14 #define DUMUX_STAGGERED_FV_ASSEMBLER_HH
15
16 #include <tuple>
17 #include <memory>
18
19 #include <dune/common/indices.hh>
20
21 #include <dumux/common/properties.hh>
22 #include <dumux/common/timeloop.hh>
23 #include <dumux/discretization/method.hh>
24
25 #include <dumux/multidomain/fvassembler.hh>
26 #include <dumux/multidomain/staggeredtraits.hh>
27 #include <dumux/multidomain/staggeredcouplingmanager.hh>
28
29 #include "diffmethod.hh"
30
31 namespace Dumux {
32
33 /*!
34 * \ingroup Assembly
35 * \ingroup StaggeredDiscretization
36 * \brief A linear system assembler (residual and Jacobian) for staggered finite volume schemes.
37 * This is basically just a wrapper for the MultiDomainFVAssembler which simplifies the set-up
38 * of uncoupled problems using the staggered scheme.
39 * \tparam TypeTag the TypeTag
40 * \tparam diffMethod the differentiation method to residual compute derivatives
41 * \tparam isImplicit if to use an implicit or explicit time discretization
42 */
43 template<class TypeTag, DiffMethod diffMethod, bool isImplicit = true>
44 33 class StaggeredFVAssembler : public MultiDomainFVAssembler<StaggeredMultiDomainTraits<TypeTag, TypeTag>,
45 StaggeredCouplingManager<StaggeredMultiDomainTraits<TypeTag, TypeTag>>,
46 diffMethod, isImplicit>
47 {
48 using ParentType = MultiDomainFVAssembler<StaggeredMultiDomainTraits<TypeTag, TypeTag>,
49 StaggeredCouplingManager<StaggeredMultiDomainTraits<TypeTag, TypeTag>>,
50 diffMethod, isImplicit>;
51
52 using Problem = GetPropType<TypeTag, Properties::Problem>;
53 using TimeLoop = TimeLoopBase<GetPropType<TypeTag, Properties::Scalar>>;
54
55 public:
56 using typename ParentType::ResidualType;
57 using typename ParentType::SolutionVector;
58 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
59 using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
60 using CouplingManager = typename ParentType::CouplingManager;
61
62 //! The constructor for stationary problems
63 4 StaggeredFVAssembler(std::shared_ptr<const Problem> problem,
64 std::shared_ptr<const GridGeometry> gridGeometry,
65 std::shared_ptr<GridVariables> gridVariables)
66 : ParentType(std::make_tuple(problem, problem),
67 std::make_tuple(gridGeometry->faceFVGridGeometryPtr(), gridGeometry->cellCenterFVGridGeometryPtr()),
68 std::make_tuple(gridVariables->faceGridVariablesPtr(), gridVariables->cellCenterGridVariablesPtr()),
69
16/38
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 4 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 4 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 4 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 4 times.
✗ Branch 36 not taken.
✓ Branch 39 taken 4 times.
✗ Branch 40 not taken.
✓ Branch 48 taken 4 times.
✗ Branch 49 not taken.
✓ Branch 50 taken 4 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 4 times.
✗ Branch 53 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
8 std::make_shared<CouplingManager>())
70 {
71 static_assert(isImplicit, "Explicit assembler for stationary problem doesn't make sense!");
72 12 this->couplingManager_->setSubProblems(std::make_tuple(problem, problem));
73 4 }
74
75 //! The constructor for time-dependent problems
76 29 StaggeredFVAssembler(std::shared_ptr<const Problem> problem,
77 std::shared_ptr<const GridGeometry> gridGeometry,
78 std::shared_ptr<GridVariables> gridVariables,
79 std::shared_ptr<const TimeLoop> timeLoop,
80 const SolutionVector& prevSol)
81 : ParentType(std::make_tuple(problem, problem),
82 std::make_tuple(gridGeometry->faceFVGridGeometryPtr(), gridGeometry->cellCenterFVGridGeometryPtr()),
83 std::make_tuple(gridVariables->faceGridVariablesPtr(), gridVariables->cellCenterGridVariablesPtr()),
84 std::make_shared<CouplingManager>(),
85 timeLoop,
86
18/44
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 29 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 29 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 29 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 29 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 29 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 29 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 29 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 29 times.
✗ Branch 27 not taken.
✓ Branch 29 taken 29 times.
✗ Branch 30 not taken.
✓ Branch 32 taken 29 times.
✗ Branch 33 not taken.
✓ Branch 35 taken 29 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 29 times.
✗ Branch 39 not taken.
✓ Branch 42 taken 29 times.
✗ Branch 43 not taken.
✓ Branch 51 taken 29 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 29 times.
✗ Branch 54 not taken.
✓ Branch 55 taken 29 times.
✗ Branch 56 not taken.
✓ Branch 57 taken 29 times.
✗ Branch 58 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
87 prevSol)
87 {
88 87 this->couplingManager_->setSubProblems(std::make_tuple(problem, problem));
89 29 }
90
91 auto& gridVariables()
92 { return ParentType::gridVariables(Dune::index_constant<0>()); }
93
94 const auto& gridVariables() const
95 { return ParentType::gridVariables(Dune::index_constant<0>()); }
96
97 const GridGeometry& gridGeometry() const
98 { return ParentType::gridGeometry(Dune::index_constant<0>()).actualGridGeometry(); }
99
100 };
101
102 } // namespace Dumux
103
104 #endif
105