Skip to content

Commit 178e128

Browse files
reint-fischerVeckoTheGeckoerikvansebille
authored
Apply suggestions from code review
Co-authored-by: Nick Hodgskin <[email protected]> Co-authored-by: Erik van Sebille <[email protected]>
1 parent 4059bb9 commit 178e128

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/user_guide/examples/explanation_kernelloop.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ kernelspec:
88

99
On this page we discuss Parcels' execution loop, and what happens under the hood when you combine multiple Kernels.
1010

11-
This is probably not very relevant when you only use the built-in Advection kernels, but can be important when you are writing and combining your own Kernels!
11+
This is not very relevant when you only use the built-in Advection kernels, but can be important when you are writing and combining your own Kernels!
1212

1313
## Background
1414

15-
When you run a Parcels simulation (i.e. a call to `pset.execute()`), the Kernel loop is the main part of the code that is executed. This part of the code loops through all particles and executes the Kernels that are defined for each particle.
15+
When you run a Parcels simulation (i.e. a call to `pset.execute()`), the Kernel loop is the main part of the code that is executed. This part of the code loops through time and executes the Kernels for all particle.
1616

17-
In order to make sure that the displacements of a particle in the different Kernels can be summed, all Kernels add to a _change_ in position (`particles.dlon`, `particles.dlat`, and `particles.dz`). This is important, because there are situations where movement kernels would otherwise not commute. Take the example of advecting particles by currents _and_ winds. If the particle would first be moved by the currents and then by the winds, the result could be different from first moving by the winds and then by the currents. Instead, by adding the changes in position, the ordering of the Kernels has no consequence on the particle displacement.
17+
In order to make sure that the displacements of a particle in the different Kernels can be summed, all Kernels add to a _change_ in position (`particles.dlon`, `particles.dlat`, and `particles.dz`). This is important, because there are situations where movement kernels would otherwise not commute. Take the example of advecting particles by currents _and_ winds. If the particle would first be moved by the currents and then by the winds, the result could be different from first moving by the winds and then by the currents. Instead, by summing the _changes_ in position, the ordering of the Kernels has no consequence on the particle displacement.
1818

1919
## Basic implementation
2020

@@ -158,7 +158,7 @@ for statuscode, val in StatusCode.__dict__.items():
158158

159159
Once an error is thrown (for example, a Field Interpolation error), then the `particles.state` is updated to the corresponding status code. This gives you the flexibility to write a Kernel that checks for a status code and does something with it.
160160

161-
For example, you can write a Kernel that checks for `particles.state == StatusCode.ErrorOutOfBounds` and deletes the particle, and then append this to the Kernel list in `pset.execute()`.
161+
For example, you can write a Kernel that checks for `particles.state == StatusCode.ErrorOutOfBounds` and deletes the particle, and then append this custom Kernel to the Kernel list in `pset.execute()`.
162162

163163
```
164164
def DeleteOutOfBounds(particles, fieldset):

0 commit comments

Comments
 (0)