"""
Create fgmax_grid.txt input files 
"""

from clawpack.geoclaw import fgmax_tools

from setrun import setrun

rundata = setrun()
clawdata = rundata.clawdata
xlower = clawdata.lower[0]
ylower = clawdata.lower[1]
xupper = clawdata.upper[0]
yupper = clawdata.upper[1]
dx_level1 = (xupper-xlower) / clawdata.num_cells[0]
dy_level1 = (yupper-ylower) / clawdata.num_cells[1]

    amrdata.amr_levels_max = 3

    # List of refinement ratios at each level (length at least mxnest-1)
    amrdata.refinement_ratios_x = [4,3]
    amrdata.refinement_ratios_y = [4,3]

dx_fine = 2./(3.*4.)  # grid resolution at finest level

fg = fgmax_tools.FGmaxGrid()
fg.point_style = 2       # will specify a 2d grid of points
fg.x1 = -120.
fg.x2 = -60.
fg.y1 = -60.
fg.y2 = 0.
fg.dx = 0.2 
fg.tstart_max =  10.     # when to start monitoring max values
fg.tend_max = 1.e10       # when to stop monitoring max values
fg.dt_check = 60.         # target time (sec) increment between updating 
                           # max values
fg.min_level_check = 3    # which levels to monitor max on
fg.arrival_tol = 1.e-2    # tolerance for flagging arrival

fg.input_file_name = 'fgmax_grid.txt'
fg.write_input_data()

