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
# define all kernels to be executed on particles using an (ordered) list
146
-
kernels = [Age, parcels.kernels.AdvectionRK4]
146
+
kernels = [Age, parcels.kernels.AdvectionRK2]
147
147
```
148
148
149
149
```{note}
150
150
Every Kernel must be a function with the following (and only those) arguments: `(particles, fieldset)`
151
151
```
152
152
153
153
```{warning}
154
-
We have to be careful with writing kernels for vector fields on Curvilinear grids. While Parcels automatically rotates the "U" and "V" field when necessary, this is not the case for other fields such as Stokes drift. [This guide](../user_guide/examples/tutorial_nemo_curvilinear.ipynb) describes how to use a curvilinear grid in Parcels.
154
+
We have to be careful with kernels that sample velocities on "spherical" grids (so with longitude and latitude in degrees). Parcels can automatically convert velocities from m s<sup>-1</sup> to degrees s<sup>-1</sup>, but only when using `VectorFields`. [This guide](../user_guide/examples/tutorial_velocityconversion.ipynb) describes how to use velocities on a "spherical" grid in Parcels.
Copy file name to clipboardExpand all lines: docs/user_guide/examples/explanation_kernelloop.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,17 @@ kernelspec:
4
4
name: python3
5
5
---
6
6
7
-
# 📖 The Parcels Kernel loop
7
+
# 📖 Kernel loop
8
8
9
-
On this page we discuss Parcels' execution loop, and what happens under the hood when you combine multiple Kernels.
9
+
On this page we discuss how Parcels executes the Kernel loop, and what happens under the hood when you combine multiple Kernels.
10
10
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!
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!
12
12
13
13
## Background
14
14
15
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.
16
16
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.
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.
Now we define a wind kernel that uses a forward Euler method to apply the wind forcing. Note that we update the `particles.dlon` and `particles.dlat` variables, rather than `particles.lon` and `particles.lat` directly.
94
+
Now we define a wind Kernel that uses a forward Euler method to apply the wind forcing. Note that we update the `particles.dlon` and `particles.dlat` variables, rather than `particles.lon` and `particles.lat` directly.
Copy file name to clipboardExpand all lines: docs/user_guide/examples/tutorial_Argofloats.ipynb
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@
15
15
"source": [
16
16
"This tutorial shows how simple it is to construct a Kernel in Parcels that mimics the [vertical movement of Argo floats](https://www.aoml.noaa.gov/phod/argo/images/argo_float_mission.jpg).\n",
17
17
"\n",
18
-
"We first define the kernels for each phase of the Argo cycle."
18
+
"We first define the Kernel for the vertical movement cycle of the Argo float."
19
19
]
20
20
},
21
21
{
@@ -90,7 +90,7 @@
90
90
"cell_type": "markdown",
91
91
"metadata": {},
92
92
"source": [
93
-
"And then we can run Parcels with this 'custom kernel'.\n",
93
+
"And then we can run Parcels with this `ArgoVerticalMovement` Kernel.\n",
94
94
"\n",
95
95
"Below we use the horizontal velocity fields of CopernicusMarine, which are provided as example_data with Parcels.\n"
96
96
]
@@ -152,10 +152,10 @@
152
152
" z=[fieldset.mindepth],\n",
153
153
")\n",
154
154
"\n",
155
-
"# combine Argo vertical movement kernel with built-in Advection kernel\n",
155
+
"# combine Argo vertical movement Kernel with built-in Advection Kernel\n",
156
156
"kernels = [\n",
157
157
" ArgoVerticalMovement,\n",
158
-
" parcels.kernels.AdvectionRK4,\n",
158
+
" parcels.kernels.AdvectionRK2,\n",
159
159
"]\n",
160
160
"\n",
161
161
"# Create a ParticleFile object to store the output\n",
@@ -165,7 +165,7 @@
165
165
" chunks=(1, 500), # setting to write in chunks of 500 observations\n",
166
166
")\n",
167
167
"\n",
168
-
"# Now execute the kernels for 30 days, saving data every 30 minutes\n",
168
+
"# Now execute the Kernels for 30 days, saving data every 30 minutes\n",
0 commit comments