... | ... | @@ -20,30 +20,59 @@ Create a ```Domain``` object, the computational domain defined by the mesh and t |
|
|
domain = slim.Domain(data_dir+'mesh.msh', data_dir_base+'bathymetry_smooth/bathymetry_smooth.idx')
|
|
|
```
|
|
|
|
|
|
Create a ```ShallowWater2d``` object, the hydrodynamics equation
|
|
|
Create a ```ShallowWater2d``` object, the hydrodynamics equation with the following arguments :
|
|
|
|
|
|
- ```Domain``` object
|
|
|
- Temporal scheme (here ```implicit```)
|
|
|
- Initial and final time
|
|
|
- ...
|
|
|
|
|
|
```python
|
|
|
eq = slim.ShallowWater2d(domain, 'implicit', initial_time="2016-01-01 00:00:00", final_time="2016-01-08 00:00:00")
|
|
|
```
|
|
|
|
|
|
Specify different parameters/terms of the equations (bottom friction, viscosity, ...)
|
|
|
|
|
|
```python
|
|
|
eq.set_dissipation('manning')
|
|
|
eq.set_viscosity('smagorinsky')
|
|
|
eq.set_coriolis((data_dir+'coriolis.nc', 'coriolis'))
|
|
|
```
|
|
|
|
|
|
Specify the boundary conditions. For open boundaries, you can provide sea surface elevation (```sse```), eastward (```ux```) and northward (```uy```) velocity or transport, ...
|
|
|
|
|
|
# Boundary conditions
|
|
|
```python
|
|
|
eq.set_boundary_coast('coast')
|
|
|
eq.set_boundary_coast('island')
|
|
|
openBnd = data_dir+'open_bnd.nc'
|
|
|
eq.set_boundary_open('atlantic', sse=(openBnd,'h'),ux=(openBnd,'u'),uy=(openBnd,'v'),transport_flux=True)
|
|
|
eq.set_boundary_open('mexico', sse=(openBnd,'h'),ux=(openBnd,'u'),uy=(openBnd,'v'),transport_flux=True)
|
|
|
```
|
|
|
|
|
|
Create ```Loop``` object, which will compute the numerical solution. Arguments give the time step, the time period between exports, the directory where solutions are stored, ...
|
|
|
|
|
|
```python
|
|
|
loop = slim.Loop(maximum_time_step = 900., export_time = 3600., path = 'output')
|
|
|
```
|
|
|
|
|
|
### Time loop
|
|
|
loop=slim.Loop(maximum_time_step = 900., export_time = 3600., path = 'output')
|
|
|
Add every equation object you want to solve
|
|
|
|
|
|
```python
|
|
|
loop.add_equation(eq)
|
|
|
loop.run()
|
|
|
```
|
|
|
|
|
|
Run the model
|
|
|
|
|
|
```python
|
|
|
loop.run()
|
|
|
```
|
|
|
|
|
|
# Run Tracer
|
|
|
|
|
|
SLIM model can simulate any passive tracer. The simulation can be performed online, by running both hydrodynamics and tracer models at the same time, or offline, by loading previously stored outputs of the hydrodynamical SLIM model.
|
|
|
|
|
|
## Online
|
|
|
|
|
|
Running the tracer online request running the hydrodynamic at the same time
|
|
|
|
|
|
In the same python file as Run Hydro:
|
... | ... | @@ -93,6 +122,7 @@ eqTracer.compute_mass("tracer.dat") |
|
|
```
|
|
|
|
|
|
## Offline
|
|
|
|
|
|
Running the tracer offline is much quicker than online. It request the output file from a hydrodynamic run with the option ```export_every_sub_time_step```
|
|
|
|
|
|
Path to the pre-processing file
|
... | ... | @@ -116,8 +146,6 @@ mesh = slimPre.Mesh( pre_data_dir+"mesh.msh", mesh_proj='+proj=utm +ellps=WGS84 |
|
|
|
|
|
Create the domain (it has to be the same as the one used for the hydro equation
|
|
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
domain = slim.Domain(mesh_file_name, path_bathy, g=(pre_data_dir+"gravity.nc","gravity"), density=rho, solve_on_sphere=False)
|
|
|
```
|
... | ... | |