GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/1p/convergence/analyticsolution/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 13 15 86.7%
Functions: 6 9 66.7%
Branches: 4 16 25.0%

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 spatial params of the incompressible single-phase convergence test with analytic solution
11 */
12
13 #ifndef DUMUX_CONVERGENCE_TEST_ONEP_SPATIALPARAMS_HH
14 #define DUMUX_CONVERGENCE_TEST_ONEP_SPATIALPARAMS_HH
15
16 #include <cmath>
17 #include <dumux/common/math.hh>
18 #include <dumux/common/parameters.hh>
19 #include <dune/common/fmatrix.hh>
20 #include <dumux/porousmediumflow/fvspatialparams1p.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup OnePTests
26 * \brief The spatial params of the incompressible single-phase convergence test with analytic solution
27 */
28 template<class GridGeometry, class Scalar>
29
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
20 class ConvergenceTestSpatialParams
30 : public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar,
31 ConvergenceTestSpatialParams<GridGeometry, Scalar>>
32 {
33 using GridView = typename GridGeometry::GridView;
34
35 using ThisType = ConvergenceTestSpatialParams<GridGeometry, Scalar>;
36 using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, ThisType>;
37
38 using Element = typename GridView::template Codim<0>::Entity;
39 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
40
41 static constexpr int dimWorld = GridView::dimensionworld;
42 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
43
44
45 public:
46 // export permeability type
47 using PermeabilityType = DimWorldMatrix;
48
49 20 ConvergenceTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
50
2/8
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
20 : ParentType(gridGeometry)
51 {
52
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 c_ = getParam<Scalar>("Problem.C");
53 20 }
54
55 /*!
56 * \brief Defines the intrinsic permeability \f$\mathrm{[m^2]}\f$.
57 *
58 * \param globalPos The global position where we evaluate
59 */
60 596064 PermeabilityType permeabilityAtPos(const GlobalPosition& globalPos) const
61 {
62 596064 PermeabilityType K(0.0);
63
64 using std::cos;
65 using std::sin;
66 using std::exp;
67
68 1192128 const Scalar x = globalPos[0];
69 1788192 K[0][0] = 1.0;
70 1788192 K[0][1] = -c_/(2*omega_) * sin(omega_*x);
71 2980320 K[1][0] = K[0][1];
72 1788192 K[1][1] = exp(-2)*(1 + c_*cos(omega_*x));
73
74 596064 return K;
75 }
76
77 /*! \brief Defines the porosity in [-].
78 *
79 * \param globalPos The global position
80 */
81 Scalar porosityAtPos(const GlobalPosition& globalPos) const
82 { return 0.4; }
83
84 private:
85 static constexpr Scalar omega_ = M_PI;
86 Scalar permeability_;
87 Scalar c_;
88 };
89
90 } // end namespace Dumux
91
92 #endif
93