Skip to content

Commit 8f52263

Browse files
author
Daniel Ruprecht
committed
added output of CFL numbers
1 parent 4053e47 commit 8f52263

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

examples/acoustic_1d_imex/runconvergence.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#description['transfer_class'] = mesh_to_mesh_1d
5555
#description['transfer_params'] = tparams
5656

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

5959
for order in [2, 3, 4]:
6060

@@ -87,6 +87,10 @@
8787
# get initial values on finest level
8888
P = MS[0].levels[0].prob
8989
uinit = P.u_exact(t0)
90+
if ii==0:
91+
print "Time step: %4.2f" % dt
92+
print "Fast CFL number: %4.2f" % (pparams['cs']*dt/P.dx)
93+
print "Slow CFL number: %4.2f" % (pparams['cadv']*dt/P.dx)
9094

9195
# call main function to get things done...
9296
uend,stats = mp.run_pfasst(MS, u0=uinit, t0=t0, dt=dt, Tend=Tend)

examples/acoustic_1d_imex/runitererror.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
# get initial values on finest level
8484
P = MS[0].levels[0].prob
8585
uinit = P.u_exact(t0)
86+
87+
print "Fast CFL number: %4.2f" % (pparams['cs']*dt/P.dx)
88+
print "Slow CFL number: %4.2f" % (pparams['cadv']*dt/P.dx)
8689

8790
# call main function to get things done...
8891
uend,stats = mp.run_pfasst(MS, u0=uinit, t0=t0, dt=dt, Tend=Tend)
@@ -113,12 +116,12 @@
113116
for ii in range(0,np.size(cs_v)):
114117
x = np.arange(1,lastiter[ii,0])
115118
y = convrate[ii, 0, 0:lastiter[ii,0]-1]
116-
plt.plot(x, y, shape[ii], markersize=fs-2, color=color[ii], label=r'$c_{s}$=%4.2f' % cs_v[ii])
119+
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))
117120
#plt.plot(x, 0.0*y+avg_convrate[ii,0], '--', color=color[ii])
118121

119122
plt.legend(loc='upper right', fontsize=fs, prop={'size':fs})
120123
plt.xlabel('Iteration', fontsize=fs)
121-
plt.ylabel('Convergence rate', fontsize=fs, labelpad=2)
124+
plt.ylabel(r'$|| r^{k+1} ||_{\infty}/|| r^k ||_{\infty}$', fontsize=fs, labelpad=2)
122125
plt.xlim([0, sparams['maxiter']])
123126
plt.ylim([0, 0.8])
124127
plt.yticks(fontsize=fs)

0 commit comments

Comments
 (0)