|
|
Postprocessing functions available
|
|
|
|
|
|
# Particle tracker
|
|
|
|
|
|
SLIM is able to predict the position of one (or several) particle(s) from the hydrodynamic output.
|
|
|
|
|
|
Useful import
|
|
|
|
|
|
```python
|
|
|
import slimPost
|
|
|
import slimPre
|
|
|
```
|
|
|
|
|
|
Give the name of the directories where data are (same as in the preprocessing script)
|
|
|
|
|
|
```python
|
|
|
data_dir_base = 'data_'+slim.partition_nb()+'/'
|
|
|
data_dir = data_dir_base+slim.partition_id()+'/'
|
|
|
```
|
|
|
|
|
|
Path to the mesh and bathymetry map
|
|
|
|
|
|
|
|
|
```python
|
|
|
mesh = pre_data_dir+"mesh.msh"
|
|
|
path_bathy = pre_data_dir_base+"bathymetry_smooth/bathymetry_smooth.idx"
|
|
|
```
|
|
|
|
|
|
Create a ```Particle_tracker``` object with the following arguments
|
|
|
- Path to the mesh (here ```mesh```)
|
|
|
- Path to the hydrodynamic run output files (here: ```output```)
|
|
|
- Path to the bathymetry map (here ```path_bathy```)
|
|
|
- The index of the first iteration (here ```50```)
|
|
|
- The number of iterations (here ```118```)
|
|
|
- The number of period (if the hydrodynamic is periodic, here ```1```)
|
|
|
- Time step between each iteration (here ```3600``` because we exported the results 1 times out of 4 time steps during the hydrodynamic run)
|
|
|
|
|
|
```python
|
|
|
tracker = slimPost.Particle_tracker(mesh, "output", path_bathy, 50, 118 ,1, 3600)
|
|
|
```
|
|
|
|
|
|
Set the open boundaries
|
|
|
|
|
|
```python
|
|
|
tracker.set_open_boundary_condition(["mexico","atlantic"])
|
|
|
```
|
|
|
|
|
|
Add particle at one point of the domain with the following arguments
|
|
|
- Position along the x axis (here ```-5.13492e6```)
|
|
|
- Position along the y axis (here ```3.47109e6```)
|
|
|
- Number of particle(s) seeded at this location
|
|
|
- Index of the time step at which the particle is seeded
|
|
|
- Status of the particle(s) (dead or alive (0))
|
|
|
- Identification of the source
|
|
|
- Identification of the particle (default: each particle is identified depending on the source)
|
|
|
|
|
|
```python
|
|
|
tracker.add_particle_at_point(655957,3.14555e6, 200, 0, 1, 0, 1)
|
|
|
tracker.add_particle_at_point(904648,2.66827e6, 200, 0, 2, 0, 2)
|
|
|
for i in range(100):
|
|
|
tracker.add_particle_at_point(718758,2.50247e6, 50,i,1, 0, i+2)
|
|
|
```
|
|
|
|
|
|
Launch the simulation
|
|
|
|
|
|
```python
|
|
|
tracker.loop("output/particles")
|
|
|
``` |
|
|
\ No newline at end of file |