Skip to content

Commit 7fc052d

Browse files
author
Daniel Ruprecht
committed
parameter changes to generate figures now given in paper draft
1 parent e821609 commit 7fc052d

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

examples/boussinesq_2d_imex/rungmrescounter.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
from mpl_toolkits.mplot3d import Axes3D
1818
from matplotlib import cm
1919
from matplotlib.ticker import LinearLocator, FormatStrFormatter
20+
from pylab import rcParams
21+
2022
from unflatten import unflatten
2123

2224
from standard_integrators import dirk
@@ -30,17 +32,17 @@
3032

3133
# This comes as read-in for the level class
3234
lparams = {}
33-
lparams['restol'] = 1E-8
35+
lparams['restol'] = 1E-15
3436

3537
swparams = {}
3638
swparams['collocation_class'] = collclass.CollGaussLobatto
3739
swparams['num_nodes'] = 3
38-
swparams['do_LU'] = True
40+
swparams['do_LU'] = False
3941

4042
sparams = {}
41-
sparams['maxiter'] = 4
43+
sparams['maxiter'] = 3
4244

43-
dirk_order = 4
45+
dirk_order = 2
4446

4547
# setup parameters "in time"
4648
t0 = 0
@@ -52,16 +54,16 @@
5254

5355
# This comes as read-in for the problem class
5456
pparams = {}
55-
#pparams['nvars'] = [(4,450,30)]
56-
pparams['nvars'] = [(4,150,10)]
57+
pparams['nvars'] = [(4,300,20)]
58+
#pparams['nvars'] = [(4,150,10)]
5759
pparams['u_adv'] = 0.02
5860
pparams['c_s'] = 0.3
5961
pparams['Nfreq'] = 0.01
6062
pparams['x_bounds'] = [(-150.0, 150.0)]
6163
pparams['z_bounds'] = [( 0.0, 10.0)]
6264
pparams['order'] = [4] # [fine_level, coarse_level]
6365
pparams['order_upw'] = [5]
64-
pparams['gmres_maxiter'] = [50]
66+
pparams['gmres_maxiter'] = [500]
6567
pparams['gmres_restart'] = [10]
6668
pparams['gmres_tol'] = [1e-6]
6769

@@ -87,28 +89,37 @@
8789
P = MS[0].levels[0].prob
8890
uinit = P.u_exact(t0)
8991

90-
dirk = dirk(P, dirk_order)
91-
u0 = uinit.values.flatten()
92-
93-
for i in range(0,Nsteps):
94-
u0 = dirk.timestep(u0, dt)
95-
9692
cfl_advection = pparams['u_adv']*dt/P.h[0]
9793
cfl_acoustic_hor = pparams['c_s']*dt/P.h[0]
9894
cfl_acoustic_ver = pparams['c_s']*dt/P.h[1]
9995
print ("CFL number of advection: %4.2f" % cfl_advection)
10096
print ("CFL number of acoustics (horizontal): %4.2f" % cfl_acoustic_hor)
10197
print ("CFL number of acoustics (vertical): %4.2f" % cfl_acoustic_ver)
10298

99+
dirk = dirk(P, dirk_order)
100+
u0 = uinit.values.flatten()
101+
102+
for i in range(0,Nsteps):
103+
u0 = dirk.timestep(u0, dt)
104+
103105
# call main function to get things done...
104106
uend,stats = mp.run_pfasst(MS,u0=uinit,t0=t0,dt=dt,Tend=Tend)
105107

106108
u0 = unflatten(u0, 4, P.N[0], P.N[1])
109+
110+
fs = 8
111+
rcParams['figure.figsize'] = 5.0, 2.5
107112
fig = plt.figure()
108113

109-
plt.plot(P.xx[:,5], uend.values[2,:,5], color='r', marker='+', markevery=3)
110-
plt.plot(P.xx[:,5], u0[2,:,5], color='b', markevery=5)
111-
plt.show()
114+
plt.plot(P.xx[:,5], uend.values[2,:,5], '-', color='b', label='SDC')
115+
plt.plot(P.xx[:,5], u0[2,:,5], '+', color='g', markevery=5, markersize=fs-2, label='DIRK')
116+
plt.legend(loc='lower left', fontsize=fs, prop={'size':fs})
117+
plt.yticks(fontsize=fs)
118+
plt.xticks(fontsize=fs)
119+
plt.xlabel('x', fontsize=fs, labelpad=0)
120+
plt.ylabel('Bouyancy', fontsize=fs, labelpad=1)
121+
#plt.show()
122+
plt.savefig('boussinesq.pdf', bbox_inches='tight')
112123

113124
print " #### Logging report for DIRK #### "
114125
print "Number of calls to implicit solver: %5i" % dirk.logger.solver_calls

0 commit comments

Comments
 (0)