GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/boundary/stokesdarcy/1p_1p/convergencetest/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 17 21 81.0%
Functions: 2 4 50.0%
Branches: 10 24 41.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 BoundaryTests
10 * \brief The spatial parameters class for the test problem using the 1p cc model.
11 */
12
13 #ifndef DUMUX_CONVERGENCE_TEST_SPATIALPARAMS_HH
14 #define DUMUX_CONVERGENCE_TEST_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 #include "testcase.hh"
22
23 namespace Dumux {
24
25 /*!
26 * \ingroup BoundaryTests
27 * \brief The spatial parameters class for the test problem using the
28 * 1p cc model.
29 */
30 template<class GridGeometry, class Scalar>
31
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
6 class ConvergenceTestSpatialParams
32 : public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar,
33 ConvergenceTestSpatialParams<GridGeometry, Scalar>>
34 {
35 using GridView = typename GridGeometry::GridView;
36 using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar,
37 ConvergenceTestSpatialParams<GridGeometry, Scalar>>;
38
39 using Element = typename GridView::template Codim<0>::Entity;
40 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
41
42 static constexpr int dimWorld = GridView::dimensionworld;
43 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
44
45
46 public:
47 // export permeability type
48 using PermeabilityType = DimWorldMatrix;
49
50 6 ConvergenceTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry, const TestCase testCase)
51 : ParentType(gridGeometry)
52
2/8
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
6 , testCase_(testCase)
53 {
54
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 alphaBJ_ = getParam<Scalar>("Darcy.SpatialParams.AlphaBeaversJoseph");
55 6 }
56
57 /*!
58 * \brief Function for defining the (intrinsic) permeability \f$[m^2]\f$.
59 *
60 * \param element The element
61 * \param scv The sub control volume
62 * \param elemSol The element solution vector
63 * \return the intrinsic permeability
64 */
65 template<class SubControlVolume, class ElementSolution>
66 2091880 PermeabilityType permeability(const Element& element,
67 const SubControlVolume& scv,
68 const ElementSolution& elemSol) const
69 {
70 2091880 PermeabilityType K(0.0);
71
72
2/2
✓ Branch 0 taken 1350440 times.
✓ Branch 1 taken 741440 times.
2091880 if (testCase_ == TestCase::Schneider)
73 {
74 using std::cos;
75 using std::sin;
76 using std::exp;
77
78 static constexpr Scalar c = 0.0;
79 static constexpr Scalar omega = M_PI;
80
81 2700880 const Scalar x = scv.center()[0];
82 2700880 K[0][0] = 1.0;
83 2700880 K[0][1] = -c/(2*omega) * sin(omega*x);
84 5401760 K[1][0] = K[0][1];
85 4051320 K[1][1] = exp(-2)*(1 + c*cos(omega*x));
86 }
87 else
88 {
89
4/6
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 741437 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
741440 const static Scalar permeability = getParam<Scalar>("Darcy.SpatialParams.Permeability");
90 1482880 K[0][0] = permeability;
91 2224320 K[1][1] = permeability;
92 }
93
94 2091880 return K;
95 }
96
97 /*! \brief Defines the porosity in [-].
98 *
99 * \param globalPos The global position
100 */
101 Scalar porosityAtPos(const GlobalPosition& globalPos) const
102 { return 0.4; }
103
104 /*! \brief Defines the Beavers-Joseph coefficient in [-].
105 *
106 * \param globalPos The global position
107 */
108 Scalar beaversJosephCoeffAtPos(const GlobalPosition& globalPos) const
109 { return alphaBJ_; }
110
111 private:
112 TestCase testCase_;
113 Scalar permeability_;
114 Scalar alphaBJ_;
115 };
116
117 } // end namespace Dumux
118
119 #endif
120