heterogeneousspatialparameters.hh 9.19 KB
Newer Older
1
2
3
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
Bernd Flemisch's avatar
Bernd Flemisch committed
4
 *   See the file COPYING for full copying permissions.                      *
5
6
7
8
9
10
11
12
 *                                                                           *
 *   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    *
 *   the Free Software Foundation, either version 2 of the License, or       *
 *   (at your option) any later version.                                     *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
Bernd Flemisch's avatar
Bernd Flemisch committed
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
14
15
16
17
18
19
20
21
 *   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
 *
22
23
24
 * \brief Definition of the spatial parameters for the heterogeneous
 *        problem which uses the non-isothermal or isothermal CO2
 *        fully implicit model.
25
26
27
28
29
 */

#ifndef DUMUX_HETEROGENEOUS_SPATIAL_PARAMS_HH
#define DUMUX_HETEROGENEOUS_SPATIAL_PARAMS_HH

30
#include <dumux/material/spatialparams/implicitspatialparams.hh>
31
32
33
#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh>
#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>

34
#include <dumux/implicit/co2/co2model.hh>
Christoph Grueninger's avatar
Christoph Grueninger committed
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
namespace Dumux
{

//forward declaration
template<class TypeTag>
class HeterogeneousSpatialParams;

namespace Properties
{
// The spatial parameters TypeTag
NEW_TYPE_TAG(HeterogeneousSpatialParams);

// Set the spatial parameters
SET_TYPE_PROP(HeterogeneousSpatialParams, SpatialParams, Dumux::HeterogeneousSpatialParams<TypeTag>);

// Set the material Law
SET_PROP(HeterogeneousSpatialParams, MaterialLaw)
{
private:
    // define the material law which is parameterized by effective
    // saturations
    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
    typedef RegularizedBrooksCorey<Scalar> EffMaterialLaw;
public:
    // define the material law parameterized by absolute saturations
    typedef EffToAbsLaw<EffMaterialLaw> type;
};
}

/*!
 * \ingroup CO2Model
67
 * \ingroup ImplicitTestProblems
68
69
70
 * \brief Definition of the spatial parameters for the heterogeneous
 *        problem which uses the non-isothermal or isothermal CO2
 *        fully implicit model.
71
72
 */
template<class TypeTag>
73
class HeterogeneousSpatialParams : public ImplicitSpatialParams<TypeTag>
74
{
75
    typedef ImplicitSpatialParams<TypeTag> ParentType;
76
    typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
77
    typedef typename GET_PROP_TYPE(TypeTag, GridCreator) GridCreator;
78
79
80
81
    typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
    typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;

82
    enum { dim=GridView::dimension };
83
84
85
86
87
88
89
90
91
92
93
94

    typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
    typedef typename GridView::template Codim<0>::Entity Element;
    typedef typename GridView::template Codim<0>::Iterator ElementIterator;

public:
    typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
    typedef typename MaterialLaw::Params MaterialLawParams;

    /*!
     * \brief The constructor
     *
95
     * \param gridView The grid view
96
97
     */
    HeterogeneousSpatialParams(const GridView &gridView)
98
        : ParentType(gridView), gridView_(gridView)
99
100
101
102
103
104
105
106
    {
        /*
         * Layer Index Setup:
         */
        barrierTop_ = 1;
        barrierMiddle_ = 2;
        reservoir_ = 3;

107
108
109
        // heat conductivity of granite
        lambdaSolid_ = 2.8;

110
111
112
113
        //Set the permeability for the layers
        barrierTopK_ = 1e-17; //sqm
        barrierMiddleK_ = 1e-15; //sqm
        reservoirK_ = 1e-14; //sqm
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

        //Set the effective porosity of the layers
        barrierTopPorosity_ = 0.001;
        barrierMiddlePorosity_ = 0.05;
        reservoirPorosity_ = 0.2;

        // Same material parameters for every layer
        materialParams_.setSwr(0.2);
        materialParams_.setSwr(0.05);
        materialParams_.setLambda(2.0);
        materialParams_.setPe(1e4);
    }

    ~HeterogeneousSpatialParams()
    {}

130
131
132
133
    /*!
     * \brief Reads layer information from the grid
     *
     */
134
    void setParams()
135
    {
136
        int numElements = gridView_.size(0);
137
138
        paramIdx_.resize(numElements);

139
140
        ElementIterator eIt = gridView_.template begin<0>();
        const ElementIterator eEndIt = gridView_.template end<0>();
141
142
        for (; eIt != eEndIt; ++eIt)
        {
143
144
            int eIdx = gridView_.indexSet().index(*eIt);
            int param = GridCreator::parameters(*eIt)[0];
145
146
            paramIdx_[eIdx] = param;
        }
147
148
149
    }

    /*!
150
     * \brief Returns the scalar intrinsic permeability \f$[m^2]\f$
151
     *
152
153
154
     * \param element The finite element
     * \param fvGeometry The finite volume geometry of the element
     * \param scvIdx The local index of the sub-control volume
155
156
     */
    const Scalar intrinsicPermeability(const Element &element,
157
                                       const FVElementGeometry &fvGeometry,
158
159
                                       int scvIdx) const
    {
160
        //Get the global index of the element
161
        int eIdx = gridView_.indexSet().index(element);
162

163
        if (paramIdx_[eIdx] == barrierTop_)
164
            return barrierTopK_;
165
        else if (paramIdx_[eIdx] == barrierMiddle_)
166
167
168
169
170
171
            return barrierMiddleK_;
        else
            return reservoirK_;
    }

    /*!
172
     * \brief Returns the porosity \f$[-]\f$
173
174
     *
     * \param element The finite element
175
176
     * \param fvGeometry The finite volume geometry of the element
     * \param scvIdx The local index of the sub-control volume
177
178
     */
    Scalar porosity(const Element &element,
179
                    const FVElementGeometry &fvGeometry,
180
181
                    int scvIdx) const
    {
182
        //Get the global index of the element
183
        int eIdx = gridView_.indexSet().index(element);
184

185
        if (paramIdx_[eIdx] == barrierTop_)
186
            return barrierTopPorosity_;
187
        else if (paramIdx_[eIdx] == barrierMiddle_)
188
189
190
191
192
193
194
            return barrierMiddlePorosity_;
        else
            return reservoirPorosity_;
    }


    /*!
195
     * \brief Returns the parameter object for the Brooks-Corey material law
196
     *
197
198
199
200
     * \param element The finite element
     * \param fvGeometry The finite volume geometry of the element
     * \param scvIdx The local index of the sub-control volume
     */
201
    const MaterialLawParams& materialLawParams(const Element &element,
202
                                                const FVElementGeometry &fvGeometry,
203
204
205
206
207
208
                                                int scvIdx) const
    {
        return materialParams_;
    }

    /*!
209
     * \brief Returns the heat capacity \f$[J / (kg K)]\f$ of the rock matrix.
210
     *
211
     * This is only required for non-isothermal models.
212
213
     *
     * \param element The finite element
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
     * \param fvGeometry The finite volume geometry
     * \param scvIdx The local index of the sub-control volume
     */
    Scalar solidHeatCapacity(const Element &element,
                             const FVElementGeometry &fvGeometry,
                             const int scvIdx) const
    {
        return 790; // specific heat capacity of granite [J / (kg K)]
    }

    /*!
     * \brief Returns the mass density \f$[kg / m^3]\f$ of the rock matrix.
     *
     * This is only required for non-isothermal models.
     *
     * \param element The finite element
     * \param fvGeometry The finite volume geometry
231
     * \param scvIdx The local index of the sub-control volume
232
     */
233
    Scalar solidDensity(const Element &element,
234
                        const FVElementGeometry &fvGeometry,
235
                        const int scvIdx) const
236
    {
237
        return 2700; // density of granite [kg/m^3]
238
239
240
    }

    /*!
241
     * \brief Returns the thermal conductivity \f$\mathrm{[W/(m K)]}\f$ of the solid
242
243
     *
     * This is only required for non-isothermal models.
244
     *
245
     * \param element The finite element
246
247
     * \param fvGeometry The finite volume geometry of the element
     * \param scvIdx The local index of the sub-control volume
248
     */
249
    Scalar solidThermalConductivity(const Element &element,
250
251
                                    const FVElementGeometry &fvGeometry,
                                    const int scvIdx) const
252
    {
253
        return lambdaSolid_;
254
255
    }

256
257


258
259
260
261
262
263
264
265
266
267
268
269
270
271
private:

    int barrierTop_;
    int barrierMiddle_;
    int reservoir_;


    Scalar barrierTopPorosity_;
    Scalar barrierMiddlePorosity_;
    Scalar reservoirPorosity_;

    Scalar barrierTopK_;
    Scalar barrierMiddleK_;
    Scalar reservoirK_;
272
    Scalar lambdaSolid_;
273
274
275

    MaterialLawParams materialParams_;

276
    const GridView gridView_;
277
278
279
280
281
282
    std::vector<int> paramIdx_;
};

}

#endif