dune-fem  2.8-git
dgfemscheme.hh
Go to the documentation of this file.
1 #error "THIS FILE IS NOT BEING USED AND DOES NOT SEEM TO COMPILE!"
2 
3 /**************************************************************************
4 
5  The dune-fem module is a module of DUNE (see www.dune-project.org).
6  It is based on the dune-grid interface library
7  extending the grid interface by a number of discretization algorithms
8  for solving non-linear systems of partial differential equations.
9 
10  Copyright (C) 2003 - 2015 Robert Kloefkorn
11  Copyright (C) 2003 - 2010 Mario Ohlberger
12  Copyright (C) 2004 - 2015 Andreas Dedner
13  Copyright (C) 2005 Adrian Burri
14  Copyright (C) 2005 - 2015 Mirko Kraenkel
15  Copyright (C) 2006 - 2015 Christoph Gersbacher
16  Copyright (C) 2006 - 2015 Martin Nolte
17  Copyright (C) 2011 - 2015 Tobias Malkmus
18  Copyright (C) 2012 - 2015 Stefan Girke
19  Copyright (C) 2013 - 2015 Claus-Justus Heine
20  Copyright (C) 2013 - 2014 Janick Gerstenberger
21  Copyright (C) 2013 Sven Kaulman
22  Copyright (C) 2013 Tom Ranner
23  Copyright (C) 2015 Marco Agnese
24  Copyright (C) 2015 Martin Alkaemper
25 
26 
27  The dune-fem module is free software; you can redistribute it and/or
28  modify it under the terms of the GNU General Public License as
29  published by the Free Software Foundation; either version 2 of
30  the License, or (at your option) any later version.
31 
32  The dune-fem module is distributed in the hope that it will be useful,
33  but WITHOUT ANY WARRANTY; without even the implied warranty of
34  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35  GNU General Public License for more details.
36 
37  You should have received a copy of the GNU General Public License along
38  with this program; if not, write to the Free Software Foundation, Inc.,
39  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
40 
41 **************************************************************************/
42 #ifndef ELLIPT_DGFEMSCHEME_HH
43 #define ELLIPT_DGFEMSCHEME_HH
44 
45 // iostream includes
46 #include <iostream>
47 
48 // include discrete function space
51 
53 
54 // include norms
55 #include <dune/fem/misc/l2norm.hh>
56 #include <dune/fem/misc/h1norm.hh>
57 
58 // include parameter handling
59 #include <dune/fem/io/parameter.hh>
61 
63 
64 template < class Model, int polOrder, SolverType solver >
66 {
67 public:
69  typedef Model ModelType ;
70  typedef typename ModelType::ExactSolutionType ExactSolutionType;
71 
73  typedef typename ModelType::GridPartType GridPartType;
74 
76  typedef typename GridPartType::GridType GridType;
77 
79  typedef typename ModelType :: FunctionSpaceType FunctionSpaceType;
80 
83  // typedef Dune::Fem::LagrangeDiscreteFunctionSpace< FunctionSpaceType, GridPartType, polOrder > DiscreteFunctionSpaceType;
84 
85  // choose type of discrete function, Matrix implementation and solver implementation
86  typedef Solvers<DiscreteFunctionSpaceType,solver,false> UsedSolverType;
87  static_assert( UsedSolverType::solverConfigured, "chosen solver is not configured" );
88 
89  typedef typename UsedSolverType::DiscreteFunctionType DiscreteFunctionType;
90  typedef typename UsedSolverType::LinearOperatorType LinearOperatorType;
91 
92  /*********************************************************/
93 
96 
97  static const int dimRange = FunctionSpaceType::dimRange;
98 
100  const ModelType& implicitModel,
101  double penalty,
102  const std::string &prefix)
103  : implicitModel_( implicitModel ),
104  gridPart_( gridPart ),
106  solution_( prefix.c_str(), discreteSpace_ ),
107  rhs_( "rhs", discreteSpace_ ),
109  linearOperator_( "assempled elliptic operator", discreteSpace_, discreteSpace_ ),
110  solverEps_( Dune::Fem::Parameter::getValue< double >( "poisson.solvereps", 1e-8 ) ),
111  penalty_(penalty),
113  {
114  // set all DoF to zero
115  solution_.clear();
116  }
117 
119  const ModelType& implicitModel,
120  const std::string &prefix)
121  : DGFemScheme( gridPart, implicitModel,
122  Dune::Fem::Parameter::getValue<double>("dg.penalty"),
123  prefix )
124  {
125  }
126 
128  {
129  return solution_;
130  }
131  const ExactSolutionType& exactSolution() const { return exactSolution_; }
132 
136  void solve ( bool assemble )
137  {
138  typedef typename UsedSolverType::LinearInverseOperatorType LinearInverseOperatorType;
139 #if 0
141  InverseOperatorType invOp( implicitOperator_ );
142  invOp( rhs_, solution_ );
143 #else
145  LinearInverseOperatorType invOp( linearOperator_, solverEps_, solverEps_ );
146  invOp( rhs_, solution_ );
147 #endif
148  }
149 
150 protected:
151  const ModelType& implicitModel_; // the mathematical model
152 
153  GridPartType &gridPart_; // grid part(view), e.g. here the leaf grid the discrete space is build with
154 
155  DiscreteFunctionSpaceType discreteSpace_; // discrete function space
157  DiscreteFunctionType rhs_; // the right hand side
158 
159  EllipticOperatorType implicitOperator_; // the implicit operator
160 
161  LinearOperatorType linearOperator_; // the linear operator (i.e. jacobian of the implicit)
162 
163  const double solverEps_ ; // eps for linear solver
164  const double penalty_;
166 };
167 
168 #endif // end #if ELLIPT_FEMSCHEME_HH
Definition: bindguard.hh:11
void jacobian(const DomainDiscreteFunctionType &u, JacobianOperatorType &jOp) const
method to setup the jacobian of the operator for storage in a matrix
Definition: dgelliptic.hh:211
Definition: dgfemscheme.hh:66
DifferentiableDGEllipticOperator< LinearOperatorType, ModelType > EllipticOperatorType
define Laplace operator
Definition: dgfemscheme.hh:95
GridPartType & gridPart_
Definition: dgfemscheme.hh:153
ModelType::ExactSolutionType ExactSolutionType
Definition: dgfemscheme.hh:70
Model ModelType
type of the mathematical model
Definition: dgfemscheme.hh:69
Dune::Fem::DiscontinuousGalerkinSpace< FunctionSpaceType, GridPartType, polOrder > DiscreteFunctionSpaceType
choose type of discrete function space
Definition: dgfemscheme.hh:82
ModelType ::FunctionSpaceType FunctionSpaceType
type of function space (scalar functions, )
Definition: dgfemscheme.hh:79
LinearOperatorType linearOperator_
Definition: dgfemscheme.hh:161
DiscreteFunctionType solution_
Definition: dgfemscheme.hh:156
DGFemScheme(GridPartType &gridPart, const ModelType &implicitModel, const std::string &prefix)
Definition: dgfemscheme.hh:118
const ModelType & implicitModel_
Definition: dgfemscheme.hh:151
const double penalty_
Definition: dgfemscheme.hh:164
const ExactSolutionType exactSolution_
Definition: dgfemscheme.hh:165
GridPartType::GridType GridType
type of underyling hierarchical grid needed for data output
Definition: dgfemscheme.hh:76
ModelType::GridPartType GridPartType
grid view (e.g. leaf grid view) provided in the template argument list
Definition: dgfemscheme.hh:73
UsedSolverType::DiscreteFunctionType DiscreteFunctionType
Definition: dgfemscheme.hh:87
void solve(bool assemble)
Definition: dgfemscheme.hh:136
EllipticOperatorType implicitOperator_
Definition: dgfemscheme.hh:159
const DiscreteFunctionType & solution() const
Definition: dgfemscheme.hh:127
DiscreteFunctionType rhs_
Definition: dgfemscheme.hh:157
UsedSolverType::LinearOperatorType LinearOperatorType
Definition: dgfemscheme.hh:90
DGFemScheme(GridPartType &gridPart, const ModelType &implicitModel, double penalty, const std::string &prefix)
Definition: dgfemscheme.hh:99
const double solverEps_
Definition: dgfemscheme.hh:163
DiscreteFunctionSpaceType discreteSpace_
Definition: dgfemscheme.hh:155
const ExactSolutionType & exactSolution() const
Definition: dgfemscheme.hh:131
static const int dimRange
Definition: dgfemscheme.hh:97
Solvers< DiscreteFunctionSpaceType, solver, false > UsedSolverType
Definition: dgfemscheme.hh:86