tutorialspatialparams_coupled.hh 7.36 KB
Newer Older
1
2
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
3
4
/*****************************************************************************
 *   Copyright (C) 2008-2009 by Melanie Darcis                               *
Andreas Lauser's avatar
Andreas Lauser committed
5
 *   Institute for Modelling Hydraulic and Environmental Systems             *
6
7
8
 *   University of Stuttgart, Germany                                        *
 *   email: <givenname>.<name>@iws.uni-stuttgart.de                          *
 *                                                                           *
9
 *   This program is free software: you can redistribute it and/or modify    *
10
 *   it under the terms of the GNU General Public License as published by    *
11
12
 *   the Free Software Foundation, either version 2 of the License, or       *
 *   (at your option) any later version.                                     *
13
 *                                                                           *
14
15
16
17
18
19
20
 *   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/>.   *
21
 *****************************************************************************/
Melanie Darcis's avatar
doc    
Melanie Darcis committed
22
23
24
25
26
27
/*!
 * \file
 *
 * \brief The spatial parameters for the fully coupled tutorial problem
 *        which uses the twophase box model.
 */
28
29
#ifndef DUMUX_TUTORIAL_SPATIAL_PARAMS_COUPLED_HH
#define DUMUX_TUTORIAL_SPATIAL_PARAMS_COUPLED_HH
30
31

// include parent spatialparameters
32
#include <dumux/material/spatialparameters/boxspatialparams.hh>
33
34

// include material laws
Melanie Darcis's avatar
Melanie Darcis committed
35
#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh> /*@\label{tutorial-coupled:rawLawInclude}@*/
36
37
#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>

38
namespace Dumux {
39
40
//forward declaration
template<class TypeTag>
41
class TutorialSpatialParamsCoupled;
42
43
44
45

namespace Properties
{
// The spatial parameters TypeTag
46
NEW_TYPE_TAG(TutorialSpatialParamsCoupled);/*@\label{tutorial-coupled:define-spatialparameters-typetag}@*/
47
48

// Set the spatial parameters
49
50
SET_TYPE_PROP(TutorialSpatialParamsCoupled, SpatialParams,
        Dumux::TutorialSpatialParamsCoupled<TypeTag>); /*@\label{tutorial-coupled:set-spatialparameters}@*/
51
52

// Set the material law
53
SET_PROP(TutorialSpatialParamsCoupled, MaterialLaw)
54
55
56
{
private:
    // material law typedefs
57
    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
58
59
60
61
62
63
64
65
    // select material law to be used
    typedef RegularizedBrooksCorey<Scalar> RawMaterialLaw;     /*@\label{tutorial-coupled:rawlaw}@*/
public:
    // adapter for absolute law
    typedef EffToAbsLaw<RawMaterialLaw> type;   /*@\label{tutorial-coupled:eff2abs}@*/
};
}

Melanie Darcis's avatar
doc    
Melanie Darcis committed
66
67
68
69
70
71
/*!
 * \ingroup TwoPBoxModel
 *
 * \brief The spatial parameters for the fully coupled tutorial problem
 *        which uses the twophase box model.
 */
72
template<class TypeTag>
73
class TutorialSpatialParamsCoupled: public BoxSpatialParams<TypeTag> /*@\label{tutorial-coupled:tutorialSpatialParameters}@*/
74
75
{
    // Get informations for current implementation via property system
76
77
78
    typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
    typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
79
80
81
    enum
    {
        dim = Grid::dimension,
Bernd Flemisch's avatar
Bernd Flemisch committed
82
        dimWorld = Grid::dimensionworld
83
84
85
    };

    // Get object types for function arguments
86
    typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
87
88
89
    typedef typename Grid::Traits::template Codim<0>::Entity Element;

public:
90
    // get material law from property system
91
    typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
92
    // determine appropriate parameters depending on selected materialLaw
93
94
    typedef typename MaterialLaw::Params MaterialLawParams;    /*@\label{tutorial-coupled:matLawObjectType}@*/

95
96
    /*! Intrinsic permeability tensor K \f$[m^2]\f$ depending
     *  on the position in the domain
97
98
     *
     *  \param element The finite volume element
Klaus Mosthaf's avatar
Klaus Mosthaf committed
99
     *  \param fvGeometry The finite-volume geometry in the box scheme
100
101
     *  \param scvIdx The local vertex index
     *
102
103
104
     *  Alternatively, the function intrinsicPermeabilityAtPos(const GlobalPosition& globalPos)
     *  could be defined, where globalPos is the vector including the global coordinates
     *  of the finite volume.
105
     */
106
    const Dune::FieldMatrix<Scalar, dim, dim> &intrinsicPermeability(const Element &element, /*@\label{tutorial-coupled:permeability}@*/
Klaus Mosthaf's avatar
Klaus Mosthaf committed
107
108
                                                    const FVElementGeometry &fvGeometry,
                                                    const int scvIdx) const
109
    { return K_; }
110

111
    /*! Defines the porosity \f$[-]\f$ of the porous medium depending
112
     * on the position in the domain
113
114
     *
     *  \param element The finite volume element
Klaus Mosthaf's avatar
Klaus Mosthaf committed
115
     *  \param fvGeometry The finite-volume geometry in the box scheme
116
117
     *  \param scvIdx The local vertex index
     *
118
119
120
     *  Alternatively, the function porosityAtPos(const GlobalPosition& globalPos)
     *  could be defined, where globalPos is the vector including the global coordinates
     *  of the finite volume.
121
     */
122
    Scalar porosity(const Element &element,                    /*@\label{tutorial-coupled:porosity}@*/
Klaus Mosthaf's avatar
Klaus Mosthaf committed
123
124
                    const FVElementGeometry &fvGeometry,
                    const int scvIdx) const
125
    { return 0.2; }
126

127
    /*! Returns the parameter object for the material law (i.e. Brooks-Corey)
128
129
130
     *  depending on the position in the domain
     *
     *  \param element The finite volume element
Klaus Mosthaf's avatar
Klaus Mosthaf committed
131
     *  \param fvGeometry The finite-volume geometry in the box scheme
132
133
     *  \param scvIdx The local vertex index
     *
134
135
136
     *  Alternatively, the function materialLawParamsAtPos(const GlobalPosition& globalPos)
     *  could be defined, where globalPos is the vector including the global coordinates
     *  of the finite volume.
137
     */
138
    const MaterialLawParams& materialLawParams(const Element &element,            /*@\label{tutorial-coupled:matLawParams}@*/
Klaus Mosthaf's avatar
Klaus Mosthaf committed
139
140
                                               const FVElementGeometry &fvGeometry,
                                               const int scvIdx) const
141
142
143
144
145
    {
        return materialParams_;
    }

    // constructor
146
    TutorialSpatialParamsCoupled(const GridView& gridView) :
147
        BoxSpatialParams<TypeTag>(gridView),
148
        K_(0)
149
    {
150
151
        //set main diagonal entries of the permeability tensor to a value
        //setting to one value means: isotropic, homogeneous
152
153
154
155
156
157
158
        for (int i = 0; i < dim; i++)
            K_[i][i] = 1e-7;

        //set residual saturations
        materialParams_.setSwr(0.0);                /*@\label{tutorial-coupled:setLawParams}@*/
        materialParams_.setSnr(0.0);

159
        //parameters of Brooks & Corey Law
160
        materialParams_.setPe(500.0);
161
        materialParams_.setLambda(2);
162
163
164
165
    }

private:
    Dune::FieldMatrix<Scalar, dim, dim> K_;
166
    // Object that holds the values/parameters of the selected material law.
167
168
169
170
    MaterialLawParams materialParams_;                 /*@\label{tutorial-coupled:matParamsObject}@*/
};
} // end namespace
#endif