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 1pnc facet coupling test. | ||
11 | */ | ||
12 | #ifndef DUMUX_TEST_TPFAFACETCOUPLING_ONEPNC_BULKPROBLEM_HH | ||
13 | #define DUMUX_TEST_TPFAFACETCOUPLING_ONEPNC_BULKPROBLEM_HH | ||
14 | |||
15 | #include <dumux/common/properties.hh> | ||
16 | #include <dumux/common/parameters.hh> | ||
17 | #include <dumux/common/boundarytypes.hh> | ||
18 | #include <dumux/common/numeqvector.hh> | ||
19 | |||
20 | #include <dumux/porousmediumflow/problem.hh> | ||
21 | |||
22 | // defined in CMakeLists.txt | ||
23 | #ifndef USEMIXEDBCS | ||
24 | #define USEMIXEDBCS false | ||
25 | #endif | ||
26 | |||
27 | namespace Dumux { | ||
28 | |||
29 | /*! | ||
30 | * \ingroup FacetTests | ||
31 | * \brief Test problem for the 1pnc model with | ||
32 | * coupling across the bulk grid facets. | ||
33 | */ | ||
34 | template<class TypeTag> | ||
35 | class OnePNCBulkProblem : public PorousMediumFlowProblem<TypeTag> | ||
36 | { | ||
37 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
38 | |||
39 | using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; | ||
40 | using PrimaryVariables = typename GridVariables::PrimaryVariables; | ||
41 | using Scalar = typename GridVariables::Scalar; | ||
42 | |||
43 | using GridGeometry = typename GridVariables::GridGeometry; | ||
44 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
45 | using SubControlVolume = typename GridGeometry::SubControlVolume; | ||
46 | using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; | ||
47 | using GridView = typename GridGeometry::GridView; | ||
48 | using Element = typename GridView::template Codim<0>::Entity; | ||
49 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
50 | |||
51 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
52 | using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>; | ||
53 | using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; | ||
54 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
55 | using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; | ||
56 | |||
57 | using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; | ||
58 | static constexpr bool enableHeatConduction = ModelTraits::enableEnergyBalance(); | ||
59 | |||
60 | enum | ||
61 | { | ||
62 | // indices of the primary variables | ||
63 | pressureIdx = Indices::pressureIdx, | ||
64 | H2OIdx = FluidSystem::compIdx(FluidSystem::MultiPhaseFluidSystem::H2OIdx), | ||
65 | N2Idx = FluidSystem::compIdx(FluidSystem::MultiPhaseFluidSystem::N2Idx), | ||
66 | |||
67 | // equation indices | ||
68 | contiH2OEqIdx = Indices::conti0EqIdx + H2OIdx | ||
69 | }; | ||
70 | |||
71 | public: | ||
72 | 13 | OnePNCBulkProblem(std::shared_ptr<const GridGeometry> gridGeometry, | |
73 | std::shared_ptr<typename ParentType::SpatialParams> spatialParams, | ||
74 | std::shared_ptr<CouplingManager> couplingManager, | ||
75 | const std::string& paramGroup = "") | ||
76 | : ParentType(gridGeometry, spatialParams, paramGroup) | ||
77 |
4/14✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 13 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 13 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
39 | , couplingManagerPtr_(couplingManager) |
78 | { | ||
79 | //initialize fluid system | ||
80 |
1/2✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
|
13 | FluidSystem::init(); |
81 | |||
82 | // stating in the console whether mole or mass fractions are used | ||
83 | if (!getPropValue<TypeTag, Properties::UseMoles>()) | ||
84 | DUNE_THROW(Dune::InvalidStateException, "Problem is implemented for molar formulation!"); | ||
85 | |||
86 |
7/22✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 13 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 13 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 13 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 13 times.
✗ Branch 18 not taken.
✗ 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.
|
13 | problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + |
87 |
2/4✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
|
26 | getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name"); |
88 | 13 | } | |
89 | |||
90 | //! The problem name. | ||
91 | const std::string& name() const | ||
92 |
1/2✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
|
13 | { return problemName_; } |
93 | |||
94 | //! Specifies the type of boundary condition at a given position. | ||
95 | 621244 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const | |
96 | { | ||
97 | 621244 | BoundaryTypes values; | |
98 | 621244 | values.setAllNeumann(); | |
99 | #if !USEMIXEDBCS | ||
100 |
14/14✓ Branch 0 taken 453616 times.
✓ Branch 1 taken 159148 times.
✓ Branch 2 taken 453616 times.
✓ Branch 3 taken 159148 times.
✓ Branch 4 taken 159148 times.
✓ Branch 5 taken 294468 times.
✓ Branch 6 taken 159148 times.
✓ Branch 7 taken 294468 times.
✓ Branch 8 taken 159148 times.
✓ Branch 9 taken 294468 times.
✓ Branch 10 taken 159148 times.
✓ Branch 11 taken 294468 times.
✓ Branch 12 taken 159148 times.
✓ Branch 13 taken 294468 times.
|
1225528 | if (globalPos[1] < 1e-6 || globalPos[1] > this->gridGeometry().bBoxMax()[1] - 1e-6) |
101 | values.setAllDirichlet(); | ||
102 | #else | ||
103 |
4/4✓ Branch 0 taken 2240 times.
✓ Branch 1 taken 6240 times.
✓ Branch 2 taken 2240 times.
✓ Branch 3 taken 6240 times.
|
16960 | if (globalPos[1] < 1e-6) |
104 | values.setAllDirichlet(); | ||
105 |
10/10✓ Branch 0 taken 2240 times.
✓ Branch 1 taken 6240 times.
✓ Branch 2 taken 2240 times.
✓ Branch 3 taken 6240 times.
✓ Branch 4 taken 2240 times.
✓ Branch 5 taken 6240 times.
✓ Branch 6 taken 2240 times.
✓ Branch 7 taken 6240 times.
✓ Branch 8 taken 2240 times.
✓ Branch 9 taken 6240 times.
|
42400 | if (globalPos[1] > this->gridGeometry().bBoxMax()[1] - 1e-6) |
106 | 2240 | values.setDirichlet(contiH2OEqIdx); | |
107 | #endif | ||
108 | 621244 | return values; | |
109 | } | ||
110 | |||
111 | //! Specifies the type of interior boundary condition at a given position. | ||
112 | ✗ | BoundaryTypes interiorBoundaryTypes(const Element& element, const SubControlVolumeFace& scvf) const | |
113 | { | ||
114 | 2357486 | BoundaryTypes values; | |
115 |
6/8✓ Branch 0 taken 541327 times.
✓ Branch 1 taken 306759 times.
✓ Branch 2 taken 444310 times.
✓ Branch 3 taken 372734 times.
✓ Branch 4 taken 570052 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 122304 times.
✗ Branch 7 not taken.
|
2357486 | values.setAllNeumann(); |
116 | ✗ | return values; | |
117 | } | ||
118 | |||
119 | //! Evaluates the source term at a given position. | ||
120 | ✗ | NumEqVector sourceAtPos(const GlobalPosition& globalPos) const | |
121 | 11458720 | { return NumEqVector(0.0); } | |
122 | |||
123 | //! Evaluates the Dirichlet boundary condition for a given position. | ||
124 | ✗ | PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const | |
125 | { | ||
126 | 193568 | auto values = initialAtPos(globalPos); | |
127 | |||
128 |
6/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 32796 times.
✓ Branch 3 taken 32796 times.
✓ Branch 4 taken 5124 times.
✓ Branch 5 taken 5124 times.
✓ Branch 6 taken 10472 times.
✓ Branch 7 taken 10472 times.
|
96784 | if (globalPos[1] < 1e-6) |
129 | { | ||
130 | 69120 | values[N2Idx] = 1e-3; | |
131 | if constexpr (enableHeatConduction) | ||
132 | { | ||
133 | 55328 | values[Indices::temperatureIdx] += 100; // DeltaT = 100 K | |
134 | } | ||
135 | } | ||
136 | |||
137 | ✗ | return values; | |
138 | } | ||
139 | |||
140 | //! Evaluates the initial conditions. | ||
141 | ✗ | PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const | |
142 | { | ||
143 | 96784 | PrimaryVariables values; | |
144 |
6/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 32796 times.
✓ Branch 3 taken 32796 times.
✓ Branch 4 taken 5124 times.
✓ Branch 5 taken 5124 times.
✓ Branch 6 taken 10472 times.
✓ Branch 7 taken 10472 times.
|
96784 | values[pressureIdx] = 1.0e5; |
145 |
14/16✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 18368 times.
✓ Branch 3 taken 18368 times.
✓ Branch 4 taken 17452 times.
✓ Branch 5 taken 17452 times.
✓ Branch 6 taken 20700 times.
✓ Branch 7 taken 20700 times.
✓ Branch 8 taken 2100 times.
✓ Branch 9 taken 2100 times.
✓ Branch 10 taken 2100 times.
✓ Branch 11 taken 2100 times.
✓ Branch 12 taken 4200 times.
✓ Branch 13 taken 4200 times.
✓ Branch 14 taken 4200 times.
✓ Branch 15 taken 4200 times.
|
138240 | values[N2Idx] = 0.0; |
146 | |||
147 | if constexpr (enableHeatConduction) | ||
148 | { | ||
149 |
18/24✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 18368 times.
✓ Branch 7 taken 18368 times.
✓ Branch 8 taken 18368 times.
✓ Branch 9 taken 18368 times.
✓ Branch 10 taken 18368 times.
✓ Branch 11 taken 18368 times.
✓ Branch 12 taken 3024 times.
✓ Branch 13 taken 3024 times.
✓ Branch 14 taken 3024 times.
✓ Branch 15 taken 3024 times.
✓ Branch 16 taken 3024 times.
✓ Branch 17 taken 3024 times.
✓ Branch 18 taken 6272 times.
✓ Branch 19 taken 6272 times.
✓ Branch 20 taken 6272 times.
✓ Branch 21 taken 6272 times.
✓ Branch 22 taken 6272 times.
✓ Branch 23 taken 6272 times.
|
165984 | values[Indices::temperatureIdx] = this->spatialParams().temperatureAtPos(globalPos); |
150 | } | ||
151 | |||
152 | ✗ | return values; | |
153 | } | ||
154 | |||
155 | //! Returns reference to the coupling manager. | ||
156 | const CouplingManager& couplingManager() const | ||
157 |
55/62✓ Branch 0 taken 5484612 times.
✓ Branch 1 taken 10587432 times.
✓ Branch 2 taken 5484612 times.
✓ Branch 3 taken 10081932 times.
✓ Branch 4 taken 505500 times.
✓ Branch 5 taken 1065792 times.
✓ Branch 6 taken 5119044 times.
✓ Branch 7 taken 674088 times.
✓ Branch 8 taken 6184836 times.
✓ Branch 9 taken 168588 times.
✓ Branch 10 taken 505500 times.
✓ Branch 11 taken 1065792 times.
✓ Branch 12 taken 3742344 times.
✓ Branch 13 taken 12593088 times.
✓ Branch 14 taken 4808136 times.
✓ Branch 15 taken 12593088 times.
✓ Branch 16 taken 1261800 times.
✓ Branch 17 taken 1356342 times.
✓ Branch 18 taken 3684456 times.
✓ Branch 19 taken 110376 times.
✓ Branch 20 taken 3741198 times.
✓ Branch 21 taken 72576 times.
✓ Branch 22 taken 1992936 times.
✓ Branch 23 taken 20117238 times.
✓ Branch 24 taken 2065512 times.
✓ Branch 25 taken 22287144 times.
✓ Branch 26 taken 325326 times.
✓ Branch 27 taken 2955552 times.
✓ Branch 28 taken 182952 times.
✓ Branch 29 taken 6118812 times.
✓ Branch 30 taken 715848 times.
✓ Branch 31 taken 6118812 times.
✓ Branch 32 taken 2422656 times.
✓ Branch 33 taken 605472 times.
✓ Branch 34 taken 2422656 times.
✓ Branch 35 taken 72576 times.
✓ Branch 36 taken 532896 times.
✗ Branch 37 not taken.
✓ Branch 38 taken 2422656 times.
✓ Branch 39 taken 605472 times.
✓ Branch 40 taken 2435106 times.
✓ Branch 41 taken 934326 times.
✓ Branch 42 taken 545346 times.
✓ Branch 43 taken 861750 times.
✓ Branch 44 taken 255276 times.
✓ Branch 45 taken 7469820 times.
✓ Branch 46 taken 255276 times.
✓ Branch 47 taken 7469820 times.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✓ Branch 56 taken 18592 times.
✓ Branch 57 taken 1286880 times.
✓ Branch 58 taken 18592 times.
✓ Branch 59 taken 1286880 times.
✓ Branch 60 taken 365568 times.
✓ Branch 61 taken 10004736 times.
✓ Branch 62 taken 365568 times.
✓ Branch 63 taken 10004736 times.
|
214597296 | { return *couplingManagerPtr_; } |
158 | |||
159 | private: | ||
160 | std::shared_ptr<CouplingManager> couplingManagerPtr_; | ||
161 | std::string problemName_; | ||
162 | }; | ||
163 | |||
164 | } // end namespace Dumux | ||
165 | |||
166 | #endif | ||
167 |