... | ... | @@ -125,29 +125,24 @@ eqTracer.compute_mass("tracer.dat") |
|
|
|
|
|
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
|
|
|
|
|
|
```python
|
|
|
pre_data_dir_base = param.data_dir+'_'+slimPre.partition_nb()+'/'
|
|
|
pre_data_dir = pre_data_dir_base+slimPre.partition_id()+'/'
|
|
|
```
|
|
|
|
|
|
Path to the mesh and bathymetry files
|
|
|
Useful import
|
|
|
|
|
|
```python
|
|
|
mesh_file_name = pre_data_dir+"mesh.msh"
|
|
|
path_bathy = pre_data_dir_base+"bathymetry_smooth/bathymetry_smooth.idx"
|
|
|
import slim
|
|
|
```
|
|
|
Import mesh info in python
|
|
|
|
|
|
Give the name of the directories where data are (same as in the preprocessing script)
|
|
|
|
|
|
```python
|
|
|
mesh = slimPre.Mesh( pre_data_dir+"mesh.msh", mesh_proj='+proj=utm +ellps=WGS84 +zone=17')
|
|
|
data_dir_base = 'data_'+slim.partition_nb()+'/'
|
|
|
data_dir = data_dir_base+slim.partition_id()+'/'
|
|
|
```
|
|
|
|
|
|
Create the domain (it has to be the same as the one used for the hydro equation
|
|
|
Create a ```Domain``` object, the computational domain defined by the mesh and the bathymetry (and gravity, density, order of the element, ...) . 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)
|
|
|
domain = slim.Domain(data_dir+'mesh.msh', data_dir_base+'bathymetry_smooth/bathymetry_smooth.idx')
|
|
|
```
|
|
|
- ```(pre_data_dir+"gravity.nc","gravity")``` is a pre-processing file with the gravity over the domain
|
|
|
- ```rho``` is the water density
|
... | ... | @@ -197,11 +192,26 @@ Compute the total mass of tracer in the domain |
|
|
eqTracer.compute_mass("tracer.dat")
|
|
|
```
|
|
|
|
|
|
Create the temporal solver and set the time_step offline (i.e., the time step of the hydrodynamic run)
|
|
|
Create the temporal solver
|
|
|
|
|
|
```python
|
|
|
loop=slim.Loop(maximum_time_step = dt, export_time = 4*dt,path="output")
|
|
|
```
|
|
|
|
|
|
Add the equation(s) you want to solve (you can solve several passive tracer at the same time
|
|
|
|
|
|
```python
|
|
|
loop.add_equation(eqTracer)
|
|
|
```
|
|
|
|
|
|
Set the time_step offline (i.e., the time step of the hydrodynamic run)
|
|
|
|
|
|
```python
|
|
|
loop.set_time_step_offline(dt, periodic = False)
|
|
|
```
|
|
|
|
|
|
Launch
|
|
|
|
|
|
```python
|
|
|
loop.run()
|
|
|
``` |