Skip to content

Commit

Permalink
modify examples/tsunami/bowl*/maketopo.py to explicitly use Topograph…
Browse files Browse the repository at this point in the history
…y rather than e.g. topo2writer, which should be deprecated, and changed output format for backward compatibility
  • Loading branch information
rjleveque committed Jun 4, 2016
1 parent c39dc25 commit 2336a94
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 11 additions & 3 deletions examples/tsunami/bowl-radial/maketopo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Module to create topo and qinit data files for this example.
"""

from clawpack.geoclaw import topotools
from clawpack.geoclaw.topotools import Topography
from numpy import *

def maketopo():
Expand All @@ -17,7 +17,11 @@ def maketopo():
yupper = 100.e0
ylower = -100.e0
outfile= "bowl.topotype2"
topotools.topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints)

topography = Topography(topo_func=topo)
topography.x = linspace(xlower,xupper,nxpoints)
topography.y = linspace(ylower,yupper,nypoints)
topography.write(outfile, topo_type=2, Z_format="%22.15e")

def makeqinit():
"""
Expand All @@ -30,7 +34,11 @@ def makeqinit():
yupper = 50.e0
ylower = -50.e0
outfile= "hump.xyz"
topotools.topo1writer(outfile,qinit,xlower,xupper,ylower,yupper,nxpoints,nypoints)

topography = Topography(topo_func=qinit)
topography.x = linspace(xlower,xupper,nxpoints)
topography.y = linspace(ylower,yupper,nypoints)
topography.write(outfile, topo_type=1)

def topo(x,y):
"""
Expand Down
9 changes: 7 additions & 2 deletions examples/tsunami/bowl-slosh/maketopo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Module to create topo and qinit data files for this example.
"""

from clawpack.geoclaw.topotools import topo1writer, topo2writer
from clawpack.geoclaw.topotools import Topography
from numpy import *

#from pyclaw.data import Data
Expand All @@ -26,7 +26,12 @@ def maketopo():
xlower = -2.e0
ylower = -2.e0
outfile= "bowl.topotype2"
topo2writer(outfile,topo,xlower,xupper,ylower,yupper,nxpoints,nypoints)

topography = Topography(topo_func=topo)
topography.x = linspace(xlower,xupper,nxpoints)
topography.y = linspace(ylower,yupper,nypoints)
topography.write(outfile, topo_type=2, Z_format="%22.15e")


def topo(x,y):
"""
Expand Down

0 comments on commit 2336a94

Please sign in to comment.