DUNE-FEM (unstable)

odesolver.hh
1#ifndef RUNGEKUTTA_ODE_SOLVER_HH
2#define RUNGEKUTTA_ODE_SOLVER_HH
3
4//- system includes
5#include <iostream>
6#include <cmath>
7#include <vector>
8#include <pthread.h>
9#include <cassert>
10#include <sys/times.h>
11
12//- dune-fem includes
13#include <dune/fem/io/parameter.hh>
14#include <dune/fem/misc/mpimanager.hh>
15#include <dune/fem/operator/common/spaceoperatorif.hh>
16#include <dune/fem/operator/dghelmholtz.hh>
17
18#include <dune/fem/solver/odesolverinterface.hh>
19#include <dune/fem/solver/timeprovider.hh>
20
21#include <dune/fem/solver/newtoninverseoperator.hh>
22#include <dune/fem/solver/krylovinverseoperators.hh>
23
24#include <dune/fem/solver/rungekutta/timestepcontrol.hh>
25#include <dune/fem/solver/rungekutta/explicit.hh>
26#include <dune/fem/solver/rungekutta/implicit.hh>
27#include <dune/fem/solver/rungekutta/semiimplicit.hh>
28
29namespace DuneODE
30{
31 using namespace Dune;
32 using namespace Fem;
33 using namespace std;
34
35 using ODEParameters = ImplicitRungeKuttaSolverParameters ;
36
43 //
44 // --ExplicitOdeSolver
45 //
47 template< class Destination >
48 using ExplicitOdeSolver = ExplicitRungeKuttaSolver< Destination >;
49
51 //
52 // --ImplicitOdeSolver
53 //
55 template <class Destination>
56 using ParDGHelmholtz = DGHelmholtzOperator< SpaceOperatorInterface<Destination> >;
57
58 template <class Destination>
59 using ParDGNewtonInverse = NewtonInverseOperator<
60 typename ParDGHelmholtz< Destination > :: JacobianOperatorType,
61 KrylovInverseOperator< Destination > >;
62
63 template<class Destination>
64 class ImplicitOdeSolver
65 : public ImplicitRungeKuttaSolver<
66 ParDGHelmholtz< Destination >, ParDGNewtonInverse< Destination > >
67 {
68 public:
69 typedef SpaceOperatorInterface<Destination> OperatorType;
70 typedef ParDGHelmholtz< Destination > HelmholtzOperatorType;
71 typedef ImplicitRungeKuttaSolver< HelmholtzOperatorType, ParDGNewtonInverse< Destination > > BaseType;
72
73 protected:
74 using BaseType :: helmholtzOp_;
75 std::unique_ptr< HelmholtzOperatorType > helmOpPtr_;
76
77 HelmholtzOperatorType* createHelmholtzOperator( OperatorType& op )
78 {
79 return new HelmholtzOperatorType( op ) ;
80 }
81
82 public:
83 ImplicitOdeSolver( OperatorType& op, TimeProviderBase& tp, int order,
84 const ParameterReader &parameter = Parameter::container() )
85 : BaseType( *createHelmholtzOperator( op ), tp, order, parameter )
86 {
87 // store pointer for later removal
88 helmOpPtr_.reset( &helmholtzOp_ );
89 }
90 };
91
93 //
94 // --SemiImplicitOdeSolver
95 //
97 template<class Destination>
98 class SemiImplicitOdeSolver
99 : public SemiImplicitRungeKuttaSolver<
100 SpaceOperatorInterface<Destination>,
101 ParDGHelmholtz< Destination >, ParDGNewtonInverse< Destination > >
102 {
103 public:
104 typedef SpaceOperatorInterface<Destination> OperatorType;
105 typedef ParDGHelmholtz< Destination > HelmholtzOperatorType;
106 typedef SemiImplicitRungeKuttaSolver< OperatorType, HelmholtzOperatorType, ParDGNewtonInverse< Destination > > BaseType;
107
108 protected:
109 using BaseType :: helmholtzOp_;
110 std::unique_ptr< HelmholtzOperatorType > helmOpPtr_;
111
112 HelmholtzOperatorType* createHelmholtzOperator( OperatorType& op )
113 {
114 return new HelmholtzOperatorType( op ) ;
115 }
116
117 public:
118 SemiImplicitOdeSolver( OperatorType& explOp, OperatorType& implOp, TimeProviderBase& tp, int order,
119 const ParameterReader &parameter = Parameter::container() )
120 : BaseType( explOp, *createHelmholtzOperator( implOp ), tp, order, parameter )
121 {
122 // store pointer for later removal
123 helmOpPtr_.reset( &helmholtzOp_ );
124 }
125 };
126
131} // namespace DuneODE
132
133#endif // #ifndef RUNGEKUTTA_ODE_SOLVER_HH
Dune namespace.
Definition: alignedallocator.hh:13
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)