RosenbrockMethod.cc 10.5 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
53
54
55
56
    
    // b1(2) = 0.5
    // b1(1) = 1-b1(2) = 0.5
    // alpha(2,1) = 1/(2*b1(2)) = 1
    // gamma = 1+1/sqrt(2) = 1.707...
    // gamma(2,1) = -gamma/b1(2) = -3.41421356237309
    // b2(1) = 1
    // b2(2) = 0
57

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

62
63
64
    c[0][0] = gamma;
    c[1][0] = -1.171572875253810e+00;
    c[1][1] = c[1][0] + 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
92
93
94
95
    c[0][0] =  0.435866521508459;
    c[1][0] = 8.874044410657833e-01;
    c[1][1] =  0.604455284065559;
    c[2][0] = 2.398747971635036e+01;
    c[2][1] = 5.263722371562129e+00;
    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
117
118
119
120
121
    a[0][0] = 0.0;
    a[1][0] = 1.26794919243112;
    a[1][1] = 1.0;
    a[2][0] = 1.26794919243112;
    a[2][1] = 0.0;
    a[2][2] = 1.0;
122
    
123
124
125
126
127
128
    c[0][0] =  0.788675134594813;
    c[1][0] = -1.60769515458674;
    c[1][1] = -0.211324865405187;
    c[2][0] = -3.46410161513775;
    c[2][1] = -1.73205080756888;
    c[2][2] = -1.07735026918963;
129
130
    
    m1[0] = 2.0;
131
132
    m1[1] = 0.577350269189625;
    m1[2] = 0.422649730810374;
133
    
134
    m2[0] = 2.11324865405187;
135
    m2[1] = 1.0;
136
137
138
    m2[2] = 0.422649730810374;
	
    MSG("Rosenbrock scheme Ros3p\n");
139
140
141
142
143
144
145
146
147
148
149
  }

  
  Rodasp::Rodasp()
  {
    order = 4;
    stages = 6;
    gamma = 2.5e-01;

    createData();

150
151
    a[0][0] = 0.0;
    
152
    a[1][0] =  3.0;
153
//     a[1][1] = 
154
155
    a[2][0] =  1.831036793486759e+00;
    a[2][1] =  4.955183967433795e-01;
156
//     a[2][2] = 
157
158
159
    a[3][0] =  2.304376582692669e+00;
    a[3][1] = -5.249275245743001e-02;
    a[3][2] = -1.176798761832782e+00;
160
//     a[3][3] = 
161
162
163
164
    a[4][0] = -7.170454962423025e+00;
    a[4][1] = -4.741636671481786e+00;
    a[4][2] = -1.631002631330971e+01;
    a[4][3] = -1.062004044111401e+00;
165
//     a[4][4] = 
166
167
168
169
170
    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;
171
    a[5][5] =  1.0;
172

173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
    c[0][0] =  gamma;
    
    c[1][0] = -1.200000000000000e+01;
//     c[1][1] =  4.0;
    c[2][0] = -8.791795173947035e+00;
    c[2][1] = -2.207865586973518e+00;
//     c[2][2] =  4.0;
    c[3][0] =  1.081793056857153e+01;
    c[3][1] =  6.780270611428266e+00;
    c[3][2] =  1.953485944642410e+01;
//     c[3][3] =  4.0;
    c[4][0] =  3.419095006749677e+01;
    c[4][1] =  1.549671153725963e+01;
    c[4][2] =  5.474760875964130e+01;
    c[4][3] =  1.416005392148534e+01;
//     c[4][4] =  4.0;
    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;
//     c[5][5] =  4.0;
195
196
197
198
199
200
201
202
203
204
205
206
207

    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;
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
	
    WARNING("You have to fill the diagonals of the coeffcients to use time derivatives of your operators!\n");
    MSG("Rosenbrock scheme Rodasp\n");
  }


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

    createData();

    a[0][0] =  0.0;
    a[1][0] =  1.14714018013952;
    a[1][1] =  0.5;
    a[2][0] =  1.32930341703716;
    a[2][1] =  0.442124760965983;
    a[2][2] =  0.75;
    a[3][0] = -2.19977665049954;
    a[3][1] =  4.55821087656518;
    a[3][2] = -1.37361554490645;
    a[3][3] =  1.0;

    c[0][0] =  gamma;
    c[1][0] = -0.263186118578107;
    c[1][1] =  0.385866521508459;
    c[2][0] = -3.35635061779949;
    c[2][1] =  0.334203214637756;
    c[2][2] = -0.145563307177156;
    c[3][0] = -2.6183067448488;
    c[3][1] = -1.08994123815716;
    c[3][2] = -1.71836543021444;
    c[3][3] = -0.135847884055848;
    
    m1[0] = -1.24823690752574;
    m1[1] =  3.9534178869996;
    m1[2] = -1.21522771421847;
    m1[3] =  1.16541744745931;

    m2[0] =  0.919998349829964;
    m2[1] =  1.77038079363523;
    m2[2] =  0.257316038155499;
    m2[3] =  0.343556220548095;
	
    MSG("Rosenbrock scheme ROSI2P1\n");
255
  }
256
  
257

258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
  ROSI2P2::ROSI2P2()
  {
    order = 3;
    stages = 4;
    gamma = 4.3586652150845900e-01;

    createData();

    a[0][0] =  0.0;
    a[1][0] =  1.14714018013952;
    a[1][1] =  0.5;
    a[2][0] = -0.79265181178863;
    a[2][1] =  3.48693217206767;
    a[2][2] =  1.0;
    a[3][0] = -0.79265181178863;
    a[3][1] =  3.48693217206767;
    a[3][2] =  0.0;
    a[3][3] =  1.0;

    c[0][0] =  gamma;
    c[1][0] = -0.263186118578107;
    c[1][1] =  0.385866521508459;
    c[2][0] = -1.40507848232679;
    c[2][1] =  6.18104102134041;
    c[2][2] =  1.20849664917601;
    c[3][0] =  4.99718323859189;
    c[3][1] = -6.54597265243973;
    c[3][2] = -0.539706236424999;
    c[3][3] =  0.0;
    
    m1[0] = -0.792651811788631;
    m1[1] =  3.48693217206767;
    m1[2] =  0.0;
    m1[3] =  1.0;

    m2[0] =  6.55610198824936;
    m2[1] = -5.94329934171132;
    m2[2] =  0.360559439940373;
    m2[3] = -3.34373891242489;
	
    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;
    c[1][1] = -0.435866521508468;
    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");
  }
  
344
345
346
347
348
349
350
351

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

    createData();
352
353
354
355
356
357
358
359
360
361
362
363
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
404
405
406
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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
	
    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;
    c[1][1] = -0.435866521508468;
    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;

    c[0][0] =  0.788675134594813;
    c[1][0] = -2.53589838486225;
    c[1][1] = -0.788675134594813;
    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;
	
    c[0][0] =  0.435866521508459;
    c[1][0] = -4.58856072055809;
    c[1][1] = -0.435866521508459;
    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;
464

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