You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before starting the simulation, we must define where and how frequent we want to write the output of our simulation. We can define this in a `ParticleFile` object:
The output files are in `.zarr`[format]([format](https://zarr.readthedocs.io/en/stable/).), which can be read by `xarray`. See the [Parcels output tutorial](../user_guide/examples/tutorial_output.ipynb) for more information on the zarr format. We want to choose the `outputdt` argument such they capture the smallest timescales of our interest.
92
+
The output files are in `.zarr`[format](<[format](https://zarr.readthedocs.io/en/stable/).>), which can be read by `xarray`. See the [Parcels output tutorial](../user_guide/examples/tutorial_output.ipynb) for more information on the zarr format. We want to choose the `outputdt` argument such they capture the smallest timescales of our interest.
92
93
93
94
## Run Simulation: `ParticleSet.execute()`
94
-
Finally, we can run the simulation by *executing* the `ParticleSet` using the specified `kernels`. Additionally, we need to specify:
95
+
96
+
Finally, we can run the simulation by _executing_ the `ParticleSet` using the specified `kernels`. Additionally, we need to specify:
97
+
95
98
- the `runtime`: for how long we want to simulate particles.
96
99
- the `dt`: the timestep with which to perform the numerical integration in the `kernels`. Depending on the numerical integration scheme, the accuracy of our simulation will depend on `dt`. Read [this notebook](https://github.com/Parcels-code/10year-anniversary-session2/blob/8931ef69577dbf00273a5ab4b7cf522667e146c5/advection_and_windage.ipynb) to learn more about numerical accuracy.
97
100
@@ -110,6 +113,7 @@ pset.execute(
110
113
```
111
114
112
115
## Read output
116
+
113
117
To start analyzing the trajectories computed by **Parcels**, we can open the `ParticleFile` using `xarray`:
That looks good! The virtual particles released in a line along the 32nd meridian (dark blue) have been advected by the flow field.
132
137
133
138
## Running a simulation backwards in time
139
+
134
140
Now that we know how to run a simulation, we can easily run another and change one of the settings. We can trace back the particles from their current to their original position by running the simulation backwards in time. To do so, we can simply make `dt` < 0.
135
141
136
142
```{code-cell}
@@ -146,6 +152,7 @@ pset.execute(
146
152
output_file=output_file,
147
153
)
148
154
```
155
+
149
156
When we check the output, we can see that the particles have returned to their original position!
0 commit comments