GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/tracer/2ptracer/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 8 17 47.1%
Functions: 1 7 14.3%
Branches: 12 26 46.2%

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 #ifndef DUMUX_TWOP_TRACER_TEST_SPATIAL_PARAMS_HH
13 #define DUMUX_TWOP_TRACER_TEST_SPATIAL_PARAMS_HH
14
15 #include <iostream>
16 #include <dumux/porousmediumflow/fvspatialparamsmp.hh>
17
18 namespace Dumux {
19
20 /*!
21 * \ingroup TracerTests
22 * \brief Definition of the spatial parameters for the tracer problem
23 */
24 template<class GridGeometry, class Scalar>
25 class TwoPTracerTestSpatialParams
26 : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
27 TwoPTracerTestSpatialParams<GridGeometry, Scalar>>
28 {
29 using GridView = typename GridGeometry::GridView;
30 using FVElementGeometry = typename GridGeometry::LocalView;
31 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
32 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
33 using Element = typename GridView::template Codim<0>::Entity;
34 using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
35 TwoPTracerTestSpatialParams<GridGeometry, Scalar>>;
36
37 static const int dimWorld = GridView::dimensionworld;
38 using GlobalPosition = typename Dune::FieldVector<Scalar, dimWorld>;
39
40 public:
41
42 1 TwoPTracerTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
43
2/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
5 : ParentType(gridGeometry) {}
44
45 /*!
46 * \brief Defines the porosity \f$\mathrm{[-]}\f$.
47 *
48 * \param globalPos The global position
49 */
50 Scalar porosityAtPos(const GlobalPosition& globalPos) const
51 { return 0.4; }
52
53 //! Fluid properties that are spatial parameters in the tracer model
54 //! They can possible vary with space but are usually constants
55
56 //! Fluid density
57 Scalar fluidDensity(const Element &element,
58 const SubControlVolume& scv) const
59 2528352 { return density_[this->gridGeometry().elementMapper().index(element)];; }
60
61 void setDensity(const std::vector<Scalar>& d)
62
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 50 times.
✗ Branch 5 not taken.
51 { density_ = d; }
63
64 //! fluid molar mass
65 Scalar fluidMolarMass(const Element &element,
66 const SubControlVolume& scv) const
67 { return 0.018; }
68
69 Scalar fluidMolarMass(const GlobalPosition &globalPos) const
70 { return 0.018; }
71
72 //! Velocity field
73 template<class ElementVolumeVariables>
74 Scalar volumeFlux(const Element &element,
75 const FVElementGeometry& fvGeometry,
76 const ElementVolumeVariables& elemVolVars,
77 const SubControlVolumeFace& scvf) const
78
4/8
✗ Branch 0 not taken.
✓ Branch 1 taken 308448 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 308448 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 302400 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 302400 times.
1231488 { return volumeFlux_[scvf.index()]; }
79
80 void setVolumeFlux(const std::vector<Scalar>& f)
81
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 50 times.
✗ Branch 5 not taken.
51 { volumeFlux_ = f; }
82
83 //! saturation from twoPProblem
84 Scalar saturation(const Element &element,
85 const SubControlVolume& scv) const
86 1685568 { return saturation_[scv.dofIndex()]; }
87
88 void setSaturation(const std::vector<Scalar>& s)
89
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 50 times.
✗ Branch 5 not taken.
51 { saturation_ = s; }
90
91 private:
92 std::vector<Scalar> volumeFlux_;
93 std::vector<Scalar> density_;
94 std::vector<Scalar> saturation_;
95 };
96
97 } // end namespace Dumux
98
99 #endif
100