GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/tracer/constvel/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 17 27 63.0%
Functions: 7 20 35.0%
Branches: 5 18 27.8%

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 Definition of the spatial parameters for the tracer problem.
11 */
12
13 #ifndef DUMUX_TRACER_TEST_SPATIAL_PARAMS_HH
14 #define DUMUX_TRACER_TEST_SPATIAL_PARAMS_HH
15
16 #include <dumux/porousmediumflow/properties.hh>
17 #include <dumux/porousmediumflow/fvspatialparams1p.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup TracerTests
23 * \brief Definition of the spatial parameters for the tracer problem.
24 */
25 template<class GridGeometry, class Scalar>
26
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
8 class TracerTestSpatialParams
27 : public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar,
28 TracerTestSpatialParams<GridGeometry, Scalar>>
29 {
30 using GridView = typename GridGeometry::GridView;
31 using FVElementGeometry = typename GridGeometry::LocalView;
32 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
33 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
34 using Element = typename GridView::template Codim<0>::Entity;
35 using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar,
36 TracerTestSpatialParams<GridGeometry, Scalar>>;
37
38 static const int dimWorld = GridView::dimensionworld;
39 using GlobalPosition = typename Dune::FieldVector<Scalar, dimWorld>;
40
41 public:
42
43 8 TracerTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
44
2/6
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
8 : ParentType(gridGeometry)
45 {
46
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 alphaL_ = getParam<Scalar>("Problem.AlphaL", 0.0);
47
1/4
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
8 alphaT_ = getParam<Scalar>("Problem.AlphaT", 0.0);
48 8 }
49
50 /*!
51 * \brief Defines the porosity \f$\mathrm{[-]}\f$.
52 *
53 * \param globalPos The global position
54 */
55 Scalar porosityAtPos(const GlobalPosition& globalPos) const
56 { return 0.2; }
57
58 //! Fluid properties that are spatial parameters in the tracer model
59 //! They can possibly vary with space but are usually constants
60
61 //! Fluid density
62 Scalar fluidDensity(const Element &element,
63 const SubControlVolume& scv) const
64 { return 1000; }
65
66 //! Fluid molar mass
67 Scalar fluidMolarMass(const Element &element,
68 const SubControlVolume& scv) const
69 { return 18.0; }
70
71 Scalar fluidMolarMass(const GlobalPosition &globalPos) const
72 { return 18.0; }
73
74 //! Velocity field
75 12918400 GlobalPosition velocity(const SubControlVolumeFace& scvf) const
76 {
77 12918400 GlobalPosition vel(1e-5);
78 12918400 const auto globalPos = scvf.ipGlobal();
79 25836800 const auto& x = globalPos[0];
80 25836800 const auto& y = globalPos[1];
81
82 25836800 vel[0] *= x*x * (1.0 - x)*(1.0 - x) * (2.0*y - 6.0*y*y + 4.0*y*y*y);
83 25836800 vel[1] *= -1.0*y*y * (1.0 - y)*(1.0 - y) * (2.0*x - 6.0*x*x + 4.0*x*x*x);
84
85 12918400 return vel;
86 }
87
88 //! Velocity field
89 template<class ElementVolumeVariables>
90 4500000 Scalar volumeFlux(const Element &element,
91 const FVElementGeometry& fvGeometry,
92 const ElementVolumeVariables& elemVolVars,
93 const SubControlVolumeFace& scvf) const
94 {
95 9000000 return velocity(scvf) * scvf.unitOuterNormal() * scvf.area()
96 22500000 * elemVolVars[fvGeometry.scv(scvf.insideScvIdx())].extrusionFactor();
97 }
98
99 /*!
100 * \brief Defines the dispersion tensor \f$\mathrm{[-]}\f$.
101 *
102 * \param globalPos The global position
103 */
104 std::array<Scalar, 2> dispersionAlphas(const GlobalPosition& globalPos,
105 const int phaseIdx = 0,
106 const int compIdx = 0) const
107 { return { alphaL_, alphaT_ }; }
108
109 private:
110 Scalar alphaL_;
111 Scalar alphaT_;
112 };
113
114 } // end namespace Dumux
115
116 #endif
117