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 | |||
13 | #ifndef DUMUX_TRACER_TEST_SPATIAL_PARAMS_HH | ||
14 | #define DUMUX_TRACER_TEST_SPATIAL_PARAMS_HH | ||
15 | |||
16 | #include <dumux/common/parameters.hh> | ||
17 | #include <dumux/porousmediumflow/fvspatialparams1p.hh> | ||
18 | |||
19 | namespace Dumux { | ||
20 | |||
21 | /*! | ||
22 | * \ingroup TracerTests | ||
23 | * \brief Definition of the spatial parameters for the tracer problem. | ||
24 | */ | ||
25 | template<class GridGeometry, class Scalar> | ||
26 |
1/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | class TracerTestSpatialParams |
27 | : public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, | ||
28 | TracerTestSpatialParams<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 | TracerTestSpatialParams<GridGeometry, Scalar>>; | ||
37 | |||
38 | static const int dimWorld = GridView::dimensionworld; | ||
39 | using GlobalPosition = typename Dune::FieldVector<Scalar, dimWorld>; | ||
40 | |||
41 | public: | ||
42 | |||
43 | 2 | TracerTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) | |
44 |
2/8✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
2 | : ParentType(gridGeometry) |
45 | { | ||
46 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | porosity_ = getParam<Scalar>("Problem.Porosity"); |
47 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | velocity_ = getParam<Scalar>("Problem.FrontVelocity")*porosity_; |
48 | 2 | } | |
49 | |||
50 | /*! | ||
51 | * \brief if we are in the water | ||
52 | */ | ||
53 | 81951200 | bool isWater(const GlobalPosition& globalPos) const | |
54 | { | ||
55 |
6/6✓ Branch 0 taken 64511110 times.
✓ Branch 1 taken 17440090 times.
✓ Branch 2 taken 64511110 times.
✓ Branch 3 taken 17440090 times.
✓ Branch 4 taken 64511110 times.
✓ Branch 5 taken 17440090 times.
|
245853600 | const auto minCoord = this->gridGeometry().bBoxMin()[dimWorld-1]; |
56 |
2/2✓ Branch 0 taken 64511110 times.
✓ Branch 1 taken 17440090 times.
|
81951200 | const auto coord = globalPos[dimWorld-1]-minCoord; |
57 |
6/6✓ Branch 0 taken 64511110 times.
✓ Branch 1 taken 17440090 times.
✓ Branch 2 taken 64511110 times.
✓ Branch 3 taken 17440090 times.
✓ Branch 4 taken 64511110 times.
✓ Branch 5 taken 17440090 times.
|
245853600 | const auto delta = this->gridGeometry().bBoxMax()[dimWorld-1]-minCoord; |
58 |
8/8✓ Branch 0 taken 64511110 times.
✓ Branch 1 taken 17440090 times.
✓ Branch 2 taken 47674320 times.
✓ Branch 3 taken 16836790 times.
✓ Branch 4 taken 32295900 times.
✓ Branch 5 taken 15378420 times.
✓ Branch 6 taken 15981720 times.
✓ Branch 7 taken 16314180 times.
|
81951200 | if (coord < 0.2*delta + eps_ || coord > 0.8*delta + eps_ || (coord > 0.4*delta - eps_ && coord < 0.6*delta + eps_)) |
59 | return false; | ||
60 | else | ||
61 | 31360140 | return true; | |
62 | } | ||
63 | |||
64 | /*! | ||
65 | * \brief Defines the porosity \f$\mathrm{[-]}\f$. | ||
66 | * | ||
67 | * \param globalPos The global position | ||
68 | */ | ||
69 | ✗ | Scalar porosityAtPos(const GlobalPosition& globalPos) const | |
70 | ✗ | { return porosity_; } | |
71 | |||
72 | //! Fluid properties that are spatial parameters in the tracer model | ||
73 | //! They can possibly vary with space but are usually constants | ||
74 | //! saturation field | ||
75 | ✗ | Scalar saturation(const Element &element, | |
76 | const SubControlVolume& scv) const | ||
77 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 9003000 times.
✓ Branch 5 taken 6423680 times.
✓ Branch 6 taken 9003000 times.
✓ Branch 7 taken 6423680 times.
|
30853360 | { return isWater(scv.center()) ? 1.0 : 0.0; } |
78 | |||
79 | //! Fluid density | ||
80 | ✗ | Scalar fluidDensity(const Element &element, | |
81 | const SubControlVolume& scv) const | ||
82 | ✗ | { return 1000; } | |
83 | |||
84 | //! Fluid molar mass | ||
85 | ✗ | Scalar fluidMolarMass(const Element &element, | |
86 | const SubControlVolume& scv) const | ||
87 | ✗ | { return 0.018; } | |
88 | |||
89 | //! Velocity field | ||
90 | 59550000 | GlobalPosition velocity(const SubControlVolumeFace& scvf) const | |
91 | { | ||
92 | 59550000 | GlobalPosition vel(0.0); | |
93 |
4/4✓ Branch 0 taken 23528700 times.
✓ Branch 1 taken 36021300 times.
✓ Branch 2 taken 23528700 times.
✓ Branch 3 taken 36021300 times.
|
119100000 | vel[0] = isWater(scvf.center()) ? velocity_ : 0.0; |
94 | 59550000 | return vel; | |
95 | } | ||
96 | |||
97 | //! Velocity field | ||
98 | template<class ElementVolumeVariables> | ||
99 | ✗ | Scalar volumeFlux(const Element &element, | |
100 | const FVElementGeometry& fvGeometry, | ||
101 | const ElementVolumeVariables& elemVolVars, | ||
102 | const SubControlVolumeFace& scvf) const | ||
103 | { | ||
104 | ✗ | return velocity(scvf) * scvf.unitOuterNormal() * scvf.area() | |
105 | ✗ | * elemVolVars[fvGeometry.scv(scvf.insideScvIdx())].extrusionFactor(); | |
106 | } | ||
107 | |||
108 | private: | ||
109 | Scalar velocity_, porosity_; | ||
110 | static constexpr Scalar eps_ = 1e-7; | ||
111 | }; | ||
112 | |||
113 | } // end namespace Dumux | ||
114 | |||
115 | #endif | ||
116 |