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 | * | ||
10 | * \brief A test problem for the one-phase pore network model. | ||
11 | */ | ||
12 | #ifndef DUMUX_PNM1P_PROBLEM_HH | ||
13 | #define DUMUX_PNM1P_PROBLEM_HH | ||
14 | |||
15 | // base problem | ||
16 | #include <dumux/porousmediumflow/problem.hh> | ||
17 | // Pore network model | ||
18 | #include <dumux/porenetwork/1p/model.hh> | ||
19 | |||
20 | #include <dumux/common/boundarytypes.hh> | ||
21 | |||
22 | namespace Dumux { | ||
23 | template <class TypeTag> | ||
24 | class PNMOnePProblem; | ||
25 | |||
26 | template <class TypeTag> | ||
27 | 10 | class PNMOnePProblem : public PorousMediumFlowProblem<TypeTag> | |
28 | { | ||
29 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
30 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
31 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
32 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
33 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
34 | using GridView = typename GridGeometry::GridView; | ||
35 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
36 | using SubControlVolume = typename FVElementGeometry::SubControlVolume; | ||
37 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
38 | using Labels = GetPropType<TypeTag, Properties::Labels>; | ||
39 | |||
40 | using Element = typename GridView::template Codim<0>::Entity; | ||
41 | using Vertex = typename GridView::template Codim<GridView::dimension>::Entity; | ||
42 | |||
43 | public: | ||
44 | template<class SpatialParams> | ||
45 | 5 | PNMOnePProblem(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<SpatialParams> spatialParams) | |
46 |
7/20✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 9 taken 5 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 5 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 5 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 5 times.
✓ Branch 18 taken 5 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
20 | : ParentType(gridGeometry, spatialParams) |
47 | { | ||
48 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | testHydrostaticPressure_ = getParamFromGroup<bool>(this->paramGroup(), "Problem.EnableGravity"); |
49 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | inletPressure_ = getParam<Scalar>("Problem.InletPressure"); |
50 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | outletPressure_ = getParam<Scalar>("Problem.OutletPressure"); |
51 | 5 | } | |
52 | |||
53 | /*! | ||
54 | * \name Simulation steering | ||
55 | */ | ||
56 | // \{ | ||
57 | |||
58 | /*! | ||
59 | * \name Boundary conditions | ||
60 | */ | ||
61 | // \{ | ||
62 | //! Specifies which kind of boundary condition should be used for | ||
63 | //! which equation for a finite volume on the boundary. | ||
64 | 2534 | BoundaryTypes boundaryTypes(const Element& element, const SubControlVolume& scv) const | |
65 | { | ||
66 |
2/2✓ Branch 0 taken 1133 times.
✓ Branch 1 taken 449 times.
|
2534 | BoundaryTypes bcTypes; |
67 | 6926 | if (isInletPore_(scv) || isOutletPore_(scv)) | |
68 | bcTypes.setAllDirichlet(); | ||
69 | #if !ISOTHERMAL | ||
70 | 1904 | bcTypes.setDirichlet(Indices::temperatureIdx); | |
71 | #endif | ||
72 | 2534 | return bcTypes; | |
73 | } | ||
74 | |||
75 | /*! | ||
76 | * \brief Evaluate the boundary conditions for a Dirichlet | ||
77 | * control volume. | ||
78 | * | ||
79 | * \param values The Dirichlet values for the primary variables | ||
80 | * \param vertex The vertex (pore body) for which the condition is evaluated | ||
81 | * | ||
82 | * For this method, the \a values parameter stores primary variables. | ||
83 | */ | ||
84 | 952 | PrimaryVariables dirichlet(const Element& element, | |
85 | const SubControlVolume& scv) const | ||
86 | { | ||
87 |
2/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 247 times.
✓ Branch 3 taken 35 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1234 | PrimaryVariables values(0.0); |
88 | 2468 | if(isInletPore_(scv)) | |
89 | 1471 | values[Indices::pressureIdx] = inletPressure_; | |
90 | else | ||
91 | 715 | values[Indices::pressureIdx] = outletPressure_; | |
92 | #if !ISOTHERMAL | ||
93 | 1904 | if(isInletPore_(scv)) | |
94 | 1224 | values[Indices::temperatureIdx] = 273.15 +25; | |
95 | else | ||
96 | 680 | values[Indices::temperatureIdx] = 273.15 +20; | |
97 | #endif | ||
98 | 952 | return values; | |
99 | } | ||
100 | |||
101 | |||
102 | // \} | ||
103 | |||
104 | /*! | ||
105 | * \name Volume terms | ||
106 | */ | ||
107 | // \{ | ||
108 | /*! | ||
109 | * \brief Evaluate the source term for all phases within a given | ||
110 | * sub-control-volume. | ||
111 | * | ||
112 | * This is the method for the case where the source term is | ||
113 | * potentially solution dependent and requires some quantities that | ||
114 | * are specific to the fully-implicit method. | ||
115 | * | ||
116 | * \param element The finite element | ||
117 | * \param fvGeometry The finite-volume geometry | ||
118 | * \param elemVolVars All volume variables for the element | ||
119 | * \param scv The sub control volume | ||
120 | * | ||
121 | * For this method, the return parameter stores the conserved quantity rate | ||
122 | * generated or annihilate per volume unit. Positive values mean | ||
123 | * that the conserved quantity is created, negative ones mean that it vanishes. | ||
124 | * E.g. for the mass balance that would be a mass rate in \f$ [ kg / (m^3 \cdot s)] \f$. | ||
125 | */ | ||
126 | template<class ElementVolumeVariables> | ||
127 | ✗ | PrimaryVariables source(const Element &element, | |
128 | const FVElementGeometry& fvGeometry, | ||
129 | const ElementVolumeVariables& elemVolVars, | ||
130 | const SubControlVolume &scv) const | ||
131 | { | ||
132 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 7626 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 148 times.
|
194094 | return PrimaryVariables(0); |
133 | } | ||
134 | |||
135 | // \} | ||
136 | |||
137 | /*! | ||
138 | * \brief Evaluate the initial value for a control volume. | ||
139 | * | ||
140 | * For this method, the \a priVars parameter stores primary | ||
141 | * variables. | ||
142 | */ | ||
143 | ✗ | PrimaryVariables initial(const Vertex& vertex) const | |
144 | { | ||
145 | 270 | PrimaryVariables values(0.0); | |
146 | 270 | values[Indices::pressureIdx] = 1e5; | |
147 | #if !ISOTHERMAL | ||
148 | 360 | values[Indices::temperatureIdx] = 273.15 +20; | |
149 | #endif | ||
150 | ✗ | return values; | |
151 | } | ||
152 | |||
153 | // \} | ||
154 | |||
155 | private: | ||
156 | |||
157 | bool isInletPore_(const SubControlVolume& scv) const | ||
158 | { | ||
159 |
24/24✓ Branch 0 taken 612 times.
✓ Branch 1 taken 340 times.
✓ Branch 2 taken 612 times.
✓ Branch 3 taken 340 times.
✓ Branch 4 taken 612 times.
✓ Branch 5 taken 340 times.
✓ Branch 6 taken 1764 times.
✓ Branch 7 taken 756 times.
✓ Branch 8 taken 1764 times.
✓ Branch 9 taken 756 times.
✓ Branch 10 taken 1764 times.
✓ Branch 11 taken 756 times.
✓ Branch 12 taken 533 times.
✓ Branch 13 taken 617 times.
✓ Branch 14 taken 533 times.
✓ Branch 15 taken 617 times.
✓ Branch 16 taken 533 times.
✓ Branch 17 taken 617 times.
✓ Branch 18 taken 35 times.
✓ Branch 19 taken 63 times.
✓ Branch 20 taken 35 times.
✓ Branch 21 taken 63 times.
✓ Branch 22 taken 35 times.
✓ Branch 23 taken 63 times.
|
14160 | return this->gridGeometry().poreLabel(scv.dofIndex()) == Labels::inlet; |
160 | } | ||
161 | |||
162 | bool isOutletPore_(const SubControlVolume& scv) const | ||
163 | { | ||
164 |
2/2✓ Branch 0 taken 385 times.
✓ Branch 1 taken 1088 times.
|
1473 | if (testHydrostaticPressure_) |
165 | return false; | ||
166 | |||
167 |
6/6✓ Branch 0 taken 340 times.
✓ Branch 1 taken 45 times.
✓ Branch 2 taken 340 times.
✓ Branch 3 taken 45 times.
✓ Branch 4 taken 340 times.
✓ Branch 5 taken 45 times.
|
1155 | return this->gridGeometry().poreLabel(scv.dofIndex()) == Labels::outlet; |
168 | } | ||
169 | |||
170 | bool testHydrostaticPressure_; | ||
171 | Scalar inletPressure_; | ||
172 | Scalar outletPressure_; | ||
173 | }; | ||
174 | } //end namespace Dumux | ||
175 | |||
176 | #endif | ||
177 |