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 PoromechanicsTests | ||
10 | * \brief Definition of the spatial parameters for the two-phase flow | ||
11 | * sub-problem in the coupled poro-mechanical elp problem. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_2P_SUB_PROBLEM_HH | ||
15 | #define DUMUX_2P_SUB_PROBLEM_HH | ||
16 | |||
17 | #include <dumux/common/boundarytypes.hh> | ||
18 | #include <dumux/common/properties.hh> | ||
19 | #include <dumux/common/parameters.hh> | ||
20 | #include <dumux/common/numeqvector.hh> | ||
21 | |||
22 | #include <dumux/porousmediumflow/problem.hh> | ||
23 | |||
24 | namespace Dumux { | ||
25 | |||
26 | /*! | ||
27 | * \ingroup PoromechanicsTests | ||
28 | * \brief The two-phase sub problem in the el2p coupled problem. | ||
29 | */ | ||
30 | template <class TypeTag> | ||
31 | class TwoPSubProblem : public PorousMediumFlowProblem<TypeTag> | ||
32 | { | ||
33 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
34 | |||
35 | using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; | ||
36 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
37 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
38 | using Element = typename GridView::template Codim<0>::Entity; | ||
39 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
40 | |||
41 | // copy pressure index for convenience | ||
42 | enum { | ||
43 | pressureIdx = GetPropType<TypeTag, Properties::ModelTraits>::Indices::pressureIdx, | ||
44 | saturationNIdx = GetPropType<TypeTag, Properties::ModelTraits>::Indices::saturationIdx, | ||
45 | waterPhaseIdx = FluidSystem::phase0Idx, | ||
46 | gasPhaseIdx = FluidSystem::phase1Idx, | ||
47 | dimWorld = GridView::dimensionworld | ||
48 | }; | ||
49 | |||
50 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
51 | using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; | ||
52 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
53 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
54 | |||
55 | public: | ||
56 | 2 | TwoPSubProblem(std::shared_ptr<const GridGeometry> gridGeometry, | |
57 | std::shared_ptr<GetPropType<TypeTag, Properties::SpatialParams>> spatialParams, | ||
58 | const std::string& paramGroup = "TwoP") | ||
59 |
4/12✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
6 | : ParentType(gridGeometry, spatialParams, paramGroup) |
60 | { | ||
61 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | FluidSystem::init(); |
62 |
9/26✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 2 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 2 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 2 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.
|
4 | problemName_ = getParam<std::string>("Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name"); |
63 | 2 | } | |
64 | |||
65 | /*! | ||
66 | * \brief The problem name. | ||
67 | */ | ||
68 | const std::string& name() const | ||
69 | { | ||
70 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | return problemName_; |
71 | } | ||
72 | |||
73 | //! Evaluates the boundary conditions for a Dirichlet boundary segment. | ||
74 | ✗ | PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const | |
75 | 420640 | { return initialAtPos(globalPos); } | |
76 | |||
77 | //! Evaluates the initial value for a control volume. | ||
78 | ✗ | PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const | |
79 | { | ||
80 | 420768 | PrimaryVariables values; | |
81 | |||
82 | 420768 | values[pressureIdx] = 1.5e7; | |
83 | 841536 | values[saturationNIdx] = 0.0; | |
84 | ✗ | return values; | |
85 | } | ||
86 | |||
87 | //! Evaluates source terms. | ||
88 | 371072 | NumEqVector sourceAtPos(const GlobalPosition& globalPos) const | |
89 | { | ||
90 | 371072 | NumEqVector values(0.0); | |
91 | |||
92 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 371070 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
371072 | static const Scalar sourceG = getParam<Scalar>("Problem.InjectionRateGas"); |
93 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 371070 times.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
371072 | static const Scalar sourceW = getParam<Scalar>("Problem.InjectionRateWater"); |
94 |
6/6✓ Branch 0 taken 285216 times.
✓ Branch 1 taken 85856 times.
✓ Branch 2 taken 199360 times.
✓ Branch 3 taken 85856 times.
✓ Branch 4 taken 199360 times.
✓ Branch 5 taken 85856 times.
|
371072 | if(globalPos[0] > 250 + eps_ && globalPos[0] < 750 - eps_ |
95 |
8/8✓ Branch 0 taken 152976 times.
✓ Branch 1 taken 46384 times.
✓ Branch 2 taken 152976 times.
✓ Branch 3 taken 46384 times.
✓ Branch 4 taken 106592 times.
✓ Branch 5 taken 46384 times.
✓ Branch 6 taken 106592 times.
✓ Branch 7 taken 46384 times.
|
398720 | && globalPos[1] > 250 + eps_ && globalPos[1] < 750 - eps_ |
96 |
10/10✓ Branch 0 taken 285216 times.
✓ Branch 1 taken 85856 times.
✓ Branch 2 taken 81672 times.
✓ Branch 3 taken 24920 times.
✓ Branch 4 taken 81672 times.
✓ Branch 5 taken 24920 times.
✓ Branch 6 taken 56752 times.
✓ Branch 7 taken 24920 times.
✓ Branch 8 taken 56752 times.
✓ Branch 9 taken 24920 times.
|
584256 | && globalPos[dimWorld-1] > 250 + eps_ && globalPos[dimWorld-1] < 750 - eps_) |
97 | { | ||
98 | 56752 | values[gasPhaseIdx] = sourceG; | |
99 | 113504 | values[waterPhaseIdx] = sourceW; | |
100 | } | ||
101 | 371072 | return values; | |
102 | } | ||
103 | |||
104 | /*! | ||
105 | * \brief Specifies which kind of boundary condition should be | ||
106 | * used for which equation on a given boundary segment. | ||
107 | * | ||
108 | * \param globalPos The global position | ||
109 | */ | ||
110 | ✗ | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | |
111 | { | ||
112 | ✗ | BoundaryTypes values; | |
113 | ✗ | if (globalPos[dimWorld-1] < eps_) | |
114 | values.setAllNeumann(); | ||
115 | else | ||
116 | values.setAllDirichlet(); | ||
117 | ✗ | return values; | |
118 | } | ||
119 | |||
120 | ✗ | void setTime(Scalar t) const | |
121 | 40 | { time_ = t; } | |
122 | |||
123 | private: | ||
124 | static constexpr Scalar eps_ = 1.0e-6; | ||
125 | std::string problemName_; | ||
126 | mutable Scalar time_ = 0; | ||
127 | }; | ||
128 | |||
129 | } // end namespace Dumux | ||
130 | |||
131 | #endif | ||
132 |