Skip to content

Commit ff5f4ff

Browse files
author
Daniel Ruprecht
committed
now printing cfl numbers prior to simulation
1 parent cb9d637 commit ff5f4ff

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

examples/boussinesq_2d_imex/HookClass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def dump_step(self,status):
4343

4444
fs = 18
4545

46-
if True:
46+
if False:
4747
yplot = self.level.uend.values
4848
xx = self.level.prob.xx
4949
zz = self.level.prob.zz

examples/boussinesq_2d_imex/playground.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
# This comes as read-in for the level class
3030
lparams = {}
31-
lparams['restol'] = 1E-12
31+
lparams['restol'] = 1E-6
3232

3333
swparams = {}
3434
swparams['collocation_class'] = collclass.CollGaussLobatto
@@ -41,7 +41,7 @@
4141
# setup parameters "in time"
4242
t0 = 0
4343
Tend = 3000
44-
Nsteps = 500
44+
Nsteps = 250
4545
dt = Tend/float(Nsteps)
4646

4747
# This comes as read-in for the problem class
@@ -52,10 +52,10 @@
5252
pparams['Nfreq'] = 0.01
5353
pparams['x_bounds'] = [(-150.0, 150.0)]
5454
pparams['z_bounds'] = [( 0.0, 10.0)]
55-
pparams['order'] = [0, 0] # [fine_level, coarse_level]
56-
pparams['gmres_maxiter'] = [50, 50]
55+
pparams['order'] = [0] # [fine_level, coarse_level]
56+
pparams['gmres_maxiter'] = [50]
5757
pparams['gmres_restart'] = 20
58-
pparams['gmres_tol'] = 1e-14
58+
pparams['gmres_tol'] = 1e-6
5959

6060
# This comes as read-in for the transfer operations
6161
tparams = {}
@@ -80,6 +80,13 @@
8080
# get initial values on finest level
8181
P = MS[0].levels[0].prob
8282
uinit = P.u_exact(t0)
83+
84+
cfl_advection = pparams['u_adv']*dt/P.h[0]
85+
cfl_acoustic_hor = pparams['c_s']*dt/P.h[0]
86+
cfl_acoustic_ver = pparams['c_s']*dt/P.h[1]
87+
print ("CFL number of advection: %4.2f" % cfl_advection)
88+
print ("CFL number of acoustics (horizontal): %4.2f" % cfl_acoustic_hor)
89+
print ("CFL number of acoustics (vertical): %4.2f" % cfl_acoustic_ver)
8390

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

0 commit comments

Comments
 (0)