GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/tracer/constvel/properties.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 9 12 75.0%
Functions: 4 8 50.0%
Branches: 14 24 58.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 TracerTests
10 * \brief The properties for the tracer problem:
11 * A rotating velocity field mixes a tracer band in a porous groundwater reservoir.
12 */
13 #ifndef DUMUX_TRACER_TEST_PROPERTIES_HH
14 #define DUMUX_TRACER_TEST_PROPERTIES_HH
15
16 #include <dune/grid/yaspgrid.hh>
17
18 #include <dumux/discretization/box.hh>
19 #include <dumux/discretization/cctpfa.hh>
20 #include <dumux/discretization/ccmpfa.hh>
21 #include <dumux/porousmediumflow/tracer/model.hh>
22 #include <dumux/material/fluidsystems/base.hh>
23
24 #include "spatialparams.hh"
25
26 #ifndef USEMOLES // default to true if not set through CMake
27 #define USEMOLES true
28 #endif
29
30 #ifndef ENABLEDISPERSION // default to false if not set through CMake
31 #define ENABLEDISPERSION false
32 #endif
33
34 #include "problem.hh"
35
36 namespace Dumux::Properties {
37 // Create new type tags
38 namespace TTag {
39 struct TracerTest { using InheritsFrom = std::tuple<Tracer>; };
40 struct TracerTestTpfa { using InheritsFrom = std::tuple<TracerTest, CCTpfaModel>; };
41 struct TracerTestMpfa { using InheritsFrom = std::tuple<TracerTest, CCMpfaModel>; };
42 struct TracerTestBox { using InheritsFrom = std::tuple<TracerTest, BoxModel>; };
43 } // end namespace TTag
44
45 // enable caching
46 template<class TypeTag>
47 struct EnableGridVolumeVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
48 template<class TypeTag>
49 struct EnableGridFluxVariablesCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
50 template<class TypeTag>
51 struct EnableGridGeometryCache<TypeTag, TTag::TracerTest> { static constexpr bool value = true; };
52
53 // Set the grid type
54 template<class TypeTag>
55 struct Grid<TypeTag, TTag::TracerTest> { using type = Dune::YaspGrid<2>; };
56
57 // Set the problem property
58 template<class TypeTag>
59 struct Problem<TypeTag, TTag::TracerTest> { using type = TracerTest<TypeTag>; };
60
61 // Set the spatial parameters
62 template<class TypeTag>
63 struct SpatialParams<TypeTag, TTag::TracerTest>
64 {
65 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
66 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
67 using type = TracerTestSpatialParams<GridGeometry, Scalar>;
68 };
69
70 // Define whether mole(true) or mass (false) fractions are used
71 template<class TypeTag>
72 struct UseMoles<TypeTag, TTag::TracerTest> { static constexpr bool value = USEMOLES; };
73
74 template<class TypeTag>
75 struct EnableCompositionalDispersion<TypeTag, TTag::TracerTest> { static constexpr bool value = ENABLEDISPERSION; };
76
77 //! A simple fluid system with one tracer component
78 template<class TypeTag>
79 class TracerFluidSystem : public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>,
80 TracerFluidSystem<TypeTag>>
81 {
82 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
83 using Problem = GetPropType<TypeTag, Properties::Problem>;
84 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
85 using Element = typename GridView::template Codim<0>::Entity;
86 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
87 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
88
89 public:
90 static constexpr bool isTracerFluidSystem()
91 { return true; }
92
93 //! The number of components
94 static constexpr int numComponents = 2;
95 static constexpr int numPhases = 1;
96
97 //! Human readable component name (index compIdx) (for vtk output)
98 32 static std::string componentName(int compIdx)
99
2/6
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 32 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
32 { return "tracer_" + std::to_string(compIdx); }
100
101 //! Human readable phase name (index phaseIdx) (for velocity vtk output)
102 static std::string phaseName(int phaseIdx = 0)
103
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
176 { return "Groundwater"; }
104
105 //! Molar mass in kg/mol of the component with index compIdx
106 static Scalar molarMass(unsigned int compIdx)
107 { return 0.300; }
108
109 //! Binary diffusion coefficient
110 //! (might depend on spatial parameters like pressure / temperature)
111 10100000 static Scalar binaryDiffusionCoefficient(unsigned int compIdx,
112 const Problem& problem,
113 const Element& element,
114 const SubControlVolume& scv)
115 {
116
5/6
✓ Branch 0 taken 94 times.
✓ Branch 1 taken 10099906 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 86 times.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
10100000 static const Scalar D = getParam<Scalar>("Problem.D");
117
5/6
✓ Branch 0 taken 43 times.
✓ Branch 1 taken 10099957 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 35 times.
✓ Branch 6 taken 8 times.
✗ Branch 7 not taken.
10100000 static const Scalar D2 = getParam<Scalar>("Problem.D2");
118
2/2
✓ Branch 0 taken 5050000 times.
✓ Branch 1 taken 5050000 times.
10100000 if (compIdx == 0)
119 5050000 return D;
120 else
121 5050000 return D2;
122 }
123
124 /*!
125 * \copydoc Dumux::FluidSystems::Base::isCompressible
126 */
127 static constexpr bool isCompressible(int phaseIdx)
128 { return false; }
129
130 /*!
131 * \copydoc Dumux::FluidSystems::Base::viscosityIsConstant
132 */
133 static constexpr bool viscosityIsConstant(int phaseIdx)
134 { return true; }
135 };
136
137 template<class TypeTag>
138 struct FluidSystem<TypeTag, TTag::TracerTest> { using type = TracerFluidSystem<TypeTag>; };
139
140 } // end namespace Dumux::Properties
141
142 #endif
143