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 RichardsTests | ||
10 | * \brief Spatial parameters for the RichardsLensProblem. | ||
11 | */ | ||
12 | |||
13 | #ifndef DUMUX_RICHARDS_LENS_SPATIAL_PARAMETERS_HH | ||
14 | #define DUMUX_RICHARDS_LENS_SPATIAL_PARAMETERS_HH | ||
15 | |||
16 | #include <dumux/porousmediumflow/fvspatialparamsmp.hh> | ||
17 | #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> | ||
18 | |||
19 | #include <dumux/porousmediumflow/richards/model.hh> | ||
20 | |||
21 | namespace Dumux { | ||
22 | |||
23 | /*! | ||
24 | * \ingroup RichardsTests | ||
25 | * \brief The spatial parameters for the RichardsLensProblem. | ||
26 | */ | ||
27 | template<class GridGeometry, class Scalar> | ||
28 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | class RichardsLensSpatialParams |
29 | : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, RichardsLensSpatialParams<GridGeometry, Scalar>> | ||
30 | { | ||
31 | using ThisType = RichardsLensSpatialParams<GridGeometry, Scalar>; | ||
32 | using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; | ||
33 | using GridView = typename GridGeometry::GridView; | ||
34 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
35 | using SubControlVolume = typename FVElementGeometry::SubControlVolume; | ||
36 | using Element = typename GridView::template Codim<0>::Entity; | ||
37 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
38 | |||
39 | enum { dimWorld = GridView::dimensionworld }; | ||
40 | |||
41 | using PcKrSwCurve = FluidMatrix::VanGenuchtenDefault<Scalar>; | ||
42 | |||
43 | public: | ||
44 | // export permeability type | ||
45 | using PermeabilityType = Scalar; | ||
46 | |||
47 | 25 | RichardsLensSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) | |
48 | : ParentType(gridGeometry) | ||
49 |
2/4✓ Branch 1 taken 25 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 25 times.
✗ Branch 5 not taken.
|
25 | , pcKrSwCurveLens_("SpatialParams.Lens") |
50 |
4/8✓ Branch 2 taken 25 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 25 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 25 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 25 times.
✗ Branch 12 not taken.
|
75 | , pcKrSwCurveOuterDomain_("SpatialParams.OuterDomain") |
51 | { | ||
52 | 25 | lensLowerLeft_ = {1.0, 2.0}; | |
53 | 25 | lensUpperRight_ = {4.0, 3.0}; | |
54 | 25 | lensK_ = 1e-12; | |
55 | 25 | outerK_ = 5e-12; | |
56 | 25 | } | |
57 | |||
58 | /*! | ||
59 | * \brief Returns the intrinsic permeability tensor [m^2] at a given location | ||
60 | * | ||
61 | * \param globalPos The global position where we evaluate | ||
62 | */ | ||
63 | 2355700 | PermeabilityType permeabilityAtPos(const GlobalPosition& globalPos) const | |
64 | { | ||
65 |
2/2✓ Branch 0 taken 308992 times.
✓ Branch 1 taken 2046708 times.
|
2355700 | if (isInLens_(globalPos)) |
66 | 308992 | return lensK_; | |
67 | 2046708 | return outerK_; | |
68 | } | ||
69 | |||
70 | /*! | ||
71 | * \brief Returns the porosity [] at a given location | ||
72 | * | ||
73 | * \param globalPos The global position where we evaluate | ||
74 | */ | ||
75 | Scalar porosityAtPos(const GlobalPosition& globalPos) const | ||
76 | { return 0.4; } | ||
77 | |||
78 | /*! | ||
79 | * \brief Returns the fluid-matrix interaction law for the sub-control volume | ||
80 | * | ||
81 | * This method is not actually required by the Richards model, but provided | ||
82 | * for the convenience of the RichardsLensProblem | ||
83 | * | ||
84 | * \param element The current finite element | ||
85 | * \param scv The sub-control volume | ||
86 | * \param elemSol The current element solution | ||
87 | */ | ||
88 | template<class ElementSolution> | ||
89 | 5135112 | auto fluidMatrixInteraction(const Element& element, | |
90 | const SubControlVolume& scv, | ||
91 | const ElementSolution& elemSol) const | ||
92 | { | ||
93 | 5135112 | const auto& globalPos = scv.dofPosition(); | |
94 |
6/8✓ Branch 1 taken 1527692 times.
✓ Branch 2 taken 828008 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1183 times.
✓ Branch 6 taken 53872 times.
✗ Branch 7 not taken.
✗ Branch 0 not taken.
✓ Branch 3 taken 69120 times.
|
5135112 | return fluidMatrixInteractionAtPos(globalPos); |
95 | } | ||
96 | |||
97 | /*! | ||
98 | * \brief Returns the fluid-matrix interaction law at a given location | ||
99 | * \param globalPos The global coordinates for the given location | ||
100 | */ | ||
101 | 5175980 | auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const | |
102 | { | ||
103 |
16/16✓ Branch 0 taken 77102 times.
✓ Branch 1 taken 385122 times.
✓ Branch 2 taken 369856 times.
✓ Branch 3 taken 1985844 times.
✓ Branch 4 taken 369856 times.
✓ Branch 5 taken 1985844 times.
✓ Branch 6 taken 12529 times.
✓ Branch 7 taken 93770 times.
✓ Branch 8 taken 18804 times.
✓ Branch 9 taken 104188 times.
✓ Branch 10 taken 18804 times.
✓ Branch 11 taken 104188 times.
✓ Branch 12 taken 1841 times.
✓ Branch 13 taken 15672 times.
✓ Branch 14 taken 48 times.
✓ Branch 15 taken 1520 times.
|
5544988 | if (isInLens_(globalPos)) |
104 | 868840 | return makeFluidMatrixInteraction(pcKrSwCurveLens_); | |
105 | 4676148 | return makeFluidMatrixInteraction(pcKrSwCurveOuterDomain_); | |
106 | } | ||
107 | |||
108 | /*! | ||
109 | * \brief Returns the temperature [K] at a given location | ||
110 | * \param globalPos The global coordinates for the given location | ||
111 | */ | ||
112 | Scalar temperatureAtPos(const GlobalPosition& globalPos) const | ||
113 | { return 273.15 + 10.0; }; // -> 10°C | ||
114 | |||
115 | private: | ||
116 | 7531680 | bool isInLens_(const GlobalPosition &globalPos) const | |
117 | { | ||
118 |
19/19✓ Branch 1 taken 206246 times.
✓ Branch 2 taken 2382784 times.
✓ Branch 3 taken 1512428 times.
✓ Branch 4 taken 2478680 times.
✓ Branch 5 taken 1512428 times.
✓ Branch 6 taken 2425928 times.
✓ Branch 7 taken 1451564 times.
✓ Branch 8 taken 236390 times.
✓ Branch 9 taken 30425 times.
✓ Branch 10 taken 106864 times.
✓ Branch 11 taken 93100 times.
✓ Branch 12 taken 113664 times.
✓ Branch 13 taken 93100 times.
✓ Branch 14 taken 10630 times.
✓ Branch 15 taken 21377 times.
✓ Branch 16 taken 1776 times.
✓ Branch 17 taken 1760 times.
✓ Branch 18 taken 48 times.
✓ Branch 0 taken 574448 times.
|
13253640 | for (int i = 0; i < dimWorld; ++i) |
119 |
36/36✓ Branch 0 taken 528346 times.
✓ Branch 1 taken 187222 times.
✓ Branch 2 taken 330446 times.
✓ Branch 3 taken 197900 times.
✓ Branch 4 taken 2658236 times.
✓ Branch 5 taken 963016 times.
✓ Branch 6 taken 1635408 times.
✓ Branch 7 taken 1022828 times.
✓ Branch 8 taken 2658236 times.
✓ Branch 9 taken 963016 times.
✓ Branch 10 taken 1635408 times.
✓ Branch 11 taken 1022828 times.
✓ Branch 12 taken 2580566 times.
✓ Branch 13 taken 987934 times.
✓ Branch 14 taken 1521792 times.
✓ Branch 15 taken 1058774 times.
✓ Branch 16 taken 99677 times.
✓ Branch 17 taken 47041 times.
✓ Branch 18 taken 52948 times.
✓ Branch 19 taken 46729 times.
✓ Branch 20 taken 139287 times.
✓ Branch 21 taken 48673 times.
✓ Branch 22 taken 83772 times.
✓ Branch 23 taken 55515 times.
✓ Branch 24 taken 137982 times.
✓ Branch 25 taken 49978 times.
✓ Branch 26 taken 83772 times.
✓ Branch 27 taken 54210 times.
✓ Branch 28 taken 17306 times.
✓ Branch 29 taken 7532 times.
✓ Branch 30 taken 9166 times.
✓ Branch 31 taken 8140 times.
✓ Branch 32 taken 1008 times.
✓ Branch 33 taken 752 times.
✓ Branch 34 taken 240 times.
✓ Branch 35 taken 768 times.
|
12075808 | if (globalPos[i] < lensLowerLeft_[i] - eps_ || globalPos[i] > lensUpperRight_[i] + eps_) |
120 | return false; | ||
121 | |||
122 | return true; | ||
123 | } | ||
124 | |||
125 | static constexpr Scalar eps_ = 1e-6; | ||
126 | |||
127 | GlobalPosition lensLowerLeft_; | ||
128 | GlobalPosition lensUpperRight_; | ||
129 | |||
130 | Scalar lensK_; | ||
131 | Scalar outerK_; | ||
132 | const PcKrSwCurve pcKrSwCurveLens_; | ||
133 | const PcKrSwCurve pcKrSwCurveOuterDomain_; | ||
134 | }; | ||
135 | |||
136 | } // end namespace Dumux | ||
137 | |||
138 | #endif | ||
139 |