Skip to content

Commit

Permalink
Modify shocktube to match Sod problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
ketch committed Feb 9, 2016
1 parent 943983e commit f2b36a6
Show file tree
Hide file tree
Showing 2 changed files with 546 additions and 544 deletions.
10 changes: 6 additions & 4 deletions examples/euler_1d/shocktube.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def setup(use_petsc=False, outdir='./_output', solver_type='classic',

solver.kernel_language = kernel_language

solver.bc_lower[0]=pyclaw.BC.wall
solver.bc_upper[0]=pyclaw.BC.wall
solver.bc_lower[0]=pyclaw.BC.extrap
solver.bc_upper[0]=pyclaw.BC.extrap

mx = 800;
x = pyclaw.Dimension(-1.0,1.0,mx,name='x')
Expand All @@ -54,10 +54,12 @@ def setup(use_petsc=False, outdir='./_output', solver_type='classic',

x = state.grid.x.centers

state.q[density ,:] = (x<0.)*1. + (x>=0.)*1./8
rho_l = 1.; rho_r = 1./8
p_l = 1.; p_r = 0.1
state.q[density ,:] = (x<0.)*rho_l + (x>=0.)*rho_r
state.q[momentum,:] = 0.
velocity = state.q[momentum,:]/state.q[density,:]
pressure = (x<0.)*1. + (x>=0.)*1./8
pressure = (x<0.)*p_l + (x>=0.)*p_r
state.q[energy ,:] = pressure/(gamma - 1.) + 0.5 * state.q[density,:] * velocity**2

claw = pyclaw.Controller()
Expand Down
Loading

0 comments on commit f2b36a6

Please sign in to comment.