Skip to content

Commit

Permalink
Merge pull request #483 from hadjimy/step-size_control
Browse files Browse the repository at this point in the history
Updating step size control
  • Loading branch information
ketch committed Mar 26, 2015
2 parents de1402d + 7dfd2ed commit e34ec5f
Show file tree
Hide file tree
Showing 17 changed files with 1,277 additions and 1,161 deletions.
8 changes: 4 additions & 4 deletions examples/acoustics_1d_homogeneous/acoustics_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
from numpy import sqrt, exp, cos
from clawpack import riemann

def setup(use_petsc=False, kernel_language='Fortran', solver_type='classic',
outdir='./_output', ptwise=False, weno_order=5,
time_integrator='SSP104',
disable_output=False):
def setup(use_petsc=False, kernel_language='Fortran', solver_type='classic', outdir='./_output', ptwise=False, \
weno_order=5, time_integrator='SSP104', disable_output=False):

if use_petsc:
import clawpack.petclaw as pyclaw
Expand All @@ -47,6 +45,8 @@ def setup(use_petsc=False, kernel_language='Fortran', solver_type='classic',
solver = pyclaw.SharpClawSolver1D(riemann_solver)
solver.weno_order=weno_order
solver.time_integrator=time_integrator
if time_integrator == 'SSPLMMk3':
solver.lmm_steps = 4
else: raise Exception('Unrecognized value of solver_type.')

solver.kernel_language=kernel_language
Expand Down
12 changes: 6 additions & 6 deletions examples/acoustics_1d_homogeneous/test_acoustics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ def acoustics_verify(claw):

from clawpack.pyclaw.util import gen_variants

classic_tests = gen_variants(acoustics_1d.setup, verify_expected(0.00104856594174),
classic_tests = gen_variants(acoustics_1d.setup, verify_expected(0.001049),
kernel_languages=('Python','Fortran'), solver_type='classic', disable_output=True)

ptwise_tests = gen_variants(acoustics_1d.setup, verify_expected(0.00104856594174),
ptwise_tests = gen_variants(acoustics_1d.setup, verify_expected(0.001049),
kernel_languages=('Fortran',), ptwise=True,
solver_type='classic', disable_output=True)


sharp_tests_rk = gen_variants(acoustics_1d.setup, verify_expected(0.000298879563857),
sharp_tests_rk = gen_variants(acoustics_1d.setup, verify_expected(0.000299),
kernel_languages=('Python','Fortran'), solver_type='sharpclaw',
time_integrator='SSP104', disable_output=True)

sharp_tests_lmm = gen_variants(acoustics_1d.setup, verify_expected(0.00227996627104),
sharp_tests_lmm = gen_variants(acoustics_1d.setup, verify_expected(0.000231),
kernel_languages=('Python','Fortran'), solver_type='sharpclaw',
time_integrator='SSPMS32', disable_output=True)
time_integrator='SSPLMMk3', disable_output=True)

weno_tests = gen_variants(acoustics_1d.setup, verify_expected(0.000153070447918),
weno_tests = gen_variants(acoustics_1d.setup, verify_expected(0.000153),
kernel_languages=('Fortran',), solver_type='sharpclaw',
time_integrator='SSP104', weno_order=17, disable_output=True)

Expand Down
9 changes: 5 additions & 4 deletions examples/acoustics_2d_homogeneous/acoustics_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ def setup(kernel_language='Fortran', use_petsc=False, outdir='./_output',
if solver.time_integrator=='SSP104':
solver.cfl_max = 0.5
solver.cfl_desired = 0.45
elif solver.time_integrator=='SSPMS32':
solver.cfl_max = 0.2
solver.cfl_desired = 0.16
elif solver.time_integrator=='SSPLMMk2':
solver.lmm_steps = 3
solver.lim_type = 2
solver.cfl_max = 0.25
solver.cfl_desired = 0.24
else:
raise Exception('CFL desired and CFL max have not been provided for the particular time integrator.')

Expand Down Expand Up @@ -149,6 +151,5 @@ def p_vs_r(current_data):


if __name__=="__main__":
import sys
from clawpack.pyclaw.util import run_app_from_main
output = run_app_from_main(setup,setplot)
5 changes: 3 additions & 2 deletions examples/acoustics_2d_homogeneous/test_2d_acoustics.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def verify(claw):
test_pressure = test_q[0,:,:]
thisdir = os.path.dirname(__file__)
expected_pressure = np.loadtxt(os.path.join(thisdir,data_filename))
return check_diff(expected_pressure, test_pressure, reltol=1e-3)
return check_diff(expected_pressure, test_pressure, reltol=1e-3,
delta=claw.solution.grid.delta)
else:
return
return verify
Expand All @@ -36,7 +37,7 @@ def verify(claw):

sharp_tests_lmm = gen_variants(acoustics_2d.setup, verify_data('verify_sharpclaw_lmm.txt'),
kernel_languages=('Fortran',), solver_type='sharpclaw',
time_integrator='SSPMS32', disable_output=True)
time_integrator='SSPLMMk2', disable_output=True)

from itertools import chain
for test in chain(classic_tests, ptwise_tests, sharp_tests_rk, sharp_tests_lmm):
Expand Down
200 changes: 100 additions & 100 deletions examples/acoustics_2d_homogeneous/verify_sharpclaw_lmm.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/acoustics_2d_variable/acoustics_2d_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def setup(kernel_language='Fortran', use_petsc=False, outdir='./_output',
elif solver_type=='sharpclaw':
solver=pyclaw.SharpClawSolver2D(riemann.vc_acoustics_2D)
solver.time_integrator=time_integrator
if time_integrator=='SSPMS32':
if time_integrator=='SSPLMMk2':
solver.lmm_steps = 3
solver.cfl_max = 0.25
solver.cfl_desired = 0.24

Expand Down Expand Up @@ -149,6 +150,5 @@ def mark_interface(current_data):


if __name__=="__main__":
import sys
from clawpack.pyclaw.util import run_app_from_main
output = run_app_from_main(setup,setplot)
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def verify_acoustics(controller, solver_type='classic'):
sharp_tests_lmm = gen_variants(acoustics_2d_interface.setup,
verify_func, lim_type=1,
solver_type='sharpclaw',
time_integrator='SSPMS32',
time_integrator='SSPLMMk2',
disable_output=True,
num_cells=(50, 50))

Expand Down
3 changes: 3 additions & 0 deletions examples/advection_1d/advection_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def setup(nx=100, kernel_language='Python', use_petsc=False, solver_type='classi
solver = pyclaw.SharpClawSolver1D(riemann_solver)
solver.weno_order = weno_order
solver.time_integrator = time_integrator
if time_integrator == 'SSPLMMk3':
solver.lmm_steps = 5
solver.check_lmm_cond = True
else: raise Exception('Unrecognized value of solver_type.')

solver.kernel_language = kernel_language
Expand Down
4 changes: 2 additions & 2 deletions examples/advection_1d/test_advection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def advection_verify(claw):
kernel_languages=('Python','Fortran'),
solver_type='sharpclaw',time_integrator='SSP104', outdir=None)

sharp_tests_lmm = gen_variants(advection_1d.setup, verify_expected(3.39682948116e-05),
sharp_tests_lmm = gen_variants(advection_1d.setup, verify_expected(1.500727e-05),
kernel_languages=('Python','Fortran'),
solver_type='sharpclaw',time_integrator='SSPMS32', outdir=None)
solver_type='sharpclaw',time_integrator='SSPLMMk3', outdir=None)

weno_tests = gen_variants(advection_1d.setup, verify_expected(7.489618e-06),
kernel_languages=('Fortran',), solver_type='sharpclaw',
Expand Down
Loading

0 comments on commit e34ec5f

Please sign in to comment.