RosenbrockMethod.cc 10.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


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
#include "time/RosenbrockMethod.h"

namespace AMDiS {

  void RosenbrockMethod::createData()
  {
    a.resize(stages);
    for (int i = 0; i < stages; i++) {
      a[i].resize(stages);
      for (int j = 0; j < stages; j++)
	a[i][j] = 0.0;
    }

    c.resize(stages);
    for (int i = 0; i < stages; i++) {
      c[i].resize(stages);
      for (int j = 0; j < stages; j++)
	c[i][j] = 0.0;
    }
    
    m1.resize(stages);
    m2.resize(stages);
    for (int i = 0; i < stages; i++) {
      m1[i] = 0.0;
      m2[i] = 0.0;
    }
  }
  

  Ros2::Ros2()
  {
    order = 2;
    stages = 2;
    gamma = 1.707106781186547;

    createData();
49
    
50
51
52
    // b(2) = 0.5
    // b(1) = 1-b(2) = 0.5
    // alpha(2,1) = 1/(2*b(2)) = 1
53
    // gamma = 1+1/sqrt(2) = 1.707...
54
55
56
    // gamma(2,1) = -gamma/b(2) = -3.41421356237309
    // b_(1) = 1
    // b_(2) = 0
57

58
    a[0][0] = 0.0;
59
    a[1][0] = 5.857864376269050e-01;
60
    a[1][1] = 1.0;
61

62
63
    c[0][0] = gamma;
    c[1][0] = -1.171572875253810e+00;
64
    c[1][1] = -gamma;
65
66
67
68
69

    m1[0] = 8.786796564403575e-01;
    m1[1] = 2.928932188134525e-01;

    m2[0] = 5.857864376269050e-01;
70
71
72
    m2[1] = 0.0;
	
    MSG("Rosenbrock scheme Ros2\n");
73
74
75
76
77
78
79
80
81
82
83
  }


  Rowda3::Rowda3()
  {
    order = 3;
    stages = 3;
    gamma = 4.358665215084590e-01;

    createData();
    
84
    a[0][0] = 0.0;
85
    a[1][0] = 1.605996252195329e+00;
86
    a[1][1] = 0.7;
87
    a[2][0] = 1.605996252195329e+00;
88
    a[2][2] = 0.7;
89
    
90
91
    c[0][0] =  gamma;
    c[1][0] =  8.874044410657833e-01;
92
    c[1][1] =  0.604455284065559;
93
94
    c[2][0] =  2.398747971635036e+01;
    c[2][1] =  5.263722371562129e+00;
95
    c[2][2] =  6.37978879934488;
96
97
98
99
100
101
102
    
    m1[0] =  2.236727045296590e+00;
    m1[1] =  2.250067730969644e+00;
    m1[2] = -2.092514044390320e-01;
    
    m2[0] = 2.059356167645940e+00;
    m2[1] = 1.694014319346528e-01;
103
104
	
    MSG("Rosenbrock scheme Rowda3\n");
105
106
107
108
109
110
111
112
113
114
115
  }


  Ros3p::Ros3p()
  {
    order = 3;
    stages = 3;
    gamma = 7.886751345948129e-01;

    createData();
    
116
    a[0][0] = 0.0;
117
    a[1][0] = 1.267949192431123;
118
    a[1][1] = 1.0;
119
    a[2][0] = 1.267949192431123;
120
121
    a[2][1] = 0.0;
    a[2][2] = 1.0;
122
    
123
124
125
126
127
128
    c[0][0] =  gamma;
    c[1][0] = -1.607695154586736;
    c[1][1] = -0.2113248654051871;
    c[2][0] = -3.464101615137755;
    c[2][1] = -1.732050807568877;
    c[2][2] = -1.077350269189626;
129
130
    
    m1[0] = 2.0;
131
132
    m1[1] = 0.5773502691896258;
    m1[2] = 0.4226497308103742;
133
    
134
    m2[0] = 2.113248654051871;
135
    m2[1] = 1.0;
136
    m2[2] = 0.4226497308103742;
137
138
	
    MSG("Rosenbrock scheme Ros3p\n");
139
140
141
142
143
144
145
  }

  
  Rodasp::Rodasp()
  {
    order = 4;
    stages = 6;
146
    gamma = 0.25;
147
148
149

    createData();

150
    a[0][0] = 0.0;
151
    a[1][0] =  3.0;
152
    a[1][1] =  0.75;
153
154
    a[2][0] =  1.831036793486759e+00;
    a[2][1] =  4.955183967433795e-01;
155
    a[2][2] =  0.21;
156
157
158
    a[3][0] =  2.304376582692669e+00;
    a[3][1] = -5.249275245743001e-02;
    a[3][2] = -1.176798761832782e+00;
159
    a[3][3] =  0.63;
160
161
162
163
    a[4][0] = -7.170454962423025e+00;
    a[4][1] = -4.741636671481786e+00;
    a[4][2] = -1.631002631330971e+01;
    a[4][3] = -1.062004044111401e+00;
164
    a[4][4] =  1.0;
165
166
167
168
169
    a[5][0] = -7.170454962423025e+00;
    a[5][1] = -4.741636671481785e+00;
    a[5][2] = -1.631002631330971e+01;
    a[5][3] = -1.062004044111401e+00;
    a[5][4] =  1.0;
170
    a[5][5] =  1.0;
171

172
173
    c[0][0] =  gamma;
    c[1][0] = -1.200000000000000e+01;
174
    c[1][1] = -0.5;
175
176
    c[2][0] = -8.791795173947035e+00;
    c[2][1] = -2.207865586973518e+00;
177
    c[2][2] = -0.023504;
178
179
180
    c[3][0] =  1.081793056857153e+01;
    c[3][1] =  6.780270611428266e+00;
    c[3][2] =  1.953485944642410e+01;
181
    c[3][3] = -0.0362;
182
183
184
185
    c[4][0] =  3.419095006749677e+01;
    c[4][1] =  1.549671153725963e+01;
    c[4][2] =  5.474760875964130e+01;
    c[4][3] =  1.416005392148534e+01;
186
    c[4][4] =  0.0;
187
188
189
190
191
    c[5][0] =  3.462605830930533e+01;
    c[5][1] =  1.530084976114473e+01;
    c[5][2] =  5.699955578662667e+01;
    c[5][3] =  1.840807009793095e+01;
    c[5][4] = -5.714285714285717e+00;
192
    c[5][5] =  0.0;
193
194
195
196
197
198
199
200
201
202
203
204
205

    m1[0] = -7.170454962423026e+00;
    m1[1] = -4.741636671481786e+00;
    m1[2] = -1.631002631330971e+01;
    m1[3] = -1.062004044111401e+00;
    m1[4] =  1.0;
    m1[5] =  1.0;

    m2[0] = -7.170454962423026e+00;
    m2[1] = -4.741636671481786e+00;
    m2[2] = -1.631002631330971e+01;
    m2[3] = -1.062004044111401e+00;
    m2[4] =  1.0;
206
207
208
209
210
211
212
213
214
215
216
217
218
219
	
    MSG("Rosenbrock scheme Rodasp\n");
  }


  ROSI2P1::ROSI2P1()
  {
    order = 3;
    stages = 4;
    gamma = 4.35866521508459e-01;

    createData();

    a[0][0] =  0.0;
220
    a[1][0] =  1.147140180139521;
221
    a[1][1] =  0.5;
222
    a[2][0] =  1.785764587181959;
223
224
    a[2][1] =  0.442124760965983;
    a[2][2] =  0.75;
225
226
227
    a[3][0] =  2.506239510951673;
    a[3][1] =  4.558210876565182;
    a[3][2] = -1.373615544906449;
228
229
230
    a[3][3] =  1.0;

    c[0][0] =  gamma;
231
232
233
    c[1][0] = -2.631861185781065;
    c[1][1] = -0.064133478491541;
    c[2][0] = -3.011310475541004;
234
235
    c[2][1] =  0.334203214637756;
    c[2][2] = -0.145563307177156;
236
237
238
    c[3][0] = -3.743590594301783;
    c[3][1] = -1.089941238157158;
    c[3][2] = -1.718365430214442;
239
240
    c[3][3] = -0.135847884055848;
    
241
242
243
244
    m1[0] =  2.833375148827832;
    m1[1] =  3.953417886999603;
    m1[2] = -1.215227714218472;
    m1[3] =  1.165417447459307;
245

246
247
    m2[0] =  2.747785798103605;
    m2[1] =  1.770380793635233;
248
249
250
251
    m2[2] =  0.257316038155499;
    m2[3] =  0.343556220548095;
	
    MSG("Rosenbrock scheme ROSI2P1\n");
252
  }
253
  
254

255
256
257
258
259
260
261
262
263
  ROSI2P2::ROSI2P2()
  {
    order = 3;
    stages = 4;
    gamma = 4.3586652150845900e-01;

    createData();

    a[0][0] =  0.0;
264
    a[1][0] =  1.147140180139521;
265
    a[1][1] =  0.5;
266
267
    a[2][0] =  2.807348188211369;
    a[2][1] =  3.486932172067671;
268
    a[2][2] =  1.0;
269
270
    a[3][0] =  a[2][0];
    a[3][1] =  a[2][1];
271
272
273
274
    a[3][2] =  0.0;
    a[3][3] =  1.0;

    c[0][0] =  gamma;
275
276
277
278
279
280
281
    c[1][0] = -2.631861185781065;
    c[1][1] = -0.064133478491541;
    c[2][0] =  4.976389977276388;
    c[2][1] =  6.181041021340408;
    c[2][2] =  1.208496649176010;
    c[3][0] = -1.761050184345382;
    c[3][1] = -6.545972652439727;
282
283
284
    c[3][2] = -0.539706236424999;
    c[3][3] =  0.0;
    
285
286
    m1[0] =  2.807348188211369;
    m1[1] =  3.486932172067672;
287
288
289
    m1[2] =  0.0;
    m1[3] =  1.0;

290
291
    m2[0] =  0.420084258522926;
    m2[1] = -5.943299341711317;
292
    m2[2] =  0.360559439940373;
293
    m2[3] = -3.343738912424890;
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
	
    MSG("Rosenbrock scheme ROSI2P2\n");
  }

  ROSI2Pw::ROSI2Pw()
  {
    order = 3;
    stages = 4;
    gamma = 4.3586652150845e-01;

    createData();
	
    a[0][0] =  0.0;
    a[1][0] =  2.0;
    a[1][1] =  0.871733043016918;
    a[2][0] =  1.63034046718537;
    a[2][1] = -0.0903698030239437;
    a[2][2] =  0.75;
    a[3][0] =  3.28685750853379;
    a[3][1] =  15.4503745896552;
    a[3][2] = -15.0445558288081;
    a[3][3] =  1.0;
	
    c[0][0] = gamma;
    c[1][0] = -4.58856072055827;
319
    c[1][1] = -gamma;
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
    c[2][0] = -4.56739138878308;
    c[2][1] = -0.0683107605436897;
    c[2][2] = -0.418867127163069;
    c[3][0] = -2.99296365068231;
    c[3][1] = -42.6472578877056;
    c[3][2] =  43.6510246478391;
    c[3][3] =  0.0;
	
    m1[0] =  3.28685750853379;
    m1[1] =  15.4503745896552;
    m1[2] = -15.0445558288081;
    m1[3] =  1.0;

    m2[0] =  3.3904377475357;
    m2[1] =  5.865078412615;
    m2[2] = -4.96246395067988;
    m2[3] =  0.260825116305751;
	
    MSG("Rosenbrock scheme ROSI2Pw\n");
  }
  
341
342
343
344
345
346
347
348

  ROSI2PW::ROSI2PW()
  {
    order = 3;
    stages = 4;
    gamma = 4.3586652150845e-01;

    createData();
349
350
351
352
353
354
355
356
357
358
359
360
361
362
	
    a[0][0] =  0.0;
    a[1][0] =  2.0;
    a[1][1] =  0.871733043016918;
    a[2][0] = -5.501959790112310;
    a[2][1] = -1.833986596704078;
    a[2][2] = -1.59874671679705;
    a[3][0] =  4.338560720558247;
    a[3][1] =  1.147140180139553;
    a[3][2] = -0.059559354637499;
    a[3][3] =  1.0;

    c[0][0] = gamma;
    c[1][0] = -4.58856072055827;
363
    c[1][1] = -gamma;
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
    c[2][0] =  48.3965596116246;
    c[2][1] =  16.132186537208;
    c[2][2] =  6.56544000523295;
    c[3][0] = -2.31911621201727;
    c[3][1] = -1.14714018013959;
    c[3][2] = -0.0745075552140216;
    c[3][3] =  0.0;
    
    m1[0] =  4.33856072055832;
    m1[1] =  1.14714018013958;
    m1[2] = -0.0595593546375007;
    m1[3] =  1.0;

    m2[0] =  3.31383144448529;
    m2[1] =  1.14714018013955;
    m2[2] =  0.00847038665840751;
    m2[3] =  0.260825116305751;
	
    MSG("Rosenbrock scheme ROSI2PW\n");
  }
    

  Ros3Pw::Ros3Pw()
  {
    // index1 | index2 | pdes | R(infty) | stiffly acc.
    // -------+--------+------+----------+-------------
    //    1   |   0    |   1  |  0.73    |   0
    order = 3;
    stages = 3;
    gamma = 7.8867513459481287e-01;

    createData();
	
    a[0][0] = 0.0;
    a[1][0] = 2.0;
    a[1][1] = 1.57735026918963;
    a[2][0] = 0.633974596215561;
    a[2][1] = 0.0;
    a[2][2] = 0.5;

404
    c[0][0] =  gamma;
405
    c[1][0] = -2.53589838486225;
406
    c[1][1] = -gamma;
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
    c[2][0] = -1.62740473580836;
    c[2][1] = -0.274519052838329;
    c[2][2] = -0.0528312163512967;

    m1[0] =  1.63397459621556;
    m1[1] =  0.294228634059948;
    m1[2] =  1.07179676972449;

    m2[0] =  1.99444650053487  ;
    m2[1] =  0.654700538379252;
    m2[2] =  1.07179676972449;
	
    MSG("Rosenbrock scheme Ros3Pw\n");
  }
  
    

  Ros34PW2::Ros34PW2()
  {
    // index1 | index2 | pdes | R(infty) | stiffly acc.
    // -------+--------+------+----------+-------------
    //    1   |   0    |   1  |  0.0     |   1
    order = 3;
    stages = 4;
    gamma = 4.3586652150845e-01;

    createData();
	
    a[0][0] =  0.0;
    a[1][0] =  2.0;
    a[1][1] =  0.871733043016918;
    a[2][0] =  1.41921731745576;
    a[2][1] = -0.25923221167297;
    a[2][2] =  0.731579957788852;
    a[3][0] =  4.18476048231916;
    a[3][1] = -0.285192017355496;
    a[3][2] =  2.29428036027904;
    a[3][3] =  1.0;
	
446
    c[0][0] =  gamma;
447
    c[1][0] = -4.58856072055809;
448
    c[1][1] = -gamma;
449
450
451
452
453
454
455
456
457
458
459
460
    c[2][0] = -4.18476048231916;
    c[2][1] =  0.285192017355496;
    c[2][2] = -0.413333376233886;
    c[3][0] = -6.36817920012836;
    c[3][1] = -6.79562094446684;
    c[3][2] =  2.87009860433106;
    c[3][3] =  0.0;

    m1[0] =  4.18476048231916;
    m1[1] = -0.285192017355496;
    m1[2] =  2.29428036027904;
    m1[3] =  1.0;
461

462
463
464
465
466
467
    m2[0] =  3.90701053467119;
    m2[1] =  1.1180478778205;
    m2[2] =  0.521650232611491;
    m2[3] =  0.5;
	
    MSG("Rosenbrock scheme Ros34PW2\n");
468
  }
469
}