Skip to content

Commit c0c0434

Browse files
author
Daniel Ruprecht
committed
updated plot routines to use Legendre nodes
1 parent f693675 commit c0c0434

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

examples/acoustic_1d_imex/plotconvdata.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from matplotlib import pyplot as plt
33
from pylab import rcParams
44
from matplotlib.ticker import ScalarFormatter
5+
from subprocess import call
56

67
fs = 8
78
order = np.array([])
@@ -54,5 +55,8 @@
5455
plt.gca().get_xaxis().get_major_formatter().labelOnlyBase = False
5556
plt.gca().get_xaxis().set_major_formatter(ScalarFormatter())
5657
plt.show()
57-
fig.savefig('sdc_fwsw_convergence.pdf',bbox_inches='tight')
58+
filename = 'sdc_fwsw_convergence.pdf'
59+
fig.savefig(filename,bbox_inches='tight')
60+
call(["pdfcrop", filename, filename])
61+
5862

examples/acoustic_1d_imex/runconvergence.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131

3232
# This comes as read-in for the problem class
3333
pparams = {}
34-
pparams['nvars'] = [(2,250)]
34+
pparams['nvars'] = [(2,400)]
3535
pparams['cadv'] = 0.05
3636
pparams['cs'] = 1.00
3737
pparams['order_adv'] = 5
38-
pparams['waveno'] = 1
38+
pparams['waveno'] = 2
3939

4040
# This comes as read-in for the transfer operations
4141
tparams = {}
@@ -47,12 +47,11 @@
4747
description['problem_params'] = pparams
4848
description['dtype_u'] = mesh
4949
description['dtype_f'] = rhs_imex_mesh
50-
description['collocation_class'] = collclass.CollGaussLobatto
50+
description['collocation_class'] = collclass.CollGaussLegendre
5151
description['sweeper_class'] = imex_1st_order
52+
description['do_coll_update'] = True
5253
description['level_params'] = lparams
5354
description['hook_class'] = plot_solution
54-
#description['transfer_class'] = mesh_to_mesh_1d
55-
#description['transfer_params'] = tparams
5655

5756
Nsteps = [15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]
5857

examples/acoustic_1d_imex/runmultiscale.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from matplotlib import pyplot as plt
1818
from pylab import rcParams
19+
from subprocess import call
1920

2021
fs = 8
2122

@@ -56,11 +57,9 @@
5657
description['problem_params'] = pparams
5758
description['dtype_u'] = mesh
5859
description['dtype_f'] = rhs_imex_mesh
59-
description['collocation_class'] = collclass.CollGaussRadau_Right
60-
if sparams['maxiter']==2:
61-
description['num_nodes'] = 2
62-
else:
63-
description['num_nodes'] = 3
60+
description['collocation_class'] = collclass.CollGaussLegendre
61+
# Number of nodes
62+
description['num_nodes'] = 3
6463
description['sweeper_class'] = imex_1st_order
6564
description['level_params'] = lparams
6665
description['hook_class'] = plot_solution
@@ -137,4 +136,7 @@
137136
plt.legend(loc='upper left', fontsize=fs, prop={'size':fs})
138137
fig.gca().grid()
139138
#plt.show()
140-
plt.gcf().savefig('fwsw-sdc-K'+str(sparams['maxiter'])+'-M'+str(description['num_nodes'])+'.pdf', bbox_inches='tight')
139+
filename = 'sdc-fwsw-multiscale-K'+str(sparams['maxiter'])+'-M'+str(description['num_nodes'])+'.pdf'
140+
plt.gcf().savefig(filename, bbox_inches='tight')
141+
call(["pdfcrop", filename, filename])
142+

examples/fwsw/plot_stifflimit_specrad.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from matplotlib import pyplot as plt
1212
from pylab import rcParams
13+
from subprocess import call
1314

1415
if __name__ == "__main__":
1516

@@ -20,7 +21,7 @@
2021
pparams['lambda_f'] = np.array([50.0*1j], dtype='complex')
2122
pparams['u0'] = 1.0
2223
swparams = {}
23-
swparams['collocation_class'] = collclass.CollGaussLobatto
24+
swparams['collocation_class'] = collclass.CollGaussLegendre
2425

2526
nodes_v = np.arange(2,10)
2627
specrad = np.zeros((2,np.size(nodes_v)))
@@ -53,8 +54,10 @@
5354
# For Lobatto nodes, first column and row are all zeros, since q_1 = q_0; hence remove them
5455
QI = QI[1:,1:]
5556
Q = Q[1:,1:]
56-
# Eigenvalue of error propagation matrix in stiff limit: E = I - inv(QI)*Q
57-
evals, evecs = np.linalg.eig( np.eye(nnodes-1) - np.linalg.inv(QI).dot(Q) )
57+
# Eigenvalue of error propagation matrix in stiff limit: E = I - inv(QI)*Q
58+
evals, evecs = np.linalg.eig( np.eye(nnodes-1) - np.linalg.inv(QI).dot(Q) )
59+
else:
60+
evals, evecs = np.linalg.eig( np.eye(nnodes) - np.linalg.inv(QI).dot(Q) )
5861
specrad[0,i] = np.linalg.norm( evals, np.inf )
5962

6063
### Plot result
@@ -71,5 +74,8 @@
7174
plt.yticks(fontsize=fs)
7275
plt.xticks(fontsize=fs)
7376
#plt.show()
74-
fig.savefig('sdc_fwsw_stifflimit_specrad.pdf',bbox_inches='tight')
77+
filename = 'sdc_fwsw_stifflimit_specrad.pdf'
78+
fig.savefig(filename,bbox_inches='tight')
79+
call(["pdfcrop", filename, filename])
80+
7581

0 commit comments

Comments
 (0)