def setrun(claw_pkg='classic'): #------------------------------ """ Define the parameters used for running Clawpack. INPUT: claw_pkg expected to be "classic" for this setrun. OUTPUT: rundata - object of class ClawRunData """ assert claw_pkg.lower() == 'classic', "Expected claw_pkg = 'classic'" ndim = 1 rundata = data.ClawRunData(claw_pkg, ndim) #------------------------------------------------------------------ # Problem-specific parameters to be written to setprob.data: #------------------------------------------------------------------ probdata = rundata.new_UserData(name='probdata', fname='setprob.data') probdata.add_param('gamma', 1.4, 'gamma for ideal gas') #------------------------------------------------------------------ # Standard Clawpack parameters to be written to claw.data: #------------------------------------------------------------------ clawdata = rundata.clawdata # initialized when rundata instantiated # --------------- # Spatial domain: # --------------- # Number of space dimensions: clawdata.ndim = ndim # Lower and upper edge of computational domain: clawdata.xlower = -1.5 clawdata.xupper = 1.5 # Number of grid cells: clawdata.mx = 1500 # --------------- # Size of system: # --------------- # Number of equations in the system: clawdata.meqn = 3 # Number of auxiliary variables in the aux array (initialized in setaux) clawdata.maux = 0 # Index of aux array corresponding to capacity function, if there is one: clawdata.mcapa = 0 # ------------- # Initial time: # ------------- clawdata.t0 = 0.0 # ------------- # Output times: #-------------- # Specify at what times the results should be written to fort.q files. # Note that the time integration stops after the final output time. # The solution at initial time t0 is always written in addition. clawdata.outstyle = 1 if clawdata.outstyle == 1: # Output nout frames at equally spaced times up to tfinal: clawdata.nout = 5 clawdata.tfinal = 1.0 elif clawdata.outstyle == 2: # Specify a list of output times. clawdata.tout = [0.5, 1.0] # used if outstyle == 2 clawdata.nout = len(clawdata.tout) elif clawdata.outstyle == 3: # Output every iout timesteps with a total of ntot time steps: iout = 1 ntot = 5 clawdata.iout = [iout, ntot] # --------------------------------------------------- # Verbosity of messages to screen during integration: # --------------------------------------------------- # The current t, dt, and cfl will be printed every time step # at AMR levels <= verbosity. Set verbosity = 0 for no printing. # (E.g. verbosity == 2 means print only on levels 1 and 2.) clawdata.verbosity = 0 # -------------- # Time stepping: # -------------- # if dt_variable==1: variable time steps used based on cfl_desired, # if dt_variable==0: fixed time steps dt = dt_initial will always be used. clawdata.dt_variable = 1 # Initial time step for variable dt. # If dt_variable==0 then dt=dt_initial for all steps: clawdata.dt_initial = 0.1 # Max time step to be allowed if variable dt used: clawdata.dt_max = 1e+99 # Desired Courant number if variable dt used, and max to allow without # retaking step with a smaller dt: clawdata.cfl_desired = 0.9 clawdata.cfl_max = 1.0 # Maximum number of time steps to allow between output times: clawdata.max_steps = 1000 # ------------------ # Method to be used: # ------------------ # Order of accuracy: 1 => Godunov, 2 => Lax-Wendroff plus limiters clawdata.order = 2 # Transverse order for 2d or 3d (not used in 1d): clawdata.order_trans = 0 # Number of waves in the Riemann solution: clawdata.mwaves = 3 # List of limiters to use for each wave family: # Required: len(mthlim) == mwaves clawdata.mthlim = [4, 4, 4] # Source terms splitting: # src_split == 0 => no source term (src routine never called) # src_split == 1 => Godunov (1st order) splitting used, # src_split == 2 => Strang (2nd order) splitting used, not recommended. clawdata.src_split = 0 # -------------------- # Boundary conditions: # -------------------- # Number of ghost cells (usually 2) clawdata.mbc = 2 # Choice of BCs at xlower and xupper: # 0 => user specified (must modify bcN.f to use this option) # 1 => extrapolation (non-reflecting outflow) # 2 => periodic (must specify this at both boundaries) # 3 => solid wall for systems where q(2) is normal velocity clawdata.mthbc_xlower = 1 clawdata.mthbc_xupper = 1 return rundata
def setrun(claw_pkg='sharpclaw'): #------------------------------ """ Define the parameters used for running Clawpack. INPUT: claw_pkg expected to be "classic" for this setrun. OUTPUT: rundata - object of class ClawRunData """ assert claw_pkg.lower() == 'sharpclaw', "Expected claw_pkg = 'sharpclaw'" rundata = data.ClawRunData(pkg=claw_pkg, ndim=2) #------------------------------------------------------------------ # Problem-specific parameters to be written to setprob.data: #------------------------------------------------------------------ probdata = rundata.new_UserData(name='probdata', fname='setprob.data') probdata.add_param('grav', 9.81, 'Gravitational constant') probdata.add_param('eps', 0.01, 'Perturbation') #------------------------------------------------------------------ # Standard Clawpack parameters to be written to claw.data: #------------------------------------------------------------------ clawdata = rundata.clawdata # initialized when rundata instantiated # --------------- # Spatial domain: # --------------- # Number of space dimensions: clawdata.ndim = 2 # Lower and upper edge of computational domain: clawdata.xlower = 0.0 clawdata.xupper = 2.0 clawdata.ylower = 0.0 clawdata.yupper = 1.0 # Number of grid cells: clawdata.mx = 400 clawdata.my = 200 # --------------- # Size of system: # --------------- # Number of equations in the system: clawdata.meqn = 3 # Number of auxiliary variables in the aux array (initialized in setaux) clawdata.maux = 1 # Index of aux array corresponding to capacity function, if there is one: clawdata.mcapa = 0 # ------------- # Initial time: # ------------- clawdata.t0 = 0.0 # ------------- # Output times: #-------------- # Specify at what times the results should be written to fort.q files. # Note that the time integration stops after the final output time. # The solution at initial time t0 is always written in addition. clawdata.outstyle = 1 if clawdata.outstyle == 1: # Output nout frames at equally spaced times up to tfinal: clawdata.nout = 10 clawdata.tfinal = 0.12 elif clawdata.outstyle == 2: # Specify a list of output times. clawdata.tout = [0.12] # used if outstyle == 2 clawdata.nout = len(clawdata.tout) elif clawdata.outstyle == 3: # Output every iout timesteps with a total of ntot time steps: iout = 1 ntot = 5 clawdata.iout = [iout, ntot] # --------------------------------------------------- # Verbosity of messages to screen during integration: # --------------------------------------------------- # The current t, dt, and cfl will be printed every time step # at AMR levels <= verbosity. Set verbosity = 0 for no printing. # (E.g. verbosity == 2 means print only on levels 1 and 2.) clawdata.verbosity = 1 # -------------- # Time stepping: # -------------- # if dt_variable==1: variable time steps used based on cfl_desired, # if dt_variable==0: fixed time steps dt = dt_initial will always be used. clawdata.dt_variable = 1 # Initial time step for variable dt. # If dt_variable==0 then dt=dt_initial for all steps: clawdata.dt_initial = 0.0001 # Max time step to be allowed if variable dt used: clawdata.dt_max = 1e+99 # Desired Courant number if variable dt used, and max to allow without # retaking step with a smaller dt: clawdata.cfl_desired = 0.2 clawdata.cfl_max = 0.35 # Maximum number of time steps to allow between output times: clawdata.max_steps = 5000 # ------------------ # Method to be used: # ------------------ # Time integrator clawdata.time_integrator = 4 # Number of waves in the Riemann solution: clawdata.mwaves = 3 # List of limiters to use for each wave family: # Required: len(mthlim) == mwaves clawdata.mthlim = [5, 5, 5] #User-supplied total fluctuation solver? clawdata.tfluct_solver = 1 #Use characteristic decomposition in reconstruction step? clawdata.char_decomp = 1 # Source terms? NOT USED!!!! clawdata.src_term = 0 # Limiter type: 0=None, 1=TVD, 2=WENO clawdata.lim_type = 2 # -------------------- # Boundary conditions: # -------------------- # Number of ghost cells (usually 2) clawdata.mbc = 3 # Choice of BCs at xlower and xupper: # 0 => user specified (must modify bcN.f to use this option) # 1 => extrapolation (non-reflecting outflow) # 2 => periodic (must specify this at both boundaries) # 3 => solid wall for systems where q(2) is normal velocity clawdata.mthbc_xlower = 1 clawdata.mthbc_xupper = 1 clawdata.mthbc_ylower = 1 clawdata.mthbc_yupper = 1 return rundata
def setrun(claw_pkg='digclaw'): #------------------------------ """ Define the parameters used for running Clawpack. INPUT: claw_pkg expected to be "geoclaw" for this setrun. OUTPUT: rundata - object of class ClawRunData """ #assert claw_pkg.lower() == 'digclaw', "Expected claw_pkg = 'digclaw'" ndim = 2 rundata = data.ClawRunData(claw_pkg, ndim) #------------------------------------------------------------------ # GeoClaw specific parameters: #------------------------------------------------------------------ rundata = setgeo(rundata) # Defined below #------------------------------------------------------------------ # DigClaw specific parameters: #------------------------------------------------------------------ rundata = setdig(rundata) # Defined below #------------------------------------------------------------------ # Standard Clawpack parameters to be written to claw.data: # (or to amr2ez.data for AMR) #------------------------------------------------------------------ clawdata = rundata.clawdata # initialized when rundata instantiated # Set single grid parameters first. # See below for AMR parameters. # --------------- # Spatial domain: # --------------- # Number of space dimensions: clawdata.ndim = ndim # Lower and upper edge of computational domain: clawdata.xlower = -10.0 clawdata.xupper = 140.0 clawdata.ylower = -6.0 clawdata.yupper = 8.0 # Number of grid cells: clawdata.mx = 150 clawdata.my = 28 # --------------- # Size of system: # --------------- # Number of equations in the system: clawdata.meqn = 5 # Number of auxiliary variables in the aux array (initialized in setaux) clawdata.maux = 5 # Index of aux array corresponding to capacity function, if there is one: clawdata.mcapa = 0 # ------------- # Initial time: # ------------- clawdata.t0 = 0.0 #38895.0 # ------------- # Output times: #-------------- # Specify at what times the results should be written to fort.q files. # Note that the time integration stops after the final output time. # The solution at initial time t0 is always written in addition. clawdata.outstyle = 1 if clawdata.outstyle==1: # Output nout frames at equally spaced times up to tfinal: clawdata.nout = 100 clawdata.tfinal = 40.0 elif clawdata.outstyle == 2: # Specify a list of output times. clawdata.tout = [10.0,53.0e3,55.e3] clawdata.nout = len(clawdata.tout) elif clawdata.outstyle == 3: # Output every iout timesteps with a total of ntot time steps: iout = 10 ntot = 100 clawdata.iout = [iout, ntot] # --------------------------------------------------- # Verbosity of messages to screen during integration: # --------------------------------------------------- # The current t, dt, and cfl will be printed every time step # at AMR levels <= verbosity. Set verbosity = 0 for no printing. # (E.g. verbosity == 2 means print only on levels 1 and 2.) clawdata.verbosity = 0 # -------------- # Time stepping: # -------------- # if dt_variable==1: variable time steps used based on cfl_desired, # if dt_variable==0: fixed time steps dt = dt_initial will always be used. clawdata.dt_variable = 1 # Initial time step for variable dt. # If dt_variable==0 then dt=dt_initial for all steps: clawdata.dt_initial = 1.e-8 # Max time step to be allowed if variable dt used: clawdata.dt_max = 1e+99 # Desired Courant number if variable dt used, and max to allow without # retaking step with a smaller dt: clawdata.cfl_desired = 0.25 clawdata.cfl_max = 0.9 # Maximum number of time steps to allow between output times: clawdata.max_steps = 100000 # ------------------ # Method to be used: # ------------------ # Order of accuracy: 1 => Godunov, 2 => Lax-Wendroff plus limiters clawdata.order = 1 # Transverse order for 2d or 3d (not used in 1d): clawdata.order_trans = 0 # Number of waves in the Riemann solution: clawdata.mwaves = 3 # List of limiters to use for each wave family: # Required: len(mthlim) == mwaves clawdata.mthlim = [4,4,4] # Source terms splitting: # src_split == 0 => no source term (src routine never called) # src_split == 1 => Godunov (1st order) splitting used, # src_split == 2 => Strang (2nd order) splitting used, not recommended. clawdata.src_split = 1 # -------------------- # Boundary conditions: # -------------------- # Number of ghost cells (usually 2) clawdata.mbc = 2 # Choice of BCs at xlower and xupper: # 0 => user specified (must modify bcN.f to use this option) # 1 => extrapolation (non-reflecting outflow) # 2 => periodic (must specify this at both boundaries) # 3 => solid wall for systems where q(2) is normal velocity clawdata.mthbc_xlower = 1 clawdata.mthbc_xupper = 1 clawdata.mthbc_ylower = 1 clawdata.mthbc_yupper = 1 # --------------- # AMR parameters: # --------------- # max number of refinement levels: mxnest = 3 clawdata.mxnest = -mxnest # negative ==> anisotropic refinement in x,y,t # List of refinement ratios at each level (length at least mxnest-1) clawdata.inratx = [5,5] clawdata.inraty = [5,2] clawdata.inratt = [5,5] # Specify type of each aux variable in clawdata.auxtype. # This must be a list of length maux, each element of which is one of: # 'center', 'capacity', 'xleft', or 'yleft' (see documentation). clawdata.auxtype = ['center','center','yleft','center','center'] clawdata.tol = -1.0 # negative ==> don't use Richardson estimator clawdata.tolsp = 0.5 # used in default flag2refine subroutine # (Not used in geoclaw!) clawdata.kcheck = 3 # how often to regrid (every kcheck steps) clawdata.ibuff = 3 # width of buffer zone around flagged points clawdata.cutoff = 0.7 # efficiency cutoff for grid generator clawdata.checkpt_iousr = 10000000 clawdata.restart = False # More AMR parameters can be set -- see the defaults in pyclaw/data.py return rundata
def setrun(claw_pkg='digclaw'): #------------------------------ """ Define the parameters used for running Clawpack. INPUT: claw_pkg expected to be "geoclaw" for this setrun. OUTPUT: rundata - object of class ClawRunData """ #assert claw_pkg.lower() == 'digclaw', "Expected claw_pkg = 'digclaw'" ndim = 2 rundata = data.ClawRunData(claw_pkg, ndim) #------------------------------------------------------------------ # GeoClaw specific parameters: #------------------------------------------------------------------ rundata = setgeo(rundata) # Defined below #------------------------------------------------------------------ # DigClaw specific parameters: #------------------------------------------------------------------ rundata = setdig(rundata) # Defined below #------------------------------------------------------------------ # Standard Clawpack parameters to be written to claw.data: # (or to amr2ez.data for AMR) #------------------------------------------------------------------ clawdata = rundata.clawdata # initialized when rundata instantiated # Set single grid parameters first. # See below for AMR parameters. # --------------- # Spatial domain: # --------------- # Number of space dimensions: clawdata.ndim = ndim # Lower and upper edge of computational domain: #------------- extent of src topo is----------------- # xll = 597,416.79 # xuppper = 601,039.64 # yll = 4,883,315.98 # yupper = 4,886,338.99 #------------------------------------------------------ #-------------- extent of 30 m topo - ---------------- # xll = 593,144.19 # xupper = 625,815.23 # yll = 4,878,173.55 # yupper = 4,913,185.83 #------------------------------------------------------ #-------------- extent of 1 m lidar topo - ---------------- # xll = 596,227.64 # xupper = 634,446.82 # yll = 4,881,256.68 # yupper = 4,925,559.36 #------------------------------------------------------ # DEM limits import os import geotools.topotools as gt topopath = os.path.join(os.environ['TOPO'], 'SpiritLake', 'dtm_spiritlakedomain_10m') bfile = os.path.join(topopath, 'dtm_spiritlakedomain_10m.tt3') a = gt.topoboundary(bfile) xll = a[0] #-10000. yll = a[2] # +10000. xu = a[1] #-5000. yu = a[3] # 1.58e6 + 10000. #a[3] header = gt.topoheaderread(bfile) cell = 10. #header['cellsize'] coarsen = 1 cell = cell * coarsen rc = 1 #factor of coarsening from DEM resolution r1 = 8 r2 = 8 / rc clawdata.xlower = xll + 1.0 * cell * r1 * r2 clawdata.xupper = xu - 1.0 * cell * r1 * r2 clawdata.ylower = yll + 1.0 * cell * r1 * r2 clawdata.yupper = yu - 1.0 * cell * r1 * r2 # Number of grid cells: clawdata.mx = int( (clawdata.xupper - clawdata.xlower) / (cell * r1 * r2 * rc)) clawdata.my = int( (clawdata.yupper - clawdata.ylower) / (cell * r1 * r2 * rc)) # --------------- # Size of system: # --------------- # Number of equations in the system: clawdata.meqn = 7 # Number of auxiliary variables in the aux array (initialized in setaux) clawdata.maux = 10 # Index of aux array corresponding to capacity function, if there is one: clawdata.mcapa = 0 # ------------- # Initial time: # ------------- clawdata.t0 = 0.0 # ------------- # Output times: #-------------- # Specify at what times the results should be written to fort.q files. # Note that the time integration stops after the final output time. # The solution at initial time t0 is always written in addition. clawdata.outstyle = 1 if clawdata.outstyle == 1: # Output nout frames at equally spaced times up to tfinal: hours = 0. minutes = 120. clawdata.nout = int(minutes) clawdata.tfinal = hours * 3600. + minutes * 60. elif clawdata.outstyle == 2: # Specify a list of output times. clawdata.tout = [0.0, 10.0, 70.0, 600.0, 1200.0] clawdata.nout = len(clawdata.tout) elif clawdata.outstyle == 3: # Output every iout timesteps with a total of ntot time steps: iout = 1 ntot = 100 clawdata.iout = [iout, ntot] # --------------------------------------------------- # Verbosity of messages to screen during integration: # --------------------------------------------------- # The current t, dt, and cfl will be printed every time step # at AMR levels <= verbosity. Set verbosity = 0 for no printing. # (E.g. verbosity == 2 means print only on levels 1 and 2.) clawdata.verbosity = 1 # -------------- # Time stepping: # -------------- # if dt_variable==1: variable time steps used based on cfl_desired, # if dt_variable==0: fixed time steps dt = dt_initial will always be used. clawdata.dt_variable = 1 # Initial time step for variable dt. # If dt_variable==0 then dt=dt_initial for all steps: clawdata.dt_initial = 1.e-16 # Max time step to be allowed if variable dt used: clawdata.dt_max = 1.0 # Desired Courant number if variable dt used, and max to allow without # retaking step with a smaller dt: clawdata.cfl_desired = 0.25 clawdata.cfl_max = 0.5 # Maximum number of time steps to allow between output times: clawdata.max_steps = 100000 # ------------------ # Method to be used: # ------------------ # Order of accuracy: 1 => Godunov, 2 => Lax-Wendroff plus limiters clawdata.order = 1 # Transverse order for 2d or 3d (not used in 1d): clawdata.order_trans = 0 # Number of waves in the Riemann solution: clawdata.mwaves = 5 # List of limiters to use for each wave family: # Required: len(mthlim) == mwaves clawdata.mthlim = [4, 4, 4, 4, 4, 4] # Source terms splitting: # src_split == 0 => no source term (src routine never called) # src_split == 1 => Godunov (1st order) splitting used, # src_split == 2 => Strang (2nd order) splitting used, not recommended. clawdata.src_split = 1 # -------------------- # Boundary conditions: # -------------------- # Number of ghost cells (usually 2) clawdata.mbc = 2 # Choice of BCs at xlower and xupper: # 0 => user specified (must modify bcN.f to use this option) # 1 => extrapolation (non-reflecting outflow) # 2 => periodic (must specify this at both boundaries) # 3 => solid wall for systems where q(2) is normal velocity clawdata.mthbc_xlower = 1 clawdata.mthbc_xupper = 1 clawdata.mthbc_ylower = 1 clawdata.mthbc_yupper = 1 # --------------- # AMR parameters: # --------------- # max number of refinement levels: mxnest = 3 clawdata.mxnest = -mxnest # negative ==> anisotropic refinement in x,y,t # List of refinement ratios at each level (length at least mxnest-1) clawdata.inratx = [r1, r2] clawdata.inraty = [r1, r2] clawdata.inratt = [r1, r2] # Specify type of each aux variable in clawdata.auxtype. # This must be a list of length maux, each element of which is one of: # 'center', 'capacity', 'xleft', or 'yleft' (see documentation). clawdata.auxtype = [ 'center', 'center', 'yleft', 'center', 'center', 'xleft', 'yleft', 'xleft', 'yleft', 'center' ] clawdata.tol = -1.0 # negative ==> don't use Richardson estimator clawdata.tolsp = 0.5 # used in default flag2refine subroutine # (Not used in geoclaw!) clawdata.kcheck = 2 # how often to regrid (every kcheck steps) clawdata.ibuff = 4 # width of buffer zone around flagged points clawdata.cutoff = 0.7 # efficiency cutoff for grid generator clawdata.checkpt_iousr = 200 clawdata.restart = False clawdata.restart_file = 'fort.chk0245' # More AMR parameters can be set -- see the defaults in pyclaw/data.py return rundata
def setrun(claw_pkg='geoclaw'): #------------------------------ """ Define the parameters used for running Clawpack. INPUT: claw_pkg expected to be "geoclaw" for this setrun. OUTPUT: rundata - object of class ClawRunData """ assert claw_pkg.lower() == 'geoclaw', "Expected claw_pkg = 'geoclaw'" ndim = 2 rundata = data.ClawRunData(claw_pkg, ndim) #------------------------------------------------------------------ # Problem-specific parameters to be written to setprob.data: #------------------------------------------------------------------ #probdata = rundata.new_UserData(name='probdata',fname='setprob.data') #------------------------------------------------------------------ # Standard Clawpack parameters to be written to claw.data: # (or to amr2ez.data for AMR) #------------------------------------------------------------------ clawdata = rundata.clawdata # initialized when rundata instantiated clawdata.restart = False # Turn restart switch on or off # Set single grid parameters first. # See below for AMR parameters. # --------------- # Spatial domain: # --------------- # Number of space dimensions: clawdata.ndim = ndim # Lower and upper edge of computational domain: # clawdata.xlower = 137.57 ## # clawdata.xupper = 141.41 ## # clawdata.ylower = 39.67 ## # clawdata.yupper = 44.15 ## # For OK08 grid: # clawdata.xlower = 138.5015 ## # clawdata.xupper = 140.541 ## # clawdata.ylower = 40.5215 ## # clawdata.yupper = 43.2988 ## clawdata.xlower = 139.05 ## clawdata.xupper = 140. ## clawdata.ylower = 41.6 ## clawdata.yupper = 42.55 ## # # Number of grid cells: # clawdata.mx = 36 ## 3.84 deg/36 cells = 384 sec/cell = 16*24 sec/cell # clawdata.my = 42 ## 4.48 deg/42 cells = 384 sec/cell = 16*24 sec/cell # clawdata.mx = 576 ## 3.84 deg/576 cells = 24 sec/cell # clawdata.my = 672 ## 4.48 deg/672 cells = 24 sec/cell # clawdata.mx = 84 ## 8*24 sec/cell # clawdata.my = 72 ## 8*24 sec/cell clawdata.mx = 60 clawdata.my = 60 # --------------- # Size of system: # --------------- # Number of equations in the system: clawdata.meqn = 3 # Number of auxiliary variables in the aux array (initialized in setaux) clawdata.maux = 3 # Index of aux array corresponding to capacity function, if there is one: clawdata.mcapa = 2 # ------------- # Initial time: # ------------- clawdata.t0 = 0.0 # ------------- # Output times: #-------------- # Specify at what times the results should be written to fort.q files. # Note that the time integration stops after the final output time. # The solution at initial time t0 is always written in addition. clawdata.outstyle = 1 ## if clawdata.outstyle == 1: # Output nout frames at equally spaced times up to tfinal: # Note: Frame time intervals = (tfinal-t0)/nout clawdata.nout = 9 ## Number of frames (plus the t = 0.0 frame) clawdata.tfinal = 9 * 60 ## End run time in Seconds elif clawdata.outstyle == 2: # Specify a list of output times. from numpy import arange, linspace #clawdata.tout = list(arange(0,3600,360)) + list(3600*arange(0,21,0.5)) # clawdata.tout = list(linspace(0,32000,9)) + \ # list(linspace(32500,40000,16)) clawdata.tout = list(linspace(0, 4, 2)) clawdata.nout = len(clawdata.tout) elif clawdata.outstyle == 3: # Output every iout timesteps with a total of ntot time steps: iout = 1 ntot = 1 clawdata.iout = [iout, ntot] # --------------------------------------------------- # Verbosity of messages to screen during integration: # --------------------------------------------------- # The current t, dt, and cfl will be printed every time step # at AMR levels <= verbosity. Set verbosity = 0 for no printing. # (E.g. verbosity == 2 means print only on levels 1 and 2.) clawdata.verbosity = 1 # -------------- # Time stepping: # -------------- # if dt_variable==1: variable time steps used based on cfl_desired, # if dt_variable==0: fixed time steps dt = dt_initial will always be used. clawdata.dt_variable = 1 # Initial time step for variable dt. # If dt_variable==0 then dt=dt_initial for all steps: clawdata.dt_initial = 0.016 # Max time step to be allowed if variable dt used: clawdata.dt_max = 1e+99 # Desired Courant number if variable dt used, and max to allow without # retaking step with a smaller dt: clawdata.cfl_desired = 0.75 clawdata.cfl_max = 1.0 # Maximum number of time steps to allow between output times: clawdata.max_steps = 50000 # ------------------ # Method to be used: # ------------------ # Order of accuracy: 1 => Godunov, 2 => Lax-Wendroff plus limiters clawdata.order = 2 # Transverse order for 2d or 3d (not used in 1d): clawdata.order_trans = 2 # Number of waves in the Riemann solution: clawdata.mwaves = 3 # List of limiters to use for each wave family: # Required: len(mthlim) == mwaves clawdata.mthlim = [3, 3, 3] # Source terms splitting: # src_split == 0 => no source term (src routine never called) # src_split == 1 => Godunov (1st order) splitting used, # src_split == 2 => Strang (2nd order) splitting used, not recommended. clawdata.src_split = 1 # -------------------- # Boundary conditions: # -------------------- # Number of ghost cells (usually 2) clawdata.mbc = 2 # Choice of BCs at xlower and xupper: # 0 => user specified (must modify bcN.f to use this option) # 1 => extrapolation (non-reflecting outflow) # 2 => periodic (must specify this at both boundaries) # 3 => solid wall for systems where q(2) is normal velocity clawdata.mthbc_xlower = 1 # Open Left BC clawdata.mthbc_xupper = 1 # Open Right BC clawdata.mthbc_ylower = 1 # Open Bottom BC clawdata.mthbc_yupper = 1 # Open Top BC # --------------- # AMR parameters: # --------------- # max number of refinement levels: mxnest = 5 ## clawdata.mxnest = -mxnest # negative ==> anisotropic refinement in x,y,t # List of refinement ratios at each level (length at least mxnest-1) ## Levels 2 3 4 5 clawdata.inratx = [2, 4, 4, 6] ## clawdata.inraty = [2, 4, 4, 6] ## clawdata.inratt = [2, 4, 4, 2] ## # Specify type of each aux variable in clawdata.auxtype. # This must be a list of length maux, each element of which is one of: # 'center', 'capacity', 'xleft', or 'yleft' (see documentation). clawdata.auxtype = ['center', 'capacity', 'yleft'] clawdata.tol = -1.0 # negative ==> don't use Richardson estimator clawdata.tolsp = 0.5 # used in default flag2refine subroutine # (Not used in geoclaw!) clawdata.kcheck = 3 # how often to regrid (every kcheck steps) clawdata.ibuff = 2 # width of buffer zone around flagged points clawdata.tchk = [33000., 35000.] # when to checkpoint # More AMR parameters can be set -- see the defaults in pyclaw/data.py #------------------------------------------------------------------ # GeoClaw specific parameters: #------------------------------------------------------------------ rundata = setgeo(rundata) # Defined below return rundata
def setrun(claw_pkg='digclaw'): #------------------------------ """ Define the parameters used for running Clawpack. INPUT: claw_pkg expected to be "geoclaw" for this setrun. OUTPUT: rundata - object of class ClawRunData """ #assert claw_pkg.lower() == 'digclaw', "Expected claw_pkg = 'digclaw'" ndim = 2 rundata = data.ClawRunData(claw_pkg, ndim) #------------------------------------------------------------------ # GeoClaw specific parameters: #------------------------------------------------------------------ rundata = setgeo(rundata) # Defined below #------------------------------------------------------------------ # DigClaw specific parameters: #------------------------------------------------------------------ rundata = setdig(rundata) # Defined below #------------------------------------------------------------------ # Standard Clawpack parameters to be written to claw.data: # (or to amr2ez.data for AMR) #------------------------------------------------------------------ clawdata = rundata.clawdata # initialized when rundata instantiated # Set single grid parameters first. # See below for AMR parameters. # --------------- # Spatial domain: # --------------- # Number of space dimensions: clawdata.ndim = ndim # Lower and upper edge of computational domain: # use DEM limits import os import dclaw.topotools as dt boundaryfile = os.path.join('init_data','topo','topodomain.tt3') a=dt.topoboundary(boundaryfile); xll = a[0] yll = a[2] xu = a[1] yu = a[3] header = dt.topoheaderread(boundaryfile) dx = 2. #header['cellsize'] #finest grids will be 2 meters coarsen = 1 dx = dx*coarsen # refinement ratios levels = 3 #the number of levels is set by mxnest, but convenient here (mxnest=levels below) r1 = 4 #level 2 refinement ratio from 1 => determines number of coarse cells r2 = 4 # level 3 refinement ratio from 2 r3 = 1 #level 4 refinement raio from 3. level 4 resolution = dx meters rtotal = r1*r2*r3 #total refinement from coarsest level #set computationsl domain (shrink by a coarse cell from DEM limits) clawdata.xlower = xll + 1.0*dx*rtotal clawdata.xupper = xu - 1.0*dx*rtotal clawdata.ylower = yll + 1.0*dx*rtotal clawdata.yupper = yu - 1.0*dx*rtotal # Number of grid cells: clawdata.mx = int((clawdata.xupper-clawdata.xlower)/(dx*rtotal)) clawdata.my = int((clawdata.yupper-clawdata.ylower)/(dx*rtotal)) # --------------- # Size of system: # --------------- # Number of equations in the system: clawdata.meqn = 7 # Number of auxiliary variables in the aux array (initialized in setaux) clawdata.maux = 10 # Index of aux array corresponding to capacity function, if there is one: clawdata.mcapa = 0 # ------------- # Initial time: # ------------- clawdata.t0 = 0.0 # ------------- # Output times: #-------------- # Specify at what times the results should be written to fort.q files. # Note that the time integration stops after the final output time. # The solution at initial time t0 is always written in addition. clawdata.outstyle = 1 if clawdata.outstyle==1: # Output nout frames at equally spaced times up to tfinal: tf = 60.#4200. dt = 5. #output every 5 seconds clawdata.nout = int(tf/5.) #make spacing take precedent over final time: clawdata.tfinal = tf - np.mod(tf,dt) if clawdata.tfinal<tf: clawdata.tfinal = clawdata.tfinal + dt elif clawdata.outstyle == 2: # Specify a list of output times. clawdata.tout = [0.0,10.0,70.0,600.0,1200.0] clawdata.nout = len(clawdata.tout) elif clawdata.outstyle == 3: # Output every iout timesteps with a total of ntot time steps: iout = 1 ntot = 100 clawdata.iout = [iout, ntot] # --------------------------------------------------- # Verbosity of messages to screen during integration: # --------------------------------------------------- # The current t, dt, and cfl will be printed every time step # at AMR levels <= verbosity. Set verbosity = 0 for no printing. # (E.g. verbosity == 2 means print only on levels 1 and 2.) clawdata.verbosity = 4 # -------------- # Time stepping: # -------------- # if dt_variable==1: variable time steps used based on cfl_desired, # if dt_variable==0: fixed time steps dt = dt_initial will always be used. clawdata.dt_variable = 1 # Initial time step for variable dt. # If dt_variable==0 then dt=dt_initial for all steps: clawdata.dt_initial = 1.e-16 # Max time step to be allowed if variable dt used: clawdata.dt_max = 1.0 # Desired Courant number if variable dt used, and max to allow without # retaking step with a smaller dt: clawdata.cfl_desired = 0.25 clawdata.cfl_max = 0.5 # Maximum number of time steps to allow between output times: clawdata.max_steps = 100000 # ------------------ # Method to be used: # ------------------ # Order of accuracy: 1 => Godunov, 2 => Lax-Wendroff plus limiters clawdata.order = 1 # Transverse order for 2d or 3d (not used in 1d): clawdata.order_trans = 0 # Number of waves in the Riemann solution: clawdata.mwaves = 5 # List of limiters to use for each wave family: # Required: len(mthlim) == mwaves clawdata.mthlim = [4,4,4,4,4,4] # Source terms splitting: # src_split == 0 => no source term (src routine never called) # src_split == 1 => Godunov (1st order) splitting used, # src_split == 2 => Strang (2nd order) splitting used, not recommended. clawdata.src_split = 1 # -------------------- # Boundary conditions: # -------------------- # Number of ghost cells (usually 2) clawdata.mbc = 2 # Choice of BCs at xlower and xupper: # 0 => user specified (must modify bcN.f to use this option) # 1 => extrapolation (non-reflecting outflow) # 2 => periodic (must specify this at both boundaries) # 3 => solid wall for systems where q(2) is normal velocity clawdata.mthbc_xlower = 1 clawdata.mthbc_xupper = 1 clawdata.mthbc_ylower = 1 clawdata.mthbc_yupper = 1 # --------------- # AMR parameters: # --------------- # max number of refinement levels clawdata.mxnest = -levels # negative ==> anisotropic refinement in x,y,t # List of refinement ratios at each level (length at least mxnest-1) clawdata.inratx = [r1,r2,r3] clawdata.inraty = [r1,r2,r3] clawdata.inratt = [r1,r2,r3] # Specify type of each aux variable in clawdata.auxtype. # This must be a list of length maux, each element of which is one of: # 'center', 'capacity', 'xleft', or 'yleft' (see documentation). clawdata.auxtype = ['center','center','yleft','center','center','xleft','yleft','xleft','yleft','center'] clawdata.tol = -1.0 # negative ==> don't use Richardson estimator clawdata.tolsp = 0.5 # used in default flag2refine subroutine # (Not used in geoclaw!) clawdata.kcheck = 2 # how often to regrid (every kcheck steps) clawdata.ibuff = 4 # width of buffer zone around flagged points clawdata.cutoff = 0.7 # efficiency cutoff for grid generator clawdata.checkpt_iousr = 200 clawdata.restart = False clawdata.restart_file = 'fort.chk0693' # More AMR parameters can be set -- see the defaults in pyclaw/data.py return rundata