-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex4_swan_stat.py
More file actions
43 lines (34 loc) · 1.07 KB
/
ex4_swan_stat.py
File metadata and controls
43 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import dnora as dn
# User definitions for run
NAME = "Ex4_Sula500st"
DM = 500 # Grid resolution in meters
LON = (5.21, 6.66)
LAT = (62.25, 62.89)
BOUNDARY_EDGES = ["N", "W"]
# Use stationary forcing
STATIONARY_FORCING = {
"wind": {"ff": 10, "dd": 330}, # Speed, direction from
"spectra": {
"gamma": 2.5,
"W": {"hs": 5, "tp": 12, "dirp": 270},
"N": {"hs": 3, "tp": 11, "dirp": 280},
},
}
def main() -> None:
# Define the area and set the grid resolution and bathymetry
grid = dn.grid.EMODNET(lon=LON, lat=LAT, name=NAME)
grid.import_topo()
grid.set_spacing(dm=DM)
grid.mesh_grid()
grid.set_boundary_points(dn.grid.mask.Edges(edges=BOUNDARY_EDGES))
# Define a ModelRun for the desired area
model = dn.modelrun.ModelRun(grid)
# Write grid file for SWAN
exporter = dn.export.SWAN(model)
exporter.export_grid()
# Write input file for model and execute SWAN
exe = dn.executer.SWAN(model)
exe.write_input_file(homog=STATIONARY_FORCING)
#exe.run_model()
if __name__ == "__main__":
main()