DUNE-FEM (unstable)

dgfemscheme.hh
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
49#include <dune/fem/space/discontinuousgalerkin.hh>
50#include <dune/fem/space/lagrange.hh>
51
52#include <dune/fem/solver/newtoninverseoperator.hh>
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>
60#include <dune/fem/io/file/dataoutput.hh>
61
62#include <dune/fem/schemes/dgelliptic.hh>
63
64template < class Model, int polOrder, SolverType solver >
65class DGFemScheme
66{
67public:
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
82 typedef Dune::Fem::DiscontinuousGalerkinSpace< FunctionSpaceType, GridPartType, polOrder > DiscreteFunctionSpaceType;
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
95 typedef DifferentiableDGEllipticOperator< LinearOperatorType, ModelType > EllipticOperatorType;
96
97 static const int dimRange = FunctionSpaceType::dimRange;
98
99 DGFemScheme( GridPartType &gridPart,
100 const ModelType& implicitModel,
101 double penalty,
102 const std::string &prefix)
103 : implicitModel_( implicitModel ),
104 gridPart_( gridPart ),
105 discreteSpace_( gridPart_ ),
106 solution_( prefix.c_str(), discreteSpace_ ),
107 rhs_( "rhs", discreteSpace_ ),
108 implicitOperator_( implicitModel_, discreteSpace_, penalty ),
109 linearOperator_( "assempled elliptic operator", discreteSpace_, discreteSpace_ ),
110 solverEps_( Dune::Fem::Parameter::getValue< double >( "poisson.solvereps", 1e-8 ) ),
111 penalty_(penalty),
112 exactSolution_( implicitModel_.exactSolution(gridPart_) )
113 {
114 // set all DoF to zero
115 solution_.clear();
116 }
117
118 DGFemScheme( GridPartType &gridPart,
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
127 const DiscreteFunctionType &solution() const
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
144 implicitOperator_.jacobian( solution_ , linearOperator_ );
145 LinearInverseOperatorType invOp( linearOperator_, solverEps_, solverEps_ );
146 invOp( rhs_, solution_ );
147#endif
148 }
149
150protected:
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
156 DiscreteFunctionType solution_; // the unknown
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_;
165 const ExactSolutionType exactSolution_;
166};
167
168#endif // end #if ELLIPT_FEMSCHEME_HH
Inverse operator base on CG method. Uses a runtime parameter fem.preconditioning which enables diagon...
Definition: cginverseoperator.hh:408
@ dimRange
dimension of range vector space
Definition: functionspaceinterface.hh:48
A vector valued function space.
Definition: functionspace.hh:60
inverse operator based on a newton scheme
Definition: newtoninverseoperator.hh:357
forward declaration
Definition: discretefunction.hh:51
Dune namespace.
Definition: alignedallocator.hh:13
SparseRowLinearOperator.
Definition: spoperator.hh:25
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)