Skip to content

Commit 268d294

Browse files
Remvoing age-related caveat from Kernel loop tutorial
1 parent 2899e37 commit 268d294

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

docs/examples_v3/tutorial_kernelloop.ipynb

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,24 +240,16 @@
240240
"cell_type": "markdown",
241241
"metadata": {},
242242
"source": [
243-
"## Caveats"
243+
"## Caveat: Avoid updating particle locations directly in Kernels"
244244
]
245245
},
246246
{
247247
"cell_type": "markdown",
248248
"metadata": {},
249249
"source": [
250-
"There are a few important considerations to take into account when writing Kernels\n",
251-
"\n",
252-
"### 1. Avoid updating particle locations directly in Kernels\n",
253250
"It is better not to update `particle.lon` directly in a Kernel, as it can interfere with the loop above. Assigning a value to `particle.lon` in a Kernel will throw a warning. \n",
254251
"\n",
255-
"Instead, update the local variable `particle.dlon`.\n",
256-
"\n",
257-
"### 2. Be careful with updating particle variables that do not depend on Fields.\n",
258-
"While assigning the interpolated value of a `Field` to a Particle goes well in the loop above, this is not necessarily so for assigning other attributes. For example, a line like `particle.age += particle.dt` is executed directly so may result in the age being `dt` at `time = 0` in the output file. \n",
259-
"\n",
260-
"A workaround is to either initialise the age to `-dt`, or to increase the `age` only when `particle.time > 0` (using an `np.where` statement)."
252+
"Instead, update the local variable `particle.dlon`."
261253
]
262254
},
263255
{

0 commit comments

Comments
 (0)