GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/multidomain/facet/tracer_tracer/spatialparams_tracer.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 12 12 100.0%
Functions: 5 5 100.0%
Branches: 18 28 64.3%

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-FileCopyrightText: 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 FacetTests
10 * \brief Definition of the spatial parameters for the tracer problem.
11 */
12
13 #ifndef DUMUX_TEST_TPFAFACETCOUPLING_TRACER_SPATIALPARAMS_HH
14 #define DUMUX_TEST_TPFAFACETCOUPLING_TRACER_SPATIALPARAMS_HH
15
16 #include <dumux/porousmediumflow/properties.hh>
17 #include <dumux/porousmediumflow/fvspatialparams1p.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup FacetTests
23 * \brief Definition of the spatial parameters for the tracer problem.
24 */
25 template<class GridGeometry, class Scalar>
26 class TracerSpatialParams
27 : public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar,
28 TracerSpatialParams<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 TracerSpatialParams<GridGeometry, Scalar>>;
37
38 static constexpr bool isBox = GridGeometry::discMethod == DiscretizationMethods::box;
39 static constexpr int dimWorld = GridView::dimensionworld;
40 using GlobalPosition = typename Dune::FieldVector<Scalar, dimWorld>;
41
42 public:
43
44 12 TracerSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry,
45 const std::vector< std::vector<Scalar> >& volumeFluxes,
46 const std::string& paramGroup = "")
47 : ParentType(gridGeometry)
48 12 , volumeFlux_(volumeFluxes)
49
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
12 , porosity_(getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Porosity"))
50
4/8
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
36 , extrusion_(getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Aperture", 1.0))
51 12 {}
52
53 /*!
54 * \brief Defines the porosity \f$\mathrm{[-]}\f$.
55 *
56 * \param globalPos The global position
57 */
58 32098440 Scalar porosityAtPos(const GlobalPosition& globalPos) const
59 32098440 { return porosity_; }
60
61 //! Returns the extrusion factor
62 32098440 Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const
63 32098440 { return extrusion_; }
64
65 //! Fluid properties that are spatial parameters in the tracer model.
66 //! They can possibly vary with space but are usually constants.
67 //! Fluid density
68 Scalar fluidDensity(const Element &element,
69 const SubControlVolume& scv) const
70 { return 1000; }
71
72 //! Fluid molar mass
73 Scalar fluidMolarMass(const Element &element,
74 const SubControlVolume& scv) const
75 { return 18.0; }
76
77 Scalar fluidMolarMass(const GlobalPosition &globalPos) const
78 { return 18.0; }
79
80 //! Velocity field
81 template<class ElementVolumeVariables>
82 12606500 Scalar volumeFlux(const Element &element,
83 const FVElementGeometry& fvGeometry,
84 const ElementVolumeVariables& elemVolVars,
85 const SubControlVolumeFace& scvf) const
86 {
87
5/8
✗ Branch 1 not taken.
✓ Branch 2 taken 50000 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3292000 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4000 times.
✓ Branch 10 taken 11000 times.
✓ Branch 11 taken 57000 times.
3414000 return isBox ? volumeFlux_[this->gridGeometry().elementMapper().index(element)][scvf.index()]
88
8/10
✓ Branch 0 taken 11500 times.
✓ Branch 1 taken 55000 times.
✓ Branch 2 taken 15000 times.
✓ Branch 3 taken 3379000 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8878000 times.
✓ Branch 6 taken 11000 times.
✓ Branch 7 taken 249000 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 8000 times.
12606500 : volumeFlux_[scvf.index()][0];
89 }
90
91 private:
92 std::vector< std::vector<Scalar> > volumeFlux_;
93 Scalar porosity_;
94 Scalar extrusion_;
95 };
96
97 } // end namespace Dumux
98
99 #endif
100