GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/1p/incompressible/properties.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 0 0 -%
Branches: 11 26 42.3%

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 OnePTests
10 * \brief The properties for the incompressible test
11 */
12
13 #ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_PROPERTIES_HH
14 #define DUMUX_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_PROPERTIES_HH
15
16 #if HAVE_DUNE_UGGRID
17 #include <dune/grid/uggrid.hh>
18 #endif
19 #include <dune/grid/yaspgrid.hh>
20 #if HAVE_QUADMATH
21 #include <dune/common/quadmath.hh>
22 #endif
23 #include <dumux/common/boundarytypes.hh>
24 #include <dumux/io/grid/gridmanager_yasp.hh>
25 #include <dumux/discretization/cctpfa.hh>
26 #include <dumux/discretization/ccmpfa.hh>
27 #include <dumux/discretization/box.hh>
28 #include <dumux/discretization/fcdiamond.hh>
29 #include <dumux/discretization/pq1bubble.hh>
30
31 #include <dumux/porousmediumflow/1p/model.hh>
32 #include <dumux/porousmediumflow/1p/incompressiblelocalresidual.hh>
33
34 #include <dumux/material/components/simpleh2o.hh>
35 #include <dumux/material/fluidsystems/1pliquid.hh>
36
37 #include "problem.hh"
38 #include "spatialparams.hh"
39
40 #ifndef GRIDTYPE // default to yasp grid if not provided by CMake
41 #define GRIDTYPE Dune::YaspGrid<2>
42 #endif
43
44 ////////////////////////////////////////////////////
45 // A fake grid that cannot communicate. //
46 // Can be used to make sure that compilation and //
47 // sequential execution also work for such grids. //
48 ////////////////////////////////////////////////////
49 namespace Dumux {
50
51 template<int dim>
52 class NoCommunicateGrid;
53
54 template<int dim>
55
6/16
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 6 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 4 times.
24 class NoCommunicateGridLeafGridView
56 : public Dune::YaspGrid<dim>::LeafGridView
57 {
58 using ParentType = typename Dune::YaspGrid<dim>::LeafGridView;
59 public:
60 4 using ParentType::ParentType;
61
62 struct Traits : public ParentType::Traits
63 { using Grid = NoCommunicateGrid<dim>; };
64
65 const typename Traits::Grid& grid() const
66
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 200 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 100 times.
301 { return static_cast<const typename Traits::Grid&>(ParentType::grid()); }
67 };
68
69 template<int dim>
70 class NoCommunicateGrid : public Dune::YaspGrid<dim>
71 {
72 using ParentType = Dune::YaspGrid<dim>;
73 public:
74 using ParentType::ParentType;
75 struct Traits : public ParentType::Traits
76 { using LeafGridView = NoCommunicateGridLeafGridView<dim>; };
77
78 using LeafGridView = NoCommunicateGridLeafGridView<dim>;
79
80 typename Traits::LeafGridView leafGridView() const
81 4 { return NoCommunicateGridLeafGridView<dim>(*this); }
82 private:
83 using ParentType::communicate;
84 using ParentType::communicateCodim;
85 };
86
87 template<int dim>
88
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 class GridManager<NoCommunicateGrid<dim>> : public GridManager<Dune::YaspGrid<dim>>
89 {
90 using ParentType = GridManager<Dune::YaspGrid<dim>>;
91 public:
92 using ParentType::ParentType;
93 using Grid = NoCommunicateGrid<dim>;
94
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Grid& grid() { return static_cast<NoCommunicateGrid<dim>&>(ParentType::grid()); }
95 };
96
97 } // end namespace Dumux
98
99 namespace Dune::Capabilities {
100
101 template<int dim, int codim>
102 struct canCommunicate<Dumux::NoCommunicateGrid<dim>, codim>
103 { static constexpr bool v = false; };
104
105 } // end namespace Dune::Capabilities
106 /////////////////////////////////////////
107
108 namespace Dumux::Properties {
109 // Create new type tags
110 namespace TTag {
111 struct OnePIncompressible { using InheritsFrom = std::tuple<OneP>; };
112 struct OnePIncompressibleTpfa { using InheritsFrom = std::tuple<OnePIncompressible, CCTpfaModel>; };
113 struct OnePIncompressibleMpfa { using InheritsFrom = std::tuple<OnePIncompressible, CCMpfaModel>; };
114 struct OnePIncompressibleBox { using InheritsFrom = std::tuple<OnePIncompressible, BoxModel>; };
115 struct OnePIncompressibleFCDiamond { using InheritsFrom = std::tuple<OnePIncompressible, FaceCenteredDiamondModel>; };
116 struct OnePIncompressiblePQ1Bubble { using InheritsFrom = std::tuple<OnePIncompressible, PQ1BubbleModel>; };
117 } // end namespace TTag
118
119 // Set the grid type
120 template<class TypeTag>
121 struct Grid<TypeTag, TTag::OnePIncompressible> { using type = GRIDTYPE; };
122
123 // Set the problem type
124 template<class TypeTag>
125 struct Problem<TypeTag, TTag::OnePIncompressible> { using type = OnePTestProblem<TypeTag>; };
126
127 // set the spatial params
128 template<class TypeTag>
129 struct SpatialParams<TypeTag, TTag::OnePIncompressible>
130 {
131 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
132 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
133 using type = OnePTestSpatialParams<GridGeometry, Scalar>;
134 };
135
136 // use the incompressible local residual (provides analytic jacobian)
137 template<class TypeTag>
138 struct LocalResidual<TypeTag, TTag::OnePIncompressible> { using type = OnePIncompressibleLocalResidual<TypeTag>; };
139
140 // the fluid system
141 template<class TypeTag>
142 struct FluidSystem<TypeTag, TTag::OnePIncompressible>
143 {
144 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
145 using type = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >;
146 };
147
148 // Enable caching
149 template<class TypeTag>
150 struct EnableGridVolumeVariablesCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = false; };
151 template<class TypeTag>
152 struct EnableGridFluxVariablesCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = false; };
153 template<class TypeTag>
154 struct EnableGridGeometryCache<TypeTag, TTag::OnePIncompressible> { static constexpr bool value = false; };
155
156 // define a TypeTag for a quad precision test
157 #if HAVE_QUADMATH
158 namespace TTag {
159 struct OnePIncompressibleTpfaQuad { using InheritsFrom = std::tuple<OnePIncompressibleTpfa>; };
160 } // end namespace TTag
161 template<class TypeTag>
162 struct Scalar<TypeTag, TTag::OnePIncompressibleTpfaQuad> { using type = Dune::Float128; };
163 #endif
164 }
165 #endif
166