problem.hh 7.11 KB
Newer Older
1
2
3
4
5
6
7
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
 *   See the file COPYING for full copying permissions.                      *
 *                                                                           *
 *   This program is free software: you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published by    *
8
 *   the Free Software Foundation, either version 3 of the License, or       *
9
10
11
12
13
14
15
16
17
18
19
20
 *   (at your option) any later vesion.                                      *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
 *   GNU General Public License for more details.                            *
 *                                                                           *
 *   You should have received a copy of the GNU General Public License       *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 *****************************************************************************/
/*!
 * \file
21
 * \ingroup TwoPOneCTests
22
 * \brief Non-isothermal steam injection test problem for the 2p1cni model.
23
 */
24

25
26
27
#ifndef DUMUX_STEAM_INJECTIONPROBLEM_HH
#define DUMUX_STEAM_INJECTIONPROBLEM_HH

28
29
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh>
30

31
#include <dumux/common/boundarytypes.hh>
32
33
#include <dumux/porousmediumflow/problem.hh>

34
namespace Dumux {
35
/*!
36
 * \ingroup TwoPOneCTests
37
 * \brief Non-isothermal 2D problem where steam is injected on the lower left side of the domain.
38
 *
39
40
 * This problem uses the \ref TwoPOneCModel.
 */
41
template <class TypeTag>
42
class InjectionProblem : public PorousMediumFlowProblem<TypeTag>
43
{
44
45
    using ParentType = PorousMediumFlowProblem<TypeTag>;

46
    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
47
48
    using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
    using Indices = typename ModelTraits::Indices;
49
    using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
50
51
    using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>;

52
53
    using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
    using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
54
55
56
57
58

    using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
    using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
    using ElementFluxVariablesCache = typename GridVariables::GridFluxVariablesCache::LocalView;

59
60
    using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
    using FVElementGeometry = typename GridGeometry::LocalView;
61
62
    using SubControlVolume = typename FVElementGeometry::SubControlVolume;
    using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
63
    using GridView = typename GridGeometry::GridView;
64
    using Element = typename GridView::template Codim<0>::Entity;
65
66
67
68

    // copy some indices for convenience
    enum {
        pressureIdx = Indices::pressureIdx,
69
        switchIdx = Indices::switchIdx,
70

71
        conti0EqIdx = Indices::conti0EqIdx,
72
73
        energyEqIdx = Indices::energyEqIdx,

74
        // phase state
75
        liquidPhaseOnly = Indices::liquidPhaseOnly
76
77
    };

78
    using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
79
80

public:
81
82
    InjectionProblem(std::shared_ptr<const GridGeometry> gridGeometry)
    : ParentType(gridGeometry)
83
    { FluidSystem::init(); }
84
85
86
87
88
89
90

    /*!
     * \name Problem parameters
     */
    // \{


91
    //! \copydoc Dumux::FVProblem::source()
92
    NumEqVector source(const Element &element,
93
94
95
96
                       const FVElementGeometry& fvGeometry,
                       const ElementVolumeVariables& elemVolVars,
                       const SubControlVolume &scv) const
    { return NumEqVector(0.0); }
97
98
99
100
101
102
103
104

    /*!
     * \name Boundary conditions
     */
    // \{

    /*!
     * \brief Specifies which kind of boundary condition should be
105
     *        used for which equation on a given boundary segment
106
     *
107
     * \param globalPos The global position
108
     */
109
    BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
110
    {
111
112
        BoundaryTypes bcTypes;

113
        if(globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_ || globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_)
114
           bcTypes.setAllDirichlet();
115
        else
116
           bcTypes.setAllNeumann();
117
118

         return bcTypes;
119
120
121
    }

    /*!
122
     * \brief Evaluates the boundary conditions for a Dirichlet boundary segment.
123
     *
124
     * \param globalPos The global position
125
     */
126
    PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
127
    {
128
       return initialAtPos(globalPos);
129
130
131
    }

    /*!
132
     * \brief Evaluates the boundary conditions for a Neumann boundary segment.
133
     *
134
135
136
137
138
139
140
     * This is the method for the case where the Neumann condition is
     * potentially solution dependent and requires some quantities that
     * are specific to the fully-implicit method.
     *
     * \param element The finite element
     * \param fvGeometry The finite-volume geometry
     * \param elemVolVars All volume variables for the element
141
     * \param elemFluxVarsCache Flux variables caches for all faces in stencil
142
     * \param scvf The sub-control volume face
143
     *
144
     * For this method, the \a values parameter stores the flux
145
     * in normal direction of each phase. Negative values mean influx.
146
     * E.g. for the mass balance that would the mass flux in \f$ [ kg / (m^2 \cdot s)] \f$.
147
     */
148
    NumEqVector neumann(const Element& element,
149
150
                           const FVElementGeometry& fvGeometry,
                           const ElementVolumeVariables& elemVolVars,
151
                           const ElementFluxVariablesCache& elemFluxVarsCache,
152
                           const SubControlVolumeFace& scvf) const
153
    {
154
        NumEqVector values(0.0);
155

156
157
158
        const auto& ipGlobal = scvf.ipGlobal();

        if (ipGlobal[0] < eps_)
159
        {
160
            if (ipGlobal[1] > 2.0 - eps_ && ipGlobal[1] < 3.0 + eps_)
161
            {
162
                const Scalar massRate = 1e-1;
163
164
                values[conti0EqIdx] = -massRate;
                values[energyEqIdx] = -massRate * 2690e3;
165
            }
166
        }
167
        return values;
168
169
170
171
172
173
174
175
176
177
    }

    // \}

    /*!
     * \name Volume terms
     */
    // \{

    /*!
178
     * \brief Evaluates the initial values for a control volume.
179
180
181
     *
     * \param globalPos The global position
     */
182
    PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
183
    {
184
185
186
        PrimaryVariables values(0.0);

        const Scalar densityW = 1000.0;
187
        values[pressureIdx] = 101300.0 + (this->gridGeometry().bBoxMax()[1] - globalPos[1])*densityW*9.81; // hydrostatic pressure
188
        values[switchIdx] = 283.13;
189

190
        values.setState(liquidPhaseOnly);
191

192
193
        return values;
    }
194
195
196

private:

197
    static constexpr Scalar eps_ = 1e-6;
198
};
199
} // end namespace Dumux
200
201

#endif