1 #ifndef DUNE_FEM_SOLVER_RUNGEKUTTA_EXPLICIT_HH
2 #define DUNE_FEM_SOLVER_RUNGEKUTTA_EXPLICIT_HH
62 template<
class DestinationImp>
69 typedef typename DestinationType :: DiscreteFunctionSpaceType
SpaceType;
87 std::cerr<<
"Warning: ExplicitRungeKutta of order "<< order <<
" not implemented, using order 6!" << std::endl;
103 : A_( butcherTable.A() ),
104 b_( butcherTable.b() ),
105 c_( butcherTable.c() ),
109 ord_( butcherTable.order() ),
110 stages_( butcherTable.stages() ),
116 for (
int i=0; i<stages_; ++i)
155 tp_.provideTimeStepEstimate( op_.timeStepEstimate() );
168 DUNE_THROW(InvalidStateException,
"ExplicitRungeKuttaSolver wasn't initialized before first call!");
172 const double dt = tp_.deltaT();
174 const double t = tp_.time();
183 tp_.provideTimeStepEstimate( op_.timeStepEstimate() );
185 for (
int i=1; i<stages_; ++i)
187 (Upd[ord_])->assign(U0);
188 for (
int j=0; j<i ; ++j)
190 (Upd[ord_])->
axpy((A_[i][j]*dt), *(Upd[j]));
194 op_.setTime( t + c_[i]*dt );
197 op_( *(Upd[ord_]), *(Upd[i]) );
200 tp_.provideTimeStepEstimate( op_.timeStepEstimate() );
204 for (
int j=0; j<stages_; ++j)
206 U0.axpy((b_[j]*dt), *(Upd[j]));
212 out <<
"ExplRungeKutta, steps: " << ord_
214 <<
"\\\\" <<std::endl;
219 Dune::DynamicMatrix< double >
A_;
220 Dune::DynamicVector< double >
b_;
221 Dune::DynamicVector< double >
c_;
224 std::vector< std::unique_ptr< DestinationType > >
Upd;
Definition: bindguard.hh:11
void axpy(const T &a, const T &x, T &y)
Definition: space/basisfunctionset/functor.hh:38
Definition: multistep.hh:17
SimpleButcherTable< double > expl6ButcherTable()
Definition: butchertable.cc:76
SimpleButcherTable< double > explicitEulerButcherTable()
Definition: butchertable.cc:16
SimpleButcherTable< double > tvd3ButcherTable()
Definition: butchertable.cc:43
SimpleButcherTable< double > tvd2ButcherTable()
Definition: butchertable.cc:29
SimpleButcherTable< double > rk4ButcherTable()
Definition: butchertable.cc:58
static ParameterContainer & container()
Definition: io/parameter.hh:193
interface for time evolution operators
Definition: spaceoperatorif.hh:38
Interface class for ODE Solver.
Definition: odesolverinterface.hh:21
DestinationImp DestinationType
type of destination
Definition: odesolverinterface.hh:62
Definition: odesolverinterface.hh:27
void reset()
Definition: odesolverinterface.hh:43
Definition: butchertable.hh:17
Exlicit RungeKutta ODE solver.
Definition: explicit.hh:65
bool initialized_
Definition: explicit.hh:236
OperatorType & op_
Definition: explicit.hh:227
SimpleButcherTable< double > defaultButcherTables(const int order) const
Definition: explicit.hh:75
Dune::DynamicMatrix< double > A_
Definition: explicit.hh:219
ExplicitRungeKuttaSolver(OperatorType &op, TimeProviderBase &tp, const int pord, bool verbose)
constructor
Definition: explicit.hh:130
DestinationImp DestinationType
Definition: explicit.hh:67
void description(std::ostream &out) const
print description of ODE solver to out stream
Definition: explicit.hh:210
OdeSolverInterface< DestinationImp >::MonitorType MonitorType
Definition: explicit.hh:71
DestinationType ::DiscreteFunctionSpaceType SpaceType
Definition: explicit.hh:69
std::vector< std::unique_ptr< DestinationType > > Upd
Definition: explicit.hh:224
const int stages_
Definition: explicit.hh:234
TimeProviderBase & tp_
Definition: explicit.hh:229
ExplicitRungeKuttaSolver(OperatorType &op, TimeProviderBase &tp, const SimpleButcherTable< double > &butcherTable, bool verbose)
constructor
Definition: explicit.hh:99
SpaceOperatorInterface< DestinationImp > OperatorType
Definition: explicit.hh:68
Dune::DynamicVector< double > b_
Definition: explicit.hh:220
void solve(DestinationType &U0, MonitorType &monitor)
solve the system
Definition: explicit.hh:160
ExplicitRungeKuttaSolver(OperatorType &op, TimeProviderBase &tp, const int pord, const Dune::Fem::ParameterReader ¶meter=Dune::Fem::Parameter::container())
Definition: explicit.hh:138
Dune::DynamicVector< double > c_
Definition: explicit.hh:221
void initialize(const DestinationType &U0)
apply operator once to get dt estimate
Definition: explicit.hh:146
const int ord_
Definition: explicit.hh:232
general base for time providers
Definition: timeprovider.hh:36