1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use na::allocator::Allocator;
use na::*;
#[derive(Clone, Debug)]
pub struct RosenbrockCoeffs<S: Dim>
where
DefaultAllocator: Allocator<f64, S, S> + Allocator<f64, S>,
{
pub gamma: f64,
pub a: MatrixN<f64, S>,
pub b: VectorN<f64, S>,
pub c: MatrixN<f64, S>,
}
impl RosenbrockCoeffs<U4> {
pub fn kr4() -> Self {
let a = Matrix4::new(
0.,
0.,
0.,
0.,
2.,
0.,
0.,
0.,
4.452_470_820_736,
4.163_528_788_60,
0.,
0.,
4.452_470_820_736,
4.163_528_788_60,
0.,
0.,
);
let b = Vector4::new(
3.957_503_746_63,
4.624_892_388_36,
0.617_477_263_873,
1.282_612_945_6,
);
let c = Matrix4::new(
0.,
0.,
0.,
0.,
-5.071_675_338_77,
0.,
0.,
0.,
6.020_152_728_65,
0.159_750_068_467_3,
0.,
0.,
-1.856_343_618_677,
-8.505_380_858_19,
-2.084_075_136_02,
0.0,
);
Self {
gamma: 0.231,
a,
b,
c,
}
}
pub fn s4() -> Self {
let a = Matrix4::new(
0.,
0.,
0.,
0.,
2.,
0.,
0.,
0.,
48. / 25.,
6. / 250.,
0.,
0.,
48. / 25.,
6. / 250.,
0.,
0.,
);
let b = Vector4::new(19. / 9., 1. / 2., 25. / 108., 125. / 108.);
let c = Matrix4::new(
0.,
0.,
0.,
0.,
-8.,
0.,
0.,
0.,
372. / 25.,
12. / 5.,
0.,
0.,
-112. / 125.,
-54. / 125.,
-2. / 5.,
0.,
);
Self {
gamma: 0.5,
a,
b,
c,
}
}
}