Peano
Loading...
Searching...
No Matches
ButcherTableau.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3
4import peano4
5import jinja2
6
7
8def RungeKutta_steps(order):
9 if order<1:
10 raise Exception( "RK order has to be 1 at least" )
11 if order>4:
12 raise Exception( "max RK order supported is 4" )
13 return order
14
15
16class ButcherTableau(object):
17 def __init__(self,order):
18 self._order = order
19
20
21 def time_step_sizes(self):
22 """
23
24 These are the relative time step sizes in the scheme, i.e. the very left
25 column in the classic Butcher tableau.
26
27 """
28 if self._order==1:
29 return [0]
30 elif self._order==2:
31 return [0,1/2]
32 elif self._order==3:
33 return [0,1/2,1]
34 elif self._order==4:
35 return [0,1/3,2/3,1]
36 else:
37 raise Exception( "order {} is not yet supported".format(self._order) )
38
39
41 """
42
43 These are the relative time step sizes in the scheme, i.e. the very left
44 column in the classic Butcher tableau.
45
46 """
47 if self._order==1:
48 return [1]
49 elif self._order==2:
50 return [0,1]
51 elif self._order==3:
52 return [1/6,2/3,1/6]
53 elif self._order==4:
54 return [1/8, 3/8, 3/8, 1/8 ]
55 else:
56 raise Exception( "order {} is not yet supported".format(self._order) )
57
58
59 def weight_matrix(self):
60 if self._order==1:
61 return [
62 [0]
63 ]
64 if self._order==2:
65 return [
66 [0,0],
67 [0.5,0]
68 ]
69 if self._order==3:
70 return [
71 [ 0, 0, 0],
72 [0.5, 0, 0],
73 [ -1, 2, 0],
74 ]
75 if self._order==4:
76#0
77#1/3 1/3
78#2/3 -1/3 1
79#1 1 −1 1
80# 1/8 3/8 3/8 1/8
81 return [
82 [ 0, 0, 0, 0],
83 [ 1/3, 0, 0, 0],
84 [-1/3, 1, 0, 0],
85 [ 1, -1, 1, 0],
86 ]
87 else:
88 raise Exception( "order {} is not yet supported".format(self._order) )
89
90
91
92
time_step_sizes(self)
These are the relative time step sizes in the scheme, i.e.
final_estimate_weights(self)
These are the relative time step sizes in the scheme, i.e.