Skip to content

Commit 0c46aed

Browse files
author
Daniel Ruprecht
committed
tweaked parameter for convergence plots; use two sine modes as initial data instead of only one
1 parent d6b4649 commit 0c46aed

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

examples/acoustic_1d_imex/ProblemClass_conv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from buildWave1DMatrix import getWave1DMatrix, getWave1DAdvectionMatrix
2121

2222
def u_initial(x, k):
23-
return np.sin(k*2.0*np.pi*x)
23+
return np.sin(k*2.0*np.pi*x) + np.sin(2.0*np.pi*x)
2424

2525
class acoustic_1d_imex(ptype):
2626
"""

examples/acoustic_1d_imex/plotconvdata.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@
4545
plt.loglog(nsteps_plot[ii,:], error_plot[ii,:], shape[ii], markersize=fs, color=color[ii], label='p='+str(int(order_plot[ii])))
4646

4747

48-
plt.legend(loc='upper right', fontsize=fs, prop={'size':fs})
48+
plt.legend(loc='lower left', fontsize=fs, prop={'size':fs})
4949
plt.xlabel('Number of time steps', fontsize=fs)
5050
plt.ylabel('Relative error', fontsize=fs, labelpad=2)
5151
plt.xlim([0.9*np.min(nsteps_plot), 1.1*np.max(nsteps_plot)])
52-
plt.ylim([1e-7, 1e1])
53-
plt.yticks([1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0, 1e1],fontsize=fs)
54-
plt.xticks([25, 50, 100], fontsize=fs)
52+
plt.ylim([1e-5, 1e0])
53+
plt.yticks([1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0],fontsize=fs)
54+
plt.xticks([30, 40, 60, 80], fontsize=fs)
5555
plt.gca().get_xaxis().get_major_formatter().labelOnlyBase = False
5656
plt.gca().get_xaxis().set_major_formatter(ScalarFormatter())
5757
plt.show()
58-
filename = 'sdc_fwsw_convergence.pdf'
58+
filename = 'sdc-fwsw-convergence.pdf'
5959
fig.savefig(filename,bbox_inches='tight')
6060
call(["pdfcrop", filename, filename])
6161

examples/acoustic_1d_imex/runconvergence.py

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

3232
# This comes as read-in for the problem class
3333
pparams = {}
34-
pparams['nvars'] = [(2,400)]
35-
pparams['cadv'] = 0.05
34+
pparams['nvars'] = [(2,300)]
35+
pparams['cadv'] = 0.1
3636
pparams['cs'] = 1.00
3737
pparams['order_adv'] = 5
38-
pparams['waveno'] = 2
39-
40-
# This comes as read-in for the transfer operations
41-
tparams = {}
42-
tparams['finter'] = True
38+
pparams['waveno'] = 5
4339

4440
# Fill description dictionary for easy hierarchy creation
4541
description = {}
@@ -53,7 +49,7 @@
5349
description['level_params'] = lparams
5450
description['hook_class'] = plot_solution
5551

56-
Nsteps = [15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]
52+
Nsteps = [30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80]
5753

5854
for order in [2, 3, 4]:
5955

examples/acoustic_1d_imex/runitererror.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646

4747
# This comes as read-in for the problem class
4848
pparams = {}
49-
pparams['nvars'] = [(2,250)]
50-
pparams['cadv'] = 0.05
49+
pparams['nvars'] = [(2,300)]
50+
pparams['cadv'] = 0.1
5151
pparams['cs'] = cs_v[cs_ind]
5252
pparams['order_adv'] = 5
53-
pparams['waveno'] = 1
53+
pparams['waveno'] = 5
5454

5555
# This comes as read-in for the transfer operations
5656
tparams = {}
@@ -72,7 +72,7 @@
7272
for nodes_ind in np.arange(np.size(nodes_v)):
7373
# setup parameters "in time"
7474
t0 = 0
75-
Tend = 0.05
75+
Tend = 0.025
7676
description['num_nodes'] = nodes_v[nodes_ind]
7777

7878
# quickly generate block of steps
@@ -119,15 +119,15 @@
119119
plt.plot(x, y, shape[ii], markersize=fs-2, color=color[ii], label=r'$C_{\rm fast}$=%4.2f' % (cs_v[ii]*dt/P.dx))
120120
#plt.plot(x, 0.0*y+avg_convrate[ii,0], '--', color=color[ii])
121121

122-
plt.legend(loc='upper right', fontsize=fs, prop={'size':fs})
122+
plt.legend(loc='upper right', fontsize=fs, prop={'size':fs-2})
123123
plt.xlabel('Iteration', fontsize=fs)
124124
plt.ylabel(r'$|| r^{k+1} ||_{\infty}/|| r^k ||_{\infty}$', fontsize=fs, labelpad=2)
125125
plt.xlim([0, sparams['maxiter']])
126-
plt.ylim([0, 0.8])
126+
plt.ylim([0, 1.0])
127127
plt.yticks(fontsize=fs)
128128
plt.xticks(fontsize=fs)
129129
plt.show()
130-
filename = 'sdc_fwsw_iteration.pdf'
130+
filename = 'sdc-fwsw-iteration.pdf'
131131
fig.savefig(filename,bbox_inches='tight')
132132
call(["pdfcrop", filename, filename])
133133

0 commit comments

Comments
 (0)