|
|
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
|
|
|
from dgpy.scripts 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()+'/'
|
|
|
```
|
|
|
|
|
|
pre_data_dir_base = 'data_'+slimPre.partition_nb()+'/'
|
|
|
pre_data_dir = pre_data_dir_base+slimPre.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)
|
|
|
```
|
|
|
|
|
|
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
|
|
|
- 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.addParticleAtPoint(-5.13492e6,3.47109e6, 200, 0, 1)
|
|
|
tracker.addParticleAtPoint(-4.95992e6,4.57734e6, 200, 0, 2)
|
|
|
```
|
|
|
|
|
|
dt = 900
|
|
|
Launch the simulation
|
|
|
|
|
|
number_of_particles = 1
|
|
|
locationId = 4
|
|
|
tracker = slimPost.Particle_tracker(mesh, "output/particles/", path_bathy, 2800, 200 ,1, dt)
|
|
|
tracker.addParticleAtPoint(-830852,-794550, 5, 0, locationId)
|
|
|
tracker.addParticleAtPoint(-830852,-794550, number_of_particles, 10, locationId)
|
|
|
for i in range(200):
|
|
|
tracker.addParticleAtPoint(-830852,-794550, i, 0, i)
|
|
|
tracker.loop("test") |
|
|
\ No newline at end of file |
|
|
```python
|
|
|
tracker.loop("output/particles")
|
|
|
``` |
|
|
\ No newline at end of file |