GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/facet/tracer_tracer/spatialparams_tracer.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 5 15 33.3%
Functions: 5 25 20.0%
Branches: 19 34 55.9%

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 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 , volumeFlux_(volumeFluxes)
49
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
12 , porosity_(getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Porosity"))
50
4/12
✓ 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.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 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 Scalar porosityAtPos(const GlobalPosition& globalPos) const
59 { return porosity_; }
60
61 //! Returns the extrusion factor
62 Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const
63 { 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 Scalar volumeFlux(const Element &element,
83 const FVElementGeometry& fvGeometry,
84 const ElementVolumeVariables& elemVolVars,
85 const SubControlVolumeFace& scvf) const
86 {
87 return isBox ? volumeFlux_[this->gridGeometry().elementMapper().index(element)][scvf.index()]
88
14/20
✓ Branch 0 taken 11500 times.
✓ Branch 1 taken 5000 times.
✓ Branch 2 taken 11500 times.
✓ Branch 3 taken 5000 times.
✓ Branch 4 taken 15000 times.
✓ Branch 5 taken 87000 times.
✓ Branch 6 taken 15000 times.
✓ Branch 7 taken 87000 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 8874000 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 8874000 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 192000 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 192000 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 8000 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 8000 times.
18385000 : 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