multidomainpropertydefaults.hh 10.1 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- 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    *
 *   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          *
 *   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/>.   *
 *****************************************************************************/
19
20
/*!
 * \file
Thomas Fetzer's avatar
Thomas Fetzer committed
21
22
23
 * \ingroup Properties
 * \ingroup ImplicitProperties
 * \ingroup MultidomainModel
24
25
 * \brief Sets default values for the MultiDomain properties
 */
26

27
28
29
30
31
32
#ifndef DUMUX_MULTIDOMAIN_PROPERTY_DEFAULTS_HH
#define DUMUX_MULTIDOMAIN_PROPERTY_DEFAULTS_HH

#include <dune/istl/bvector.hh>
#include <dune/istl/bcrsmatrix.hh>

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <dune/pdelab/backend/istlvectorbackend.hh>
#include <dune/pdelab/backend/istlmatrixbackend.hh>
#include <dune/pdelab/multidomain/multidomaingridfunctionspace.hh>
#include <dune/pdelab/multidomain/subproblemlocalfunctionspace.hh>
#include <dune/pdelab/multidomain/subproblem.hh>
#include <dune/pdelab/multidomain/subdomainset.hh>
#include <dune/pdelab/multidomain/coupling.hh>
#include <dune/pdelab/multidomain/gridoperator.hh>

#include <dune/pdelab/gridoperator/gridoperator.hh>

#include "subdomainpropertydefaults.hh"
#include "multidomainmodel.hh"
#include "multidomainproperties.hh"
#include "multidomainnewtoncontroller.hh"
#include "splitandmerge.hh"

50
51
#include <dumux/nonlinear/newtonmethod.hh>
#include <dumux/common/timemanager.hh>
52
53
54

namespace Dumux
{
55
template <class TypeTag> class MultiDomainModel;
56
57
template <class TypeTag> class MultiDomainJacobianAssembler;
template <class TypeTag> class MultiDomainNewtonController;
58
59
60
61

namespace Properties
{

62
63
64
65
66
67
68
69
70
71
72
73
74
SET_PROP(MultiDomain, MultiDomainGrid)
{
private:
    typedef typename GET_PROP_TYPE(TypeTag, Grid) HostGrid;
    typedef typename Dune::mdgrid::FewSubDomainsTraits<HostGrid::dimension,4> MDGridTraits;
public:
    typedef typename Dune::MultiDomainGrid<HostGrid, MDGridTraits> type;
};

SET_PROP(MultiDomain, MultiDomainGridFunctionSpace)
{
private:
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainGrid) MDGrid;
75
    typedef typename Dune::PDELab::LexicographicOrderingTag OrderingTag;
76
77
78
79
80
81
    typedef typename GET_PROP_TYPE(TypeTag, SubDomain1TypeTag) SubTypeTag1;
    typedef typename GET_PROP_TYPE(TypeTag, SubDomain2TypeTag) SubTypeTag2;
    typedef typename GET_PROP_TYPE(SubTypeTag1, GridFunctionSpace) GridFunctionSpace1;
    typedef typename GET_PROP_TYPE(SubTypeTag2, GridFunctionSpace) GridFunctionSpace2;
public:
    typedef Dune::PDELab::MultiDomain::MultiDomainGridFunctionSpace<MDGrid,
82
83
84
85
                                                                    Dune::PDELab::ISTLVectorBackend<>,
                                                                    OrderingTag,
                                                                    GridFunctionSpace1,
                                                                    GridFunctionSpace2> type;
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
};

// set the subdomain equality condition by default
SET_PROP(MultiDomain, MultiDomainCondition)
{
private:
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainGrid) MDGrid;
public:
    typedef Dune::PDELab::MultiDomain::SubDomainEqualityCondition<MDGrid> type;
};

SET_PROP(MultiDomain, MultiDomainSubProblem1)
{
private:
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainGridFunctionSpace) MDGridFunctionSpace;
    typedef typename GET_PROP_TYPE(TypeTag, SubDomain1TypeTag) SubTypeTag1;
    typedef typename GET_PROP_TYPE(SubTypeTag1, Constraints) Constraints1;
    typedef typename GET_PROP_TYPE(SubTypeTag1, LocalOperator) LocalOperator1;
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainCondition) MDCondition;
    typedef typename GET_PROP_TYPE(SubTypeTag1, GridFunctionSpace) GridFunctionSpace1;
public:
    typedef Dune::PDELab::MultiDomain::SubProblem<MDGridFunctionSpace,
                                                  MDGridFunctionSpace,
109
110
                                                  LocalOperator1, MDCondition,
                                                  0> type;
111
112
113
114
115
116
117
118
119
120
121
122
123
};

SET_PROP(MultiDomain, MultiDomainSubProblem2)
{
private:
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainGridFunctionSpace) MDGridFunctionSpace;
    typedef typename GET_PROP_TYPE(TypeTag, SubDomain2TypeTag) SubTypeTag2;
    typedef typename GET_PROP_TYPE(SubTypeTag2, Constraints) Constraints2;
    typedef typename GET_PROP_TYPE(SubTypeTag2, LocalOperator) LocalOperator2;
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainCondition) MDCondition;
    typedef typename GET_PROP_TYPE(SubTypeTag2, GridFunctionSpace) GridFunctionSpace2;
public:
    typedef Dune::PDELab::MultiDomain::SubProblem<MDGridFunctionSpace,
124
125
126
                                                  MDGridFunctionSpace,
                                                  LocalOperator2, MDCondition,
                                                  1> type;
127
128
129
130
131
132
133
134
135
136
};

SET_PROP(MultiDomain, MultiDomainCoupling)
{
private:
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainSubProblem1) MDSubProblem1;
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainSubProblem2) MDSubProblem2;
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainCouplingLocalOperator) MDCouplingLocalOperator;
public:
    typedef Dune::PDELab::MultiDomain::Coupling<MDSubProblem1,
137
138
                                                MDSubProblem2,
                                                MDCouplingLocalOperator> type;
139
140
141
142
143
144
145
};

// set trivial constraints transformation by default
// TODO create a proper constraint transformation
SET_PROP(MultiDomain, MultiDomainConstraintsTrafo)
{
private:
146
147
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainGridFunctionSpace) MDGridFunctionSpace;
    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
148
public:
149
    typedef typename MDGridFunctionSpace::template ConstraintsContainer<Scalar>::Type type;
150
151
152
153
154
155
};

SET_PROP(MultiDomain, MultiDomainGridOperator)
{
private:
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainGridFunctionSpace) MDGridFunctionSpace;
156
    typedef Dune::PDELab::ISTLMatrixBackend MBE;
157
158
159
160
161
162
163
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainSubProblem1) MDSubProblem1;
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainSubProblem2) MDSubProblem2;
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainCoupling) MDCoupling;
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainConstraintsTrafo) MDConstraintsTrafo;
    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
public:
    typedef Dune::PDELab::MultiDomain::GridOperator<
164
165
166
167
                    MDGridFunctionSpace, MDGridFunctionSpace,
                    MBE, Scalar, Scalar, Scalar,
                    MDConstraintsTrafo, MDConstraintsTrafo,
                    MDSubProblem1, MDSubProblem2, MDCoupling> type;
168
169
170
171
172
173
174
175
176
177
178
179
180
};

SET_PROP(MultiDomain, JacobianMatrix)
{
private:
    typedef typename GET_PROP_TYPE(TypeTag, MultiDomainGridOperator) MDGridOperator;
public:
    typedef typename MDGridOperator::Traits::Jacobian type;
};

SET_INT_PROP(MultiDomain, LinearSolverBlockSize, GET_PROP_VALUE(TypeTag, NumEq));


181
// Set property values for the coupled model
182
183
184
185
186
//SET_BOOL_PROP(MultiDomain, DoEnrichedCoupling, false);
SET_TYPE_PROP(MultiDomain, Model, MultiDomainModel<TypeTag>);

SET_PROP(MultiDomain, SolutionVector)
{ private:
187
188
189
190
191
192
193
    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
    enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) };
public:
    typedef Dune::BlockVector<Dune::FieldVector<Scalar, numEq> > type;
};

//! use the plain newton method for the coupled problems by default
194
SET_TYPE_PROP(MultiDomain, NewtonMethod, NewtonMethod<TypeTag>);
195
196

//! use the plain newton controller for coupled problems by default
197
SET_TYPE_PROP(MultiDomain, NewtonController, MultiDomainNewtonController<TypeTag>);
198
199

//! Set the default type of the time manager for coupled models
200
SET_TYPE_PROP(MultiDomain, TimeManager, TimeManager<TypeTag>);
201

202
203
SET_PROP(MultiDomain, NumEq)
{ private:
204
205
    typedef typename GET_PROP_TYPE(TypeTag, SubDomain1TypeTag) TypeTag1;
    typedef typename GET_PROP_TYPE(TypeTag, SubDomain2TypeTag) TypeTag2;
206
207
208
209
210
211
212
213
214

    enum {
        numEq1 = GET_PROP_VALUE(TypeTag1, NumEq),
        numEq2 = GET_PROP_VALUE(TypeTag2, NumEq)
    };
public:
    static const int value = numEq1; //TODO: why??
};

215
216
SET_PROP(MultiDomain, NumEq1)
{ private:
217
    typedef typename GET_PROP_TYPE(TypeTag, SubDomain1TypeTag) TypeTag1;
218
219
220
221
222
    enum {numEq = GET_PROP_VALUE(TypeTag1, NumEq)};
public:
    static const int value = numEq;
};

223
224
SET_PROP(MultiDomain, NumEq2)
{ private:
225
    typedef typename GET_PROP_TYPE(TypeTag, SubDomain2TypeTag) TypeTag2;
226
227
228
229
230
    enum {numEq = GET_PROP_VALUE(TypeTag2, NumEq)};
public:
    static const int value = numEq;
};

231
// set the type of the linear solver
232
SET_TYPE_PROP(MultiDomain, LinearSolver, BoxBiCGStabILU0Solver<TypeTag>);
233

234
// set the minimum residual reduction of the linear solver
235
SET_SCALAR_PROP(MultiDomain, LinearSolverResidualReduction, 1e-6);
236

237
// set the default number of maximum iterations for the linear solver
238
239
SET_INT_PROP(MultiDomain, LinearSolverMaxIterations, 250);

240
// set the maximum time step divisions
241
SET_INT_PROP(MultiDomain, NewtonMaxTimeStepDivisions, 10);
242

243
244
245
// set the routines for splitting and merging solution vectors
SET_TYPE_PROP(MultiDomain, SplitAndMerge, SplitAndMerge<TypeTag>);

246
247
248
249
} // namespace Properties
} // namespace Dumux

#endif // DUMUX_MULTIDOMAIN_PROPERTY_DEFAULTS_HH
250