コード例 #1
0
ファイル: test_tr.py プロジェクト: clawpack/sharpclaw
def test_tr(grids=[1800,3600,7200],frame=2):
    reload(setrun)
    errs = []

    for i,mx in enumerate(grids):
        print i,mx
        rundata=setrun.setrun()

        rundata.probdata.trtime=600.
        rundata.probdata.t1= 10.
        rundata.probdata.a1= 0.1
        rundata.probdata.tw1=10.

        rundata.clawdata.mx=mx
        rundata.clawdata.tfinal=1200.
        rundata.clawdata.nout=60
        rundata.write()
        runclaw(xclawcmd='xsclaw',outdir='./_output')

        exact,approx,xc = timereverse(frame=frame)

        Linf_err = max(abs(approx-exact))
        print mx, Linf_err

        errs.append(Linf_err)

    return grids,errs
コード例 #2
0
def test_tr(grids=[1800, 3600, 7200], frame=2):
    reload(setrun)
    errs = []

    for i, mx in enumerate(grids):
        print i, mx
        rundata = setrun.setrun()

        rundata.probdata.trtime = 600.
        rundata.probdata.t1 = 10.
        rundata.probdata.a1 = 0.1
        rundata.probdata.tw1 = 10.

        rundata.clawdata.mx = mx
        rundata.clawdata.tfinal = 1200.
        rundata.clawdata.nout = 60
        rundata.write()
        runclaw(xclawcmd='xsclaw', outdir='./_output')

        exact, approx, xc = timereverse(frame=frame)

        Linf_err = max(abs(approx - exact))
        print mx, Linf_err

        errs.append(Linf_err)

    return grids, errs
コード例 #3
0
ファイル: test_ent_par.py プロジェクト: clawpack/sharpclaw
def getent(K,rho):
  rundata=setrun.setrun()
  rundata.probdata.K_B=K
  rundata.probdata.rho_B=rho
  print K,rho
  rundata.write()
  runclaw(outdir='./_output')

  ent=entropy(rundata.clawdata.nout)
  return ent[-1]
コード例 #4
0
def getent(K, rho):
    rundata = setrun.setrun()
    rundata.probdata.K_B = K
    rundata.probdata.rho_B = rho
    print K, rho
    rundata.write()
    runclaw(outdir='./_output')

    ent = entropy(rundata.clawdata.nout)
    return ent[-1]
コード例 #5
0
for i, lim in enumerate(lims):
    for j, mx in enumerate(grids):
        print mx, lim

        rundata = setrun.setrun()

        rundata.probdata.K_B = 4.0
        rundata.probdata.rho_B = 4.0
        rundata.probdata.K_A = 1.0
        rundata.probdata.rho_A = 1.0

        rundata.clawdata.mthlim = [lim, lim]
        rundata.clawdata.mx = mx

        rundata.write()
        runclaw(outdir='./_output')

        ent = entropy(rundata.clawdata.nout)
        ntrp[i, j] = ent[-1]

linestyles = ['-k', '--k', '-.k', ':k']
limnames = ['Minmod', 'Superbee', 'van Leer', 'MC']

pl.hold(False)
for i, lim in enumerate(lims):
    pl.loglog(np.array(grids) / 150.,
              abs(ntrp[i, :] - 1.),
              linestyles[i],
              linewidth=3)
    pl.hold(True)
コード例 #6
0
dtopodir = '/Users/rjl/git/tohoku2011a/sources/'

gaugenos = [21401, 21413, 21418, 21419]
models = """GCMT Hayes UCSB3 Ammon Caltech Fujii Saito Gusman GusmanAU
            pmelWei""".split()

models = ["GCMT"]

for model in models:
    print "Model: ",model

    rundata = setrun.setrun()
    rundata.geodata.dtopofiles = [[1,4,4,dtopodir+'%s.txydz' % model]]
    rundata.write()  # create *.data files

    outdir = '_output_%s' % model
    runclaw.runclaw('xgeoclaw',outdir)

    pd = ClawPlotData()
    pd = setplot.setplot(pd)
    pd.outdir = outdir
    for gaugeno in gaugenos:
        g = pd.getgauge(gaugeno)
        d = np.vstack([g.t,g.q[:,3]]).T
        fname = '../simulation_results/%s_%s.txt' % (model,gaugeno)
        np.savetxt(fname, d)
        print "Created ",fname


コード例 #7
0
ファイル: test_entropy.py プロジェクト: clawpack/sharpclaw
for i,lim in enumerate(lims):
  for j,mx in enumerate(grids):
    print mx,lim

    rundata=setrun.setrun()

    rundata.probdata.K_B=4.0
    rundata.probdata.rho_B=4.0
    rundata.probdata.K_A=1.0
    rundata.probdata.rho_A=1.0

    rundata.clawdata.mthlim = [lim,lim]
    rundata.clawdata.mx = mx

    rundata.write()
    runclaw(outdir='./_output')

    ent=entropy(rundata.clawdata.nout)
    ntrp[i,j]=ent[-1]


linestyles=['-k','--k','-.k',':k']
limnames=['Minmod','Superbee','van Leer','MC']

pl.hold(False)
for i,lim in enumerate(lims):
  pl.loglog(np.array(grids)/150.,abs(ntrp[i,:]-1.),linestyles[i],linewidth=3)
  pl.hold(True)

pl.legend(limnames)
コード例 #8
0
import setplot
import numpy as np

dtopodir = '/Users/rjl/git/tohoku2011a/sources/'

gaugenos = [21401, 21413, 21418, 21419]
models = """GCMT Hayes UCSB3 Ammon Caltech Fujii Saito Gusman GusmanAU
            pmelWei""".split()

models = ["GCMT"]

for model in models:
    print "Model: ", model

    rundata = setrun.setrun()
    rundata.geodata.dtopofiles = [[1, 4, 4, dtopodir + '%s.txydz' % model]]
    rundata.write()  # create *.data files

    outdir = '_output_%s' % model
    runclaw.runclaw('xgeoclaw', outdir)

    pd = ClawPlotData()
    pd = setplot.setplot(pd)
    pd.outdir = outdir
    for gaugeno in gaugenos:
        g = pd.getgauge(gaugeno)
        d = np.vstack([g.t, g.q[:, 3]]).T
        fname = '../simulation_results/%s_%s.txt' % (model, gaugeno)
        np.savetxt(fname, d)
        print "Created ", fname
コード例 #9
0
ファイル: acerror.py プロジェクト: clawpack/sharpclaw
outdir='./_output'
frame=1
err=[]

#for mx in [200,400,800,1600,3200]:
for mx in [3200,6400]:
    rundata=setrun.setrun('sharpclaw')
    rundata.probdata.ic=9
    rundata.probdata.x0=-4.0
    rundata.probdata.a=4.0  # 1 for narrow pulse, 4 for wide pulse
    rundata.clawdata.mx=mx
    rundata.clawdata.nout=1
    rundata.clawdata.tfinal=8
    rundata.write()
    runclaw(xclawcmd='xsclaw',outdir=outdir)

    #Get the material parameters
    aux = np.loadtxt(outdir+'/fort.aux')
    rho = aux[:,0]; K   = aux[:,1]

    plotdata = ClawPlotData()
    plotdata.outdir=outdir

    #Read in the solution
    dat = plotdata.getframe(frame)
    eps = dat.q[:,0]
    p = -eps*K
    u = dat.q[:,1]

    exact = compute_exact_solution(outdir,frame)
コード例 #10
0
ファイル: run_tests.py プロジェクト: rjleveque/geoclaw-group
#! /usr/bin/python
"""
Run several tests with different parameters, in this case different
values of d.
"""

from setrun import setrun
from setplot import setplot
from pyclaw.runclaw import runclaw
from pyclaw.plotters.plotclaw import plotclaw

for n in [1, 2, 4]:
    for d in [0.061, 0.080, 0.100, 0.120, 0.140, 0.149, 0.189]:
        rundata = setrun(d_param=d)
        mx = 72 * n
        my = 18 * n
        rundata.clawdata.mx = mx
        rundata.clawdata.my = my
        rundata.write()

        runclaw(xclawcmd="xgeoclaw", outdir="_output_%s_my%s" % (d, my))

        setplot.d = d
        setplot.my = my
        plotclaw(outdir="_output_%s_my%s" % (d,my), \
                 plotdir="_plots_%s_my%s" % (d,my),\
                 setplot=setplot)
コード例 #11
0
ファイル: run_tests.py プロジェクト: Chamberpain/clawpack-4.x
from setrun import setrun
from setplot import setplot
from pyclaw.runclaw import runclaw
from pyclaw.plotters.plotclaw import plotclaw

# initialize rundata using setrun but then change some things for each run:
rundata = setrun()

#--------------
# Run 1:
#--------------
rundata.clawdata.mxnest = 1
rundata.write()

runclaw(xclawcmd = "xgeoclaw", outdir="_output_1level")
plotclaw(outdir="_output_1level", plotdir="_plots_1level")

#--------------
# Run 2:
#--------------
rundata.clawdata.mxnest = 2
rundata.geodata.wavetolerance = 0.01
rundata.write()

runclaw(xclawcmd = "xgeoclaw", outdir="_output_2level")
plotclaw(outdir="_output_2level", plotdir="_plots_2level")

#--------------
# Run 3:
#--------------
コード例 #12
0
ファイル: run_tests.py プロジェクト: ANDESD/geoclaw-group
#! /usr/bin/python

"""
Run several tests with different parameters, in this case different
values of d.
"""

from setrun import setrun
from setplot import setplot
from pyclaw.runclaw import runclaw
from pyclaw.plotters.plotclaw import plotclaw

for n in [1,2,4]:
    for d in [0.061, 0.080, 0.100, 0.120, 0.140, 0.149, 0.189]:
        rundata = setrun(d_param=d)
        mx = 72*n
        my = 18*n
        rundata.clawdata.mx = mx
        rundata.clawdata.my = my
        rundata.write()

        runclaw(xclawcmd = "xgeoclaw", outdir="_output_%s_my%s" % (d,my))

        setplot.d = d
        setplot.my = my
        plotclaw(outdir="_output_%s_my%s" % (d,my), \
                 plotdir="_plots_%s_my%s" % (d,my),\
                 setplot=setplot)


コード例 #13
0
outdir = './_output'
frame = 1
err = []

#for mx in [200,400,800,1600,3200]:
for mx in [3200, 6400]:
    rundata = setrun.setrun('sharpclaw')
    rundata.probdata.ic = 9
    rundata.probdata.x0 = -4.0
    rundata.probdata.a = 4.0  # 1 for narrow pulse, 4 for wide pulse
    rundata.clawdata.mx = mx
    rundata.clawdata.nout = 1
    rundata.clawdata.tfinal = 8
    rundata.write()
    runclaw(xclawcmd='xsclaw', outdir=outdir)

    #Get the material parameters
    aux = np.loadtxt(outdir + '/fort.aux')
    rho = aux[:, 0]
    K = aux[:, 1]

    plotdata = ClawPlotData()
    plotdata.outdir = outdir

    #Read in the solution
    dat = plotdata.getframe(frame)
    eps = dat.q[:, 0]
    p = -eps * K
    u = dat.q[:, 1]
コード例 #14
0
ファイル: run_tests.py プロジェクト: geoflows/geoclaw-4.x
from setrun import setrun
from setplot import setplot
from pyclaw.runclaw import runclaw
from pyclaw.plotters.plotclaw import plotclaw

# initialize rundata using setrun but then change some things for each run:
rundata = setrun()

#--------------
# Run 1:
#--------------
rundata.clawdata.mxnest = 1
rundata.write()

runclaw(xclawcmd="xgeoclaw", outdir="_output_1level")
plotclaw(outdir="_output_1level", plotdir="_plots_1level")

#--------------
# Run 2:
#--------------
rundata.clawdata.mxnest = 2
rundata.geodata.wavetolerance = 0.01
rundata.write()

runclaw(xclawcmd="xgeoclaw", outdir="_output_2level")
plotclaw(outdir="_output_2level", plotdir="_plots_2level")

#--------------
# Run 3:
#--------------