|
26 | 26 | try: |
27 | 27 | figure = int(sys.argv[1]) # 1 generates figure_1, 2 generates figure_2 |
28 | 28 | except: |
29 | | - print("No or wrong command line argument provided, creating figure 11. Use 11, 12, 13 or 14 as command line argument.") |
30 | | - figure = 11 |
31 | | -assert 11<= figure <= 14, "Figure should be 11, 12, 13 or 14" |
| 29 | + print("No or wrong command line argument provided, creating figure 5. Use 5, 6, 7 or 8 as command line argument.") |
| 30 | + figure = 5 |
| 31 | +assert 5<= figure <= 8, "Figure should be 5, 6, 7 or 8" |
32 | 32 |
|
33 | | -if figure==11 or figure==12: |
| 33 | +if figure==5 or figure==6: |
34 | 34 | par = parameter(dedalus = False) |
35 | | -elif figure==13 or figure==14: |
| 35 | +elif figure==7 or figure==8: |
36 | 36 | par = parameter(dedalus = True) |
37 | 37 | else: |
38 | | - sys.exit("Figure should be 11, 12, 13 or 14") |
| 38 | + sys.exit("This should have been caught above") |
39 | 39 |
|
40 | 40 | Tend, nslices, maxiter, nfine, ncoarse, tol, epsilon, ndof_f = par.getpar() |
41 | 41 |
|
|
44 | 44 | xaxis_f = np.linspace(0.0, 1.0, ndof_f+1)[0:ndof_f] |
45 | 45 | dx_f = xaxis_f[1] - xaxis_f[0] |
46 | 46 |
|
47 | | -if figure==11: |
| 47 | +if figure==5: |
48 | 48 | A_f = get_upwind(ndof_f, dx_f) |
49 | 49 | u0fine = solution_linear(np.zeros(ndof_f), A_f) |
50 | | -elif figure==12: |
| 50 | +elif figure==6 or figure==7: |
51 | 51 | A_f = get_centered(ndof_f, dx_f) |
52 | 52 | u0fine = solution_linear(np.zeros(ndof_f), A_f) |
53 | | -elif figure==13: |
| 53 | +elif figure==8: |
54 | 54 | u0fine = solution_dedalus(np.zeros(ndof_f), ndof_f) |
55 | 55 | else: |
56 | | - sys.exit("Figure can only have values 11, 12 or 13") |
| 56 | + sys.exit("This should have been caught above") |
57 | 57 |
|
58 | 58 | norm_l2 = np.zeros((3,np.size(nsteps))) |
59 | 59 | norm_inf = np.zeros((3,np.size(nsteps))) |
|
66 | 66 | xaxis_c = np.linspace(0.0, 1.0, ndof_c+1)[0:ndof_c] |
67 | 67 | dx_c = xaxis_c[1] - xaxis_c[0] |
68 | 68 |
|
69 | | - if figure==11: |
| 69 | + if figure==5: |
70 | 70 | A_c = get_upwind(ndof_c, dx_c) |
71 | 71 | u0coarse = solution_linear(np.zeros(ndof_c), A_c) |
72 | | - filename = 'figure_11.pdf' |
73 | | - elif figure==12: |
| 72 | + filename = 'figure_5.pdf' |
| 73 | + elif figure==6: |
74 | 74 | A_c = get_centered(ndof_c, dx_c) |
75 | 75 | u0coarse = solution_linear(np.zeros(ndof_c), A_c) |
76 | | - filename = 'figure_12.pdf' |
77 | | - elif figure==13: |
| 76 | + filename = 'figure_6.pdf' |
| 77 | + elif figure==7: |
| 78 | + A_c = get_centered(ndof_c, dx_c) |
| 79 | + u0coarse = solution_linear(np.zeros(ndof_c), A_c) |
| 80 | + filename = 'figure_7.pdf' |
| 81 | + elif figure==8: |
78 | 82 | u0coarse = solution_dedalus(np.zeros(ndof_c), ndof_c) |
79 | | - filename = 'figure_13.pdf' |
| 83 | + filename = 'figure_8.pdf' |
80 | 84 | else: |
81 | | - sys.exit("Problem can only have values 1, 2 or 3") |
| 85 | + sys.exit("Value of figure should be") |
82 | 86 |
|
83 | 87 | for mm in range(np.size(nsteps)): |
84 | 88 |
|
85 | | - if figure==11: |
| 89 | + if figure==5 or figure==7: |
86 | 90 | para = parareal(0.0, Tend, nslices, impeuler, impeuler, nsteps[mm], nsteps[mm], tol, maxiter, u0fine, u0coarse) |
87 | | - elif figure==12: |
88 | | - para = parareal(0.0, Tend, nslices, trapezoidal, trapezoidal, nsteps[mm], nsteps[mm], tol, maxiter, u0fine, u0coarse) |
89 | | - elif figure==13: |
| 91 | + elif figure==6: |
| 92 | + para = parareal(0.0, Tend, nslices, trapezoidal, trapezoidal, nsteps[mm], nsteps[mm], tol, maxiter, u0fine, u0coarse) |
| 93 | + elif figure==8: |
90 | 94 | para = parareal(0.0, Tend, nslices, integrator_dedalus, integrator_dedalus, nsteps[mm], nsteps[mm], tol, maxiter, u0fine, u0coarse) |
91 | 95 | else: |
92 | | - quit() |
| 96 | + sys.exit("Value of figure should be") |
93 | 97 | Pmat, Bmat = para.get_parareal_matrix() |
94 | 98 | dt_f_v[0,mm] = para.timemesh.slices[0].int_fine.dt |
95 | 99 | dt_c_v[0,mm] = para.timemesh.slices[0].int_coarse.dt |
|
0 commit comments