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 | * \brief A test problem for the one-phase pore network model. | ||
10 | */ | ||
11 | #ifndef DUMUX_TEST_MULTIDOMAIN_DUALNETWORK_PROBLEM_VOID_HH | ||
12 | #define DUMUX_TEST_MULTIDOMAIN_DUALNETWORK_PROBLEM_VOID_HH | ||
13 | |||
14 | #include <dumux/porousmediumflow/problem.hh> | ||
15 | #include <dumux/porenetwork/1p/model.hh> | ||
16 | |||
17 | #include <dumux/common/boundarytypes.hh> | ||
18 | #include <dumux/common/numeqvector.hh> | ||
19 | |||
20 | namespace Dumux { | ||
21 | |||
22 | template <class TypeTag> | ||
23 | class VoidSubProblem : public PorousMediumFlowProblem<TypeTag> | ||
24 | { | ||
25 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
26 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
27 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
28 | using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; | ||
29 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
30 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
31 | using GridView = typename GridGeometry::GridView; | ||
32 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
33 | using SubControlVolume = typename FVElementGeometry::SubControlVolume; | ||
34 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
35 | using Labels = GetPropType<TypeTag, Properties::Labels>; | ||
36 | using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; | ||
37 | |||
38 | using Element = typename GridView::template Codim<0>::Entity; | ||
39 | using Vertex = typename GridView::template Codim<GridView::dimension>::Entity; | ||
40 | |||
41 | using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>; | ||
42 | |||
43 | enum class SourceMode {conduction, convection, max}; | ||
44 | |||
45 | public: | ||
46 | template<class SpatialParams> | ||
47 | 1 | VoidSubProblem(std::shared_ptr<const GridGeometry> gridGeometry, | |
48 | std::shared_ptr<SpatialParams> spatialParams, | ||
49 | std::shared_ptr<const CouplingManager> couplingManager) | ||
50 |
9/30✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
|
4 | : ParentType(gridGeometry, spatialParams, "Void"), couplingManager_(couplingManager) |
51 | { | ||
52 |
9/24✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 1 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.
|
2 | problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name"); |
53 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | pressureIn_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InletPressure"); |
54 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | pressureOut_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.OutletPressure"); |
55 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | temperatureInitial_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InitialTemperature"); |
56 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | pressureInitial_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InitialPressure"); |
57 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | temperatureIn_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.InletTemperature"); |
58 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | temperatureBottom_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.BottomTemperature"); |
59 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | enableCoupling_ = getParamFromGroup<bool>(this->paramGroup(), "Problem.EnableCoupling", true); |
60 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | heatingOn_ = getParamFromGroup<bool>(this->paramGroup(), "Problem.EnableHeating", true); |
61 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | fixedOutletTemperature_ = getParamFromGroup<bool>(this->paramGroup(), "Problem.FixedOutletTemperature", false); |
62 |
1/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
1 | useRobinInlet_ = getParamFromGroup<bool>(this->paramGroup(), "Problem.UseRobinInlet", true); |
63 | |||
64 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (fixedOutletTemperature_) |
65 | ✗ | temperatureOut_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.OutletTemperature"); | |
66 | |||
67 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | inletIndex_ = getParamFromGroup<int>(this->paramGroup(), "Problem.InletIndex"); |
68 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | outletIndex_ = getParamFromGroup<int>(this->paramGroup(), "Problem.OutletIndex"); |
69 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | heaterIndex_ = getParamFromGroup<int>(this->paramGroup(), "Problem.HeaterIndex"); |
70 | |||
71 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
|
2 | const auto mode = getParamFromGroup<std::string>(this->paramGroup(), "Problem.DualNetworkSourceMode", "max"); |
72 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | if (mode == "conduction") |
73 | ✗ | sourceMode_ = SourceMode::conduction; | |
74 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | else if (mode == "convection") |
75 | 1 | sourceMode_ = SourceMode::convection; | |
76 | else | ||
77 | ✗ | sourceMode_ = SourceMode::max; | |
78 | 1 | } | |
79 | |||
80 | const std::string& name() const | ||
81 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | { return problemName_; } |
82 | |||
83 | void setGridVariables(std::shared_ptr<GridVariables> gridVars) | ||
84 | { | ||
85 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | gridVars_ = gridVars; |
86 | } | ||
87 | |||
88 | 6790 | BoundaryTypes boundaryTypes(const Element& element, const SubControlVolume& scv) const | |
89 | { | ||
90 | 6790 | BoundaryTypes bcTypes; | |
91 | 13580 | if (onInletBoundary_(scv)) | |
92 | { | ||
93 |
2/2✓ Branch 0 taken 603 times.
✓ Branch 1 taken 804 times.
|
1407 | bcTypes.setDirichlet(Indices::pressureIdx); |
94 |
2/2✓ Branch 0 taken 603 times.
✓ Branch 1 taken 804 times.
|
1407 | if (!useRobinInlet_) |
95 | 603 | bcTypes.setDirichlet(Indices::temperatureIdx); | |
96 | else | ||
97 | 804 | bcTypes.setNeumann(Indices::energyEqIdx); | |
98 | } | ||
99 | 10766 | else if (onOutletBoundary(scv)) | |
100 | { | ||
101 | // bcTypes.setAllNeumann(); | ||
102 |
2/2✓ Branch 0 taken 585 times.
✓ Branch 1 taken 780 times.
|
1365 | bcTypes.setDirichlet(Indices::pressureIdx); |
103 |
2/2✓ Branch 0 taken 585 times.
✓ Branch 1 taken 780 times.
|
1365 | if (fixedOutletTemperature_) |
104 | 585 | bcTypes.setDirichlet(Indices::temperatureIdx); | |
105 | else | ||
106 | 780 | bcTypes.setNeumann(Indices::energyEqIdx); | |
107 | } | ||
108 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 805 times.
|
805 | else if (onHeaterBoundary_(scv) && heatingOn_) |
109 | { | ||
110 | 805 | bcTypes.setDirichlet(Indices::temperatureIdx); | |
111 | 805 | bcTypes.setNeumann(Indices::conti0EqIdx); | |
112 | } | ||
113 | else // neuman for the remaining boundaries | ||
114 | bcTypes.setAllNeumann(); | ||
115 | |||
116 | // treat insular pores connected only to the solid phase | ||
117 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 6790 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6790 times.
|
13580 | const auto poreLabel = this->gridGeometry().poreLabel(scv.dofIndex()); |
118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6790 times.
|
6790 | if (poreLabel == 22) |
119 | ✗ | bcTypes.setDirichlet(Indices::pressureIdx); | |
120 | |||
121 | 6790 | return bcTypes; | |
122 | } | ||
123 | |||
124 | 2044 | PrimaryVariables dirichlet(const Element& element, | |
125 | const SubControlVolume& scv) const | ||
126 | { | ||
127 | 2044 | PrimaryVariables values(0.0); | |
128 | 4088 | if (onInletBoundary_(scv)) | |
129 | { | ||
130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 804 times.
|
804 | values[Indices::pressureIdx] = pressureIn_; |
131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 804 times.
|
804 | values[Indices::temperatureIdx] = temperatureIn_; |
132 | |||
133 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 804 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 804 times.
|
1608 | if (!dirichletValuesForOutput_.empty()) |
134 | ✗ | values[Indices::temperatureIdx] = dirichletValuesForOutput_[scv.dofIndex()]; | |
135 | } | ||
136 | 2480 | else if (onHeaterBoundary_(scv)) | |
137 | 920 | values[Indices::temperatureIdx] = temperatureBottom_; | |
138 | else | ||
139 | { | ||
140 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 780 times.
|
780 | values[Indices::pressureIdx] = pressureOut_; |
141 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 780 times.
|
780 | values[Indices::temperatureIdx] = temperatureOut_; |
142 | |||
143 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 780 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 780 times.
|
1560 | if (!dirichletValuesForOutput_.empty()) |
144 | ✗ | values[Indices::temperatureIdx] = dirichletValuesForOutput_[scv.dofIndex()]; | |
145 | } | ||
146 | |||
147 | 2044 | return values; | |
148 | } | ||
149 | |||
150 | |||
151 | template<class ElementVolumeVariables> | ||
152 | 426989 | NumEqVector source(const Element& element, | |
153 | const FVElementGeometry& fvGeometry, | ||
154 | const ElementVolumeVariables& elemVolVars, | ||
155 | const SubControlVolume& scv) const | ||
156 | { | ||
157 | 426989 | NumEqVector value(0.0); | |
158 | |||
159 |
2/4✓ Branch 0 taken 426989 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 426989 times.
✗ Branch 5 not taken.
|
426989 | if (enableCoupling_ && couplingManager_->isCoupledPore(CouplingManager::voidDomainIdx, scv.dofIndex())) |
160 | { | ||
161 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 426989 times.
|
426989 | if (sourceMode_ == SourceMode::conduction) |
162 | { | ||
163 | ✗ | value[Indices::energyEqIdx] = couplingManager_->conductionSource( | |
164 | CouplingManager::voidDomainIdx, element, fvGeometry, elemVolVars, scv | ||
165 | ); | ||
166 | } | ||
167 |
1/2✓ Branch 0 taken 426989 times.
✗ Branch 1 not taken.
|
426989 | else if (sourceMode_ == SourceMode::convection) |
168 | { | ||
169 | 853978 | value[Indices::energyEqIdx] = couplingManager_->convectionSource( | |
170 | CouplingManager::voidDomainIdx, element, fvGeometry, elemVolVars, scv | ||
171 | ); | ||
172 | } | ||
173 | else | ||
174 | { | ||
175 | ✗ | const Scalar condSource = couplingManager_->conductionSource( | |
176 | CouplingManager::voidDomainIdx, element, fvGeometry, elemVolVars, scv | ||
177 | ); | ||
178 | ✗ | const Scalar convSource = couplingManager_->convectionSource( | |
179 | CouplingManager::voidDomainIdx, element, fvGeometry, elemVolVars, scv | ||
180 | ); | ||
181 | using std::abs; | ||
182 | ✗ | if (abs(condSource) > abs(convSource)) | |
183 | ✗ | value[Indices::energyEqIdx] = condSource; | |
184 | else | ||
185 | ✗ | value[Indices::energyEqIdx] = convSource; | |
186 | } | ||
187 | } | ||
188 | |||
189 |
2/2✓ Branch 1 taken 44249 times.
✓ Branch 2 taken 382740 times.
|
426989 | value[Indices::energyEqIdx] += robinInletHeatFlux(element, fvGeometry, elemVolVars, scv); |
190 | |||
191 | // outflow condition for heat | ||
192 |
2/2✓ Branch 0 taken 43664 times.
✓ Branch 1 taken 585 times.
|
44249 | if (onOutletBoundary(scv) && !fixedOutletTemperature_) |
193 | 43664 | value[Indices::energyEqIdx] += heatOutFlowCondition(element, fvGeometry, elemVolVars, scv); | |
194 | |||
195 | 426989 | return value; | |
196 | } | ||
197 | |||
198 | |||
199 | template<class ElementVolumeVariables> | ||
200 | 43859 | Scalar heatOutFlowCondition(const Element& element, | |
201 | const FVElementGeometry& fvGeometry, | ||
202 | const ElementVolumeVariables& elemVolVars, | ||
203 | const SubControlVolume& scv) const | ||
204 | { | ||
205 | 43859 | Scalar value = 0.0; | |
206 | using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; | ||
207 |
3/6✓ Branch 1 taken 43859 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 43859 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 43859 times.
✗ Branch 8 not taken.
|
131577 | auto elemFluxVarsCache = localView(gridVars_->gridFluxVarsCache()); |
208 |
1/2✓ Branch 1 taken 43859 times.
✗ Branch 2 not taken.
|
43859 | elemFluxVarsCache.bindElement(element, fvGeometry, elemVolVars); |
209 | |||
210 |
2/2✓ Branch 0 taken 43859 times.
✓ Branch 1 taken 43859 times.
|
131577 | for (auto&& scvf : scvfs(fvGeometry)) |
211 | { | ||
212 |
1/2✓ Branch 1 taken 43859 times.
✗ Branch 2 not taken.
|
43859 | FluxVariables fluxVars; |
213 |
1/2✓ Branch 1 taken 43859 times.
✗ Branch 2 not taken.
|
43859 | fluxVars.init(*this, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache); |
214 |
1/4✓ Branch 1 taken 43859 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
43859 | const Scalar flux = fluxVars.advectiveFlux(0, |
215 | ✗ | [&](const auto& volVars) | |
216 | { | ||
217 | 263154 | return elemVolVars[scv].mobility(0) | |
218 | 350872 | * elemVolVars[scv].density(0) | |
219 | 263154 | * elemVolVars[scv].enthalpy(0); | |
220 | } | ||
221 | ); | ||
222 | |||
223 |
4/4✓ Branch 0 taken 18206 times.
✓ Branch 1 taken 25653 times.
✓ Branch 2 taken 18206 times.
✓ Branch 3 taken 25653 times.
|
87718 | const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); |
224 | |||
225 |
2/2✓ Branch 0 taken 18206 times.
✓ Branch 1 taken 25653 times.
|
43859 | if (insideScv.dofIndex() == scv.dofIndex()) |
226 | 18206 | value += flux / scv.volume(); | |
227 | else | ||
228 | 25653 | value -= flux / scv.volume(); | |
229 | } | ||
230 |
1/2✓ Branch 0 taken 43859 times.
✗ Branch 1 not taken.
|
87718 | return value; |
231 | } | ||
232 | |||
233 | template<class ElementVolumeVariables> | ||
234 | 426989 | Scalar robinInletHeatFlux(const Element& element, | |
235 | const FVElementGeometry& fvGeometry, | ||
236 | const ElementVolumeVariables& elemVolVars, | ||
237 | const SubControlVolume& scv) const | ||
238 | { | ||
239 | 426989 | Scalar flux = 0.0; | |
240 | |||
241 |
2/2✓ Branch 0 taken 420832 times.
✓ Branch 1 taken 6157 times.
|
426989 | if (useRobinInlet_ && onInletBoundary_(scv)) |
242 | { | ||
243 | 38840 | flux += robinInletAdvectiveHeatFlux(element, fvGeometry, elemVolVars, scv); | |
244 | 38840 | flux += robinInletConductiveHeatFlux(element, fvGeometry, elemVolVars, scv); | |
245 | } | ||
246 | |||
247 | 426989 | return flux; | |
248 | } | ||
249 | |||
250 | template<class ElementVolumeVariables> | ||
251 | 38840 | Scalar robinInletAdvectiveHeatFlux(const Element& element, | |
252 | const FVElementGeometry& fvGeometry, | ||
253 | const ElementVolumeVariables& elemVolVars, | ||
254 | const SubControlVolume& scv) const | ||
255 | { | ||
256 | using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; | ||
257 |
4/8✓ Branch 1 taken 38840 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 38840 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 38840 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 38840 times.
✗ Branch 10 not taken.
|
194200 | auto elemFluxVarsCache = localView(gridVars_->gridFluxVarsCache()); |
258 |
1/2✓ Branch 1 taken 38840 times.
✗ Branch 2 not taken.
|
38840 | elemFluxVarsCache.bindElement(element, fvGeometry, elemVolVars); |
259 |
1/2✓ Branch 0 taken 38840 times.
✗ Branch 1 not taken.
|
38840 | const auto& volVars = elemVolVars[scv]; |
260 | |||
261 |
2/4✓ Branch 0 taken 38840 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38840 times.
✗ Branch 3 not taken.
|
77680 | for (auto&& scvf : scvfs(fvGeometry)) |
262 | { | ||
263 |
1/2✓ Branch 1 taken 38840 times.
✗ Branch 2 not taken.
|
38840 | FluxVariables fluxVars; |
264 |
1/2✓ Branch 1 taken 38840 times.
✗ Branch 2 not taken.
|
38840 | fluxVars.init(*this, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache); |
265 |
1/2✓ Branch 1 taken 38840 times.
✗ Branch 2 not taken.
|
38840 | const Scalar enthalypy = ElementVolumeVariables::VolumeVariables::FluidSystem::enthalpy( |
266 |
1/2✓ Branch 1 taken 38840 times.
✗ Branch 2 not taken.
|
38840 | temperatureIn_, volVars.pressure(0) |
267 | ); | ||
268 | |||
269 |
1/4✓ Branch 1 taken 38840 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
38840 | const Scalar result = fluxVars.advectiveFlux(0, |
270 | ✗ | [&](const auto& v) | |
271 | { | ||
272 | ✗ | return volVars.mobility(0) | |
273 | 233040 | * volVars.density(0)*enthalypy; | |
274 | } | ||
275 | ); | ||
276 |
4/4✓ Branch 0 taken 22032 times.
✓ Branch 1 taken 16808 times.
✓ Branch 2 taken 22032 times.
✓ Branch 3 taken 16808 times.
|
77680 | const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx()); |
277 | |||
278 |
2/2✓ Branch 0 taken 22032 times.
✓ Branch 1 taken 16808 times.
|
38840 | if (insideScv.dofIndex() == scv.dofIndex()) |
279 | 22032 | return result / scv.volume(); | |
280 | else | ||
281 | 16808 | return -result / scv.volume(); | |
282 | } | ||
283 | |||
284 | ✗ | DUNE_THROW(Dune::InvalidStateException, "Flux failed"); | |
285 | } | ||
286 | |||
287 | template<class ElementVolumeVariables> | ||
288 | 39041 | Scalar robinInletConductiveHeatFlux(const Element& element, | |
289 | const FVElementGeometry& fvGeometry, | ||
290 | const ElementVolumeVariables& elemVolVars, | ||
291 | const SubControlVolume& scv) const | ||
292 | { | ||
293 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 39040 times.
|
39041 | const auto& volVars = elemVolVars[scv]; |
294 | 39041 | const Scalar r = volVars.poreInscribedRadius(); | |
295 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 39040 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
39041 | static const Scalar lambdaFluid = getParam<Scalar>("2.Component.LiquidThermalConductivity"); |
296 |
5/8✓ Branch 0 taken 1 times.
✓ Branch 1 taken 39040 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
|
39041 | static const Scalar dPadding = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.PaddingThickness"); |
297 |
5/8✓ Branch 0 taken 1 times.
✓ Branch 1 taken 39040 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
|
39041 | static const Scalar robinShapeFactor = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.RobinShapeFactor", 1.0); |
298 | 39041 | const Scalar A = M_PI * r*r * robinShapeFactor; | |
299 | |||
300 | 39041 | return (temperatureIn_ - volVars.temperature()) | |
301 | 117123 | * A * lambdaFluid / (r + dPadding) / (scv.volume() * fvGeometry.gridGeometry().coordinationNumber()[scv.dofIndex()]); | |
302 | } | ||
303 | |||
304 | ✗ | PrimaryVariables initial(const Vertex& vertex) const | |
305 | { | ||
306 | 556 | PrimaryVariables values(0.0); | |
307 | 556 | values[Indices::pressureIdx] = pressureInitial_; | |
308 | 1112 | values[Indices::temperatureIdx] = temperatureInitial_; | |
309 | ✗ | return values; | |
310 | } | ||
311 | |||
312 | ✗ | int outletPoreLabel() const | |
313 | ✗ | { return outletIndex_; } | |
314 | |||
315 | ✗ | int inletPoreLabel() const | |
316 | ✗ | { return inletIndex_; } | |
317 | |||
318 | ✗ | int heaterPoreLabel() const | |
319 | ✗ | { return heaterIndex_; } | |
320 | |||
321 | template<class Sol> | ||
322 | 1 | void setOutletToDirichletForOutput(const Sol& sol) | |
323 | { | ||
324 | 1 | fixedOutletTemperature_ = true; | |
325 | 1 | useRobinInlet_ = false; | |
326 | 1 | dirichletValuesForOutput_.resize(sol.size()); | |
327 | |||
328 |
4/4✓ Branch 3 taken 556 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 556 times.
✓ Branch 6 taken 1 times.
|
1115 | for (const auto& vertex : vertices(this->gridGeometry().gridView())) |
329 | { | ||
330 | 1668 | const auto vIdx = this->gridGeometry().vertexMapper().index(vertex); | |
331 | 2224 | dirichletValuesForOutput_[vIdx] = sol[vIdx][Indices::temperatureIdx]; | |
332 | } | ||
333 | 1 | } | |
334 | |||
335 | bool onOutletBoundary(const SubControlVolume& scv) const | ||
336 |
18/18✓ Branch 0 taken 44249 times.
✓ Branch 1 taken 382740 times.
✓ Branch 2 taken 44249 times.
✓ Branch 3 taken 382740 times.
✓ Branch 4 taken 44249 times.
✓ Branch 5 taken 382740 times.
✓ Branch 6 taken 1365 times.
✓ Branch 7 taken 4018 times.
✓ Branch 8 taken 1365 times.
✓ Branch 9 taken 4018 times.
✓ Branch 10 taken 1365 times.
✓ Branch 11 taken 4018 times.
✓ Branch 12 taken 195 times.
✓ Branch 13 taken 1819 times.
✓ Branch 14 taken 195 times.
✓ Branch 15 taken 1819 times.
✓ Branch 16 taken 195 times.
✓ Branch 17 taken 1819 times.
|
1303158 | { return this->gridGeometry().poreLabel(scv.dofIndex()) == outletIndex_; } |
337 | |||
338 | ✗ | auto sourceMode() const | |
339 | ✗ | { return sourceMode_; } | |
340 | |||
341 | private: | ||
342 | |||
343 | bool onInletBoundary_(const SubControlVolume& scv) const | ||
344 |
18/18✓ Branch 0 taken 804 times.
✓ Branch 1 taken 1240 times.
✓ Branch 2 taken 804 times.
✓ Branch 3 taken 1240 times.
✓ Branch 4 taken 804 times.
✓ Branch 5 taken 1240 times.
✓ Branch 6 taken 38840 times.
✓ Branch 7 taken 381992 times.
✓ Branch 8 taken 38840 times.
✓ Branch 9 taken 381992 times.
✓ Branch 10 taken 38840 times.
✓ Branch 11 taken 381992 times.
✓ Branch 12 taken 1407 times.
✓ Branch 13 taken 5383 times.
✓ Branch 14 taken 1407 times.
✓ Branch 15 taken 5383 times.
✓ Branch 16 taken 1407 times.
✓ Branch 17 taken 5383 times.
|
1288998 | { return this->gridGeometry().poreLabel(scv.dofIndex()) == inletIndex_; } |
345 | |||
346 | bool onHeaterBoundary_(const SubControlVolume& scv) const | ||
347 |
12/12✓ Branch 0 taken 460 times.
✓ Branch 1 taken 780 times.
✓ Branch 2 taken 460 times.
✓ Branch 3 taken 780 times.
✓ Branch 4 taken 460 times.
✓ Branch 5 taken 780 times.
✓ Branch 6 taken 805 times.
✓ Branch 7 taken 3213 times.
✓ Branch 8 taken 805 times.
✓ Branch 9 taken 3213 times.
✓ Branch 10 taken 805 times.
✓ Branch 11 taken 3213 times.
|
15774 | { return this->gridGeometry().poreLabel(scv.dofIndex()) == heaterIndex_; } |
348 | |||
349 | std::shared_ptr<const CouplingManager> couplingManager_; | ||
350 | std::shared_ptr<GridVariables> gridVars_; | ||
351 | |||
352 | std::string problemName_; | ||
353 | Scalar pressureIn_; | ||
354 | Scalar pressureOut_; | ||
355 | Scalar temperatureInitial_; | ||
356 | Scalar pressureInitial_; | ||
357 | Scalar temperatureIn_; | ||
358 | Scalar temperatureOut_; | ||
359 | Scalar temperatureBottom_; | ||
360 | bool enableCoupling_; | ||
361 | bool heatingOn_; | ||
362 | bool fixedOutletTemperature_; | ||
363 | int inletIndex_; | ||
364 | int outletIndex_; | ||
365 | int heaterIndex_; | ||
366 | SourceMode sourceMode_; | ||
367 | std::vector<Scalar> dirichletValuesForOutput_; | ||
368 | bool useRobinInlet_; | ||
369 | }; | ||
370 | |||
371 | } // end namespace Dumux | ||
372 | |||
373 | #endif | ||
374 |