|
8 | 8 | from examples.fwsw.ProblemClass import swfw_scalar |
9 | 9 | import numpy as np |
10 | 10 |
|
| 11 | +from pylab import rcParams |
11 | 12 | import matplotlib.pyplot as plt |
| 13 | +from subprocess import call |
12 | 14 |
|
13 | 15 | if __name__ == "__main__": |
14 | 16 |
|
15 | 17 | N_s = 100 |
16 | 18 | N_f = 400 |
17 | 19 |
|
18 | 20 | lambda_s = 1j*np.linspace(0.0, 2.0, N_s) |
19 | | - lambda_f = 1j*np.linspace(0.0, 8.0, N_f) |
| 21 | + lambda_f = 1j*np.linspace(2.0, 8.0, N_f) |
20 | 22 |
|
21 | 23 | pparams = {} |
22 | 24 | # the following are not used in the computation |
|
63 | 65 | stab[j,i] = stab_fh |
64 | 66 |
|
65 | 67 | ### |
66 | | - fig = plt.figure(figsize=(12,12)) |
| 68 | + rcParams['figure.figsize'] = 2.5, 2.5 |
| 69 | + fs = 8 |
| 70 | + fig = plt.figure() |
67 | 71 | #pcol = plt.pcolor(lambda_s.imag, lambda_f.imag, np.absolute(stab), vmin=0.99, vmax=2.01) |
68 | 72 | #pcol.set_edgecolor('face') |
69 | | - levels = np.array([0.95, 0.99, 1.01]) |
70 | | - CS = plt.contour(lambda_s.imag, lambda_f.imag, np.absolute(stab), levels, colors='k') |
71 | | - plt.clabel(CS, fontsize=9) |
72 | | - plt.plot([0, 4], [0, 4], color='k', linewidth=2.5) |
| 73 | + levels = np.array([0.95, 0.99, 1.01, 1.05]) |
| 74 | +# levels = np.array([1.0]) |
| 75 | + CS1 = plt.contour(lambda_s.imag, lambda_f.imag, np.absolute(stab), levels, colors='k',linestyles='dashed') |
| 76 | + CS2 = plt.contour(lambda_s.imag, lambda_f.imag, np.absolute(stab), [1.0], colors='k') |
| 77 | + plt.clabel(CS1, fontsize=fs-2) |
| 78 | + plt.clabel(CS2, fontsize=fs-2) |
| 79 | + #plt.plot([0, 2], [0, 2], color='k', linewidth=1) |
73 | 80 | plt.gca().set_xticks([0.0, 1.0, 2.0, 3.0]) |
| 81 | + plt.gca().tick_params(axis='both', which='both', labelsize=fs) |
74 | 82 | plt.xlim([np.min(lambda_s.imag), np.max(lambda_s.imag)]) |
75 | | - plt.xlabel('$\Delta t \lambda_{slow}$', fontsize=18, labelpad=0.0) |
76 | | - plt.ylabel('$\Delta t \lambda_{fast}$', fontsize=18) |
77 | | - plt.show() |
| 83 | + plt.xlabel('$\Delta t \lambda_{slow}$', fontsize=fs, labelpad=0.0) |
| 84 | + plt.ylabel('$\Delta t \lambda_{fast}$', fontsize=fs) |
| 85 | + filename = 'sdc-fwsw-stability-K'+str(K)+'-M'+str(swparams['num_nodes'])+'.pdf' |
| 86 | + fig.savefig(filename, bbox_inches='tight') |
| 87 | + call(["pdfcrop", filename, filename]) |
| 88 | + |
0 commit comments