GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/tracer/2ptracer/properties.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 2 7 28.6%
Functions: 1 3 33.3%
Branches: 2 12 16.7%

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 of the 2p tracer test.
11 */
12 #ifndef DUMUX_2P_TRACER_TEST_PROPERTIES_HH
13 #define DUMUX_2P_TRACER_TEST_PROPERTIES_HH
14
15 #include <dune/grid/yaspgrid.hh>
16
17 #include <dumux/discretization/cctpfa.hh>
18 #include <dumux/porousmediumflow/tracer/model.hh>
19 #include <dumux/material/fluidsystems/base.hh>
20
21 #include <test/porousmediumflow/2p/incompressible/properties.hh>
22
23 #include "spatialparams.hh"
24 #include "problem.hh"
25
26 namespace Dumux::Properties {
27
28 //Create new type tags
29 namespace TTag {
30 struct TwoPTracerTest { using InheritsFrom = std::tuple<Tracer>; };
31 struct TwoPTracerTestTpfa { using InheritsFrom = std::tuple<TwoPTracerTest, CCTpfaModel>; };
32 } // end namespace TTag
33
34 // Set the grid type
35 template<class TypeTag>
36 struct Grid<TypeTag, TTag::TwoPTracerTest> { using type = Dune::YaspGrid<2>; };
37
38 // Set the problem property
39 template<class TypeTag>
40 struct Problem<TypeTag, TTag::TwoPTracerTest> { using type = TwoPTracerTestProblem<TypeTag>; };
41
42 // Set the spatial parameters
43 template<class TypeTag>
44 struct SpatialParams<TypeTag, TTag::TwoPTracerTest>
45 {
46 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
47 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
48 using type = TwoPTracerTestSpatialParams<GridGeometry, Scalar>;
49 };
50
51 // Define whether mole(true) or mass (false) fractions are used
52 template<class TypeTag>
53 struct UseMoles<TypeTag, TTag::TwoPTracerTest> { static constexpr bool value = false; };
54 template<class TypeTag>
55 struct SolutionDependentMolecularDiffusion<TypeTag, TTag::TwoPTracerTestTpfa> { static constexpr bool value = false; };
56
57 //! A simple fluid system with one tracer component
58 template<class TypeTag>
59 class TracerFluidSystem : public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>,
60 TracerFluidSystem<TypeTag>>
61 {
62 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
63 using Problem = GetPropType<TypeTag, Properties::Problem>;
64 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
65 using Element = typename GridView::template Codim<0>::Entity;
66 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
67 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
68
69 public:
70 //! If the fluid system only contains tracer components
71 static constexpr bool isTracerFluidSystem()
72 { return true; }
73
74 //! The number of components
75 static constexpr int numComponents = 1;
76
77 //! Human readable component name (index compIdx) (for vtk output)
78 2 static std::string componentName(int compIdx)
79
2/6
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 { return "tracer_" + std::to_string(compIdx); }
80
81 //! Molar mass in kg/mol of the component with index compIdx
82 static Scalar molarMass(unsigned int compIdx)
83 { return 0.300; }
84
85 //! Binary diffusion coefficient
86 //! (might depend on spatial parameters like pressure / temperature)
87 static Scalar binaryDiffusionCoefficient(unsigned int compIdx,
88 const Problem& problem,
89 const Element& element,
90 const SubControlVolume& scv)
91 {
92 static const Scalar D = getParam<Scalar>("Problem.BinaryDiffusionCoefficient");
93 return D;
94 }
95 };
96
97 template<class TypeTag>
98 struct FluidSystem<TypeTag, TTag::TwoPTracerTest> { using type = TracerFluidSystem<TypeTag>; };
99
100 } // end namespace Dumux::Properties
101
102 #endif
103