|
| 1 | +# ============================================================================= |
| 2 | +# IMPORT dnora |
| 3 | +# ============================================================================= |
| 4 | +from dnora import grd, mdl, inp, bnd |
| 5 | +# ============================================================================= |
| 6 | +# DEFINE GRID OBJECT |
| 7 | +# ============================================================================= |
| 8 | +# Set grid definitions |
| 9 | +grid = grd.Grid(lon=(109.150, 109.6), lat=(12.430, 12.815), name='Vietnam') |
| 10 | + |
| 11 | +# Set spacing and boundary points |
| 12 | +grid.set_spacing(dm=400) |
| 13 | +grid.set_boundary(grd.boundary.MidPointAsBoundary(edges='E')) |
| 14 | +# Import topography and mesh it down to the grid definitions |
| 15 | +grid.import_topo(topo_reader=grd.read.GEBCO2021(tile='Vietnam', |
| 16 | + folder='/home/konstantinosc/bathy')) |
| 17 | +grid.mesh_grid() |
| 18 | + |
| 19 | +# ============================================================================= |
| 20 | +# DEFINE MODEL OBJECT |
| 21 | +# ============================================================================= |
| 22 | +model = mdl.SWASH(grid, start_time='2018-08-25T00:00', |
| 23 | + end_time='2018-08-25T05:00') |
| 24 | + |
| 25 | +# ============================================================================= |
| 26 | +# PLOT GRID, FORCING AND BOUNDARIES |
| 27 | +# ============================================================================= |
| 28 | +model.plot_grid(save_fig=True, show_fig=False) |
| 29 | +# ============================================================================= |
| 30 | +# WRITE OUTPUT FOR SWASH RUN |
| 31 | +# ============================================================================= |
| 32 | +model.export_grid() |
| 33 | +model.write_input_file(input_file_writer=inp.SWASH( |
| 34 | + bound_side_command='BOU SIDE S CCW CON REG 0.5 20 180 ')) # Vietnam |
| 35 | +# ============================================================================= |
| 36 | +# SWASH RUN |
| 37 | +# ============================================================================= |
| 38 | +model.run_model(dry_run=False, mat_to_nc=True) |
0 commit comments