run3d.py 2.1 KB
Newer Older
1
import slim3d
Valentin Vallaeys's avatar
Valentin Vallaeys committed
2
from slimPre import make_directory
3
4

output_directory = 'output'
Valentin Vallaeys's avatar
Valentin Vallaeys committed
5
make_directory(output_directory)
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

domain = slim3d.Domain('data/mesh3d.msh')

equations = slim3d.Slim3d_equations(domain, salinity=True)
equations.set_coriolis(('data/coriolis.nc', 'coriolis'))
equations.set_initial_temperature('netcdf', temperature=('data/initialCondition.nc', 'temperature'))
equations.set_initial_salinity('netcdf', salinity=('data/initialCondition.nc', 'salinity'))
#equations.set_initial_elevation(('data/initialCondition.nc', 'elevation'))
equations.set_boundary_coast('coast')
#equations.set_boundary_coast('yellow_river')
#equations.set_boundary_coast('yellow_sea_north')
#equations.set_boundary_coast('yellow_sea_center')
#equations.set_boundary_coast('yellow_sea_south')
equations.set_boundary_open('yellow_river', flux=('data/river_discharge.nc', 'river_discharge'), temperature=('data/initialCondition.nc', 'temperature'), salinity=('data/river_salinity.nc', 'river_salinity'))
equations.set_boundary_open('yellow_sea_north', eta=('data/yellow_sea_north.nc', 'h'), u=('data/yellow_sea_north.nc', 'u'), v=('data/yellow_sea_north.nc', 'v'), temperature=('data/initialCondition.nc', 'temperature'), salinity=('data/initialCondition.nc', 'salinity'), transport=True)
equations.set_boundary_open('yellow_sea_center', eta=('data/yellow_sea_center.nc', 'h'), u=('data/yellow_sea_center.nc', 'u'), v=('data/yellow_sea_center.nc', 'v'), temperature=('data/initialCondition.nc', 'temperature'), salinity=('data/initialCondition.nc', 'salinity'), transport=True)
equations.set_boundary_open('yellow_sea_south', eta=('data/yellow_sea_south.nc', 'h'), u=('data/yellow_sea_south.nc', 'u'), v=('data/yellow_sea_south.nc', 'v'), temperature=('data/initialCondition.nc', 'temperature'), salinity=('data/initialCondition.nc', 'salinity'), transport=True)

initial_time = '2016-01-01 00:00:00'
final_time = '2016-01-05 00:00:00'
time_loop = slim3d.Loop(equations, 1, 50, 300, initial_time, final_time, output_directory)
time_loop.export_elevation()
time_loop.export_salinity()
time_loop.export_uv()
time_loop.export_uv2d()
time_loop.setup()
time_loop.loop()