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 The problem for the bulk domain in the single-phase facet coupling test. | ||
11 | */ | ||
12 | |||
13 | #ifndef DUMUX_TEST_TPFAFACETCOUPLING_ONEP_BULKPROBLEM_HH | ||
14 | #define DUMUX_TEST_TPFAFACETCOUPLING_ONEP_BULKPROBLEM_HH | ||
15 | |||
16 | #include <dumux/common/properties.hh> | ||
17 | #include <dumux/common/parameters.hh> | ||
18 | #include <dumux/common/boundarytypes.hh> | ||
19 | #include <dumux/common/numeqvector.hh> | ||
20 | |||
21 | #include <dumux/porousmediumflow/problem.hh> | ||
22 | |||
23 | namespace Dumux { | ||
24 | |||
25 | /*! | ||
26 | * \ingroup FacetTests | ||
27 | * \brief Test problem for the incompressible one-phase model | ||
28 | * with coupling across the bulk grid facets. | ||
29 | */ | ||
30 | template<class TypeTag> | ||
31 | class OnePBulkProblem : public PorousMediumFlowProblem<TypeTag> | ||
32 | { | ||
33 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
34 | |||
35 | using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; | ||
36 | using PrimaryVariables = typename GridVariables::PrimaryVariables; | ||
37 | using Scalar = typename GridVariables::Scalar; | ||
38 | |||
39 | using GridGeometry = typename GridVariables::GridGeometry; | ||
40 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
41 | using SubControlVolume = typename GridGeometry::SubControlVolume; | ||
42 | using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; | ||
43 | using GridView = typename GridGeometry::GridView; | ||
44 | using Element = typename GridView::template Codim<0>::Entity; | ||
45 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
46 | |||
47 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
48 | using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>; | ||
49 | using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; | ||
50 | |||
51 | public: | ||
52 | 20 | OnePBulkProblem(std::shared_ptr<const GridGeometry> gridGeometry, | |
53 | std::shared_ptr<typename ParentType::SpatialParams> spatialParams, | ||
54 | std::shared_ptr<CouplingManager> couplingManagerPtr, | ||
55 | const std::string& paramGroup = "Bulk") | ||
56 | : ParentType(gridGeometry, spatialParams, paramGroup) | ||
57 | , couplingManagerPtr_(couplingManagerPtr) | ||
58 | 20 | , lowDimPermeability_(getParam<Scalar>("LowDim.SpatialParams.Permeability")) | |
59 |
6/18✓ Branch 3 taken 20 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 20 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 20 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 20 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
60 | , aperture_(getParam<Scalar>("LowDim.SpatialParams.Aperture")) |
60 | { | ||
61 |
9/26✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 20 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 20 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 20 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 20 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 20 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
|
40 | problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name"); |
62 | 20 | } | |
63 | |||
64 | /*! | ||
65 | * \brief The problem name. | ||
66 | */ | ||
67 | const std::string& name() const | ||
68 | { | ||
69 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | return problemName_; |
70 | } | ||
71 | |||
72 | //! Specifies the type of boundary condition at a given position | ||
73 | ✗ | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | |
74 | { | ||
75 |
3/4✓ Branch 0 taken 13200 times.
✓ Branch 1 taken 4480 times.
✓ Branch 2 taken 4440 times.
✗ Branch 3 not taken.
|
22120 | BoundaryTypes values; |
76 |
3/4✓ Branch 0 taken 13200 times.
✓ Branch 1 taken 4480 times.
✓ Branch 2 taken 4440 times.
✗ Branch 3 not taken.
|
22120 | values.setAllDirichlet(); |
77 | ✗ | return values; | |
78 | } | ||
79 | |||
80 | //! Specifies the type of interior boundary condition at a given position | ||
81 | ✗ | BoundaryTypes interiorBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const | |
82 | { | ||
83 |
3/4✓ Branch 0 taken 37410 times.
✓ Branch 1 taken 123190 times.
✓ Branch 2 taken 33000 times.
✗ Branch 3 not taken.
|
193600 | BoundaryTypes values; |
84 |
3/4✓ Branch 0 taken 37410 times.
✓ Branch 1 taken 123190 times.
✓ Branch 2 taken 33000 times.
✗ Branch 3 not taken.
|
193600 | values.setAllNeumann(); |
85 | ✗ | return values; | |
86 | } | ||
87 | |||
88 | //! Evaluates the source term at a given position. | ||
89 | ✗ | NumEqVector sourceAtPos(const GlobalPosition& globalPos) const | |
90 | { | ||
91 | using std::cos; | ||
92 | using std::cosh; | ||
93 | ✗ | Scalar u = (1.0 - lowDimPermeability_)*cos(globalPos[0])*cosh(aperture_/2); | |
94 | ✗ | return NumEqVector(u); | |
95 | } | ||
96 | |||
97 | //! Evaluates the exact solution at a given position. | ||
98 | ✗ | Scalar exact(const GlobalPosition& globalPos) const | |
99 | { | ||
100 | using std::cos; | ||
101 | using std::cosh; | ||
102 | ✗ | const auto x = globalPos[0]; | |
103 | ✗ | const auto y = globalPos[1]; | |
104 | ✗ | return lowDimPermeability_*cos(x)*cosh(y) + (1.0 - lowDimPermeability_)*cos(x)*cosh(aperture_/2); | |
105 | } | ||
106 | |||
107 | //! Evaluates the exact gradient at a given position. | ||
108 | ✗ | GlobalPosition exactGradient(const GlobalPosition& globalPos) const | |
109 | { | ||
110 | using std::cos; | ||
111 | using std::sin; | ||
112 | using std::cosh; | ||
113 | using std::sinh; | ||
114 | |||
115 | ✗ | const auto x = globalPos[0]; | |
116 | ✗ | const auto y = globalPos[1]; | |
117 | |||
118 | ✗ | GlobalPosition gradU; | |
119 | ✗ | gradU[0] = -lowDimPermeability_*sin(x)*cosh(y) + (lowDimPermeability_ - 1.0)*sin(x)*cosh(aperture_/2); | |
120 | ✗ | gradU[1] = lowDimPermeability_*cos(x)*sinh(y); | |
121 | |||
122 | ✗ | return gradU; | |
123 | } | ||
124 | |||
125 | //! Evaluates the Dirichlet boundary condition for a given position. | ||
126 | PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const | ||
127 | 13160 | { return PrimaryVariables(exact(globalPos)); } | |
128 | |||
129 | //! Evaluates the Neumann boundary condition for a boundary segment. | ||
130 | template<class ElementVolumeVariables, class ElementFluxVarsCache> | ||
131 | ✗ | NumEqVector neumann(const Element& element, | |
132 | const FVElementGeometry& fvGeometry, | ||
133 | const ElementVolumeVariables& elemVolVars, | ||
134 | const ElementFluxVarsCache& elemFluxVarsCache, | ||
135 | const SubControlVolumeFace& scvf) const | ||
136 | { | ||
137 | ✗ | auto pos = scvf.ipGlobal(); | |
138 | ✗ | const Scalar k = this->spatialParams().permeabilityAtPos(pos); | |
139 | ✗ | const auto gradU = exactGradient(pos); | |
140 | ✗ | return NumEqVector( -1.0*k*(gradU*scvf.unitOuterNormal()) ); | |
141 | } | ||
142 | |||
143 | //! Evaluates the initial conditions. | ||
144 | ✗ | PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const | |
145 | ✗ | { return PrimaryVariables(1.0); } | |
146 | |||
147 | //! Returns reference to the coupling manager. | ||
148 | const CouplingManager& couplingManager() const | ||
149 |
16/17✓ Branch 0 taken 1893760 times.
✓ Branch 1 taken 37400 times.
✓ Branch 2 taken 1893760 times.
✓ Branch 3 taken 37400 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 26400 times.
✓ Branch 7 taken 1214400 times.
✓ Branch 8 taken 26400 times.
✓ Branch 9 taken 1214400 times.
✓ Branch 10 taken 1214400 times.
✓ Branch 11 taken 26400 times.
✓ Branch 12 taken 1214400 times.
✓ Branch 13 taken 26400 times.
✓ Branch 16 taken 26400 times.
✓ Branch 17 taken 1214400 times.
✓ Branch 18 taken 26400 times.
✓ Branch 19 taken 1214400 times.
|
11927520 | { return *couplingManagerPtr_; } |
150 | |||
151 | private: | ||
152 | std::shared_ptr<CouplingManager> couplingManagerPtr_; | ||
153 | Scalar lowDimPermeability_; | ||
154 | Scalar aperture_; | ||
155 | std::string problemName_; | ||
156 | }; | ||
157 | |||
158 | } // end namespace Dumux | ||
159 | |||
160 | #endif | ||
161 |