Skip to content

Commit 2970302

Browse files
committed
Merge pull request #32 from danielru/fix/beautify_stabplots
beatufied generated stability plots; fixed issue with white lines in …
2 parents 30faea4 + 80a5d15 commit 2970302

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

examples/SWFW/playground.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@
1919
logger = Log.setup_custom_logger('root')
2020

2121
num_procs = 1
22+
23+
N_s = 100
24+
N_f = 125
2225

2326
# This comes as read-in for the level class
2427
lparams = {}
2528
lparams['restol'] = 1E-12
2629

2730
sparams = {}
28-
sparams['maxiter'] = 2
31+
sparams['maxiter'] = 4
2932

3033
# This comes as read-in for the problem class
3134
pparams = {}
32-
pparams['lambda_s'] = 1j*np.linspace(0,3,100)
33-
pparams['lambda_f'] = 1j*np.linspace(0,8,100)
35+
pparams['lambda_s'] = 1j*np.linspace(0.0, 4.0, N_s)
36+
pparams['lambda_f'] = 1j*np.linspace(0.0, 8.0, N_f)
3437
pparams['u0'] = 1
3538

3639
# Fill description dictionary for easy hierarchy creation
@@ -40,7 +43,8 @@
4043
description['dtype_u'] = mesh
4144
description['dtype_f'] = rhs_imex_mesh
4245
description['collocation_class'] = collclass.CollGaussLobatto
43-
description['num_nodes'] = [2]
46+
description['num_nodes'] = [3]
47+
description['do_LU'] = False
4448
description['sweeper_class'] = imex_1st_order
4549
description['level_params'] = lparams
4650

@@ -62,15 +66,19 @@
6266

6367
uex = P.u_exact(Tend)
6468

65-
fig = plt.figure(figsize=(8,8))
66-
plt.pcolor(pparams['lambda_s'].imag, pparams['lambda_f'].imag, np.absolute(uend.values).T,vmin=1,vmax=1.01)
69+
fig = plt.figure(figsize=(4,4))
70+
#pcol = plt.pcolor(pparams['lambda_s'].imag, pparams['lambda_f'].imag, np.absolute(uend.values).T, vmin=0.99, vmax=1.01)
71+
pcol = plt.pcolor(pparams['lambda_s'].imag, pparams['lambda_f'].imag, np.absolute(uend.values).T, vmin=1.0, vmax=2.0)
6772
# plt.pcolor(np.imag(uend.values))
68-
plt.colorbar()
69-
plt.xlabel('$\Delta t \lambda_{slow}$', fontsize=18, labelpad=20)
73+
pcol.set_edgecolor('face')
74+
plt.plot([0, 4], [0, 4], color='w', linewidth=2.5)
75+
#plt.colorbar()
76+
plt.gca().set_xticks([0.0, 1.0, 2.0, 3.0])
77+
plt.xlabel('$\Delta t \lambda_{slow}$', fontsize=18, labelpad=0.0)
7078
plt.ylabel('$\Delta t \lambda_{fast}$', fontsize=18)
7179

72-
plt.show()
73-
80+
#plt.show()
81+
fig.savefig('sdc-fwsw-stability-K'+str(sparams['maxiter'])+'-M'+str(description['num_nodes'][0])+'.pdf', bbox_inches='tight')
7482
print('error at time %s: %s' %(Tend,np.linalg.norm(uex.values-uend.values,np.inf)/np.linalg.norm(uex.values,
7583
np.inf)))
7684

0 commit comments

Comments
 (0)