From e7c92d6802c02b488b324dc9040f5a91de83cb21 Mon Sep 17 00:00:00 2001 From: Erik van Sebille Date: Tue, 11 Oct 2022 15:23:41 -0400 Subject: [PATCH] Adding info on periodic boundaries in global models to tutorial Following the discussion in #1240 --- .../tutorial_periodic_boundaries.ipynb | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/parcels/examples/tutorial_periodic_boundaries.ipynb b/parcels/examples/tutorial_periodic_boundaries.ipynb index b3a4f5df0..ff13ccf69 100644 --- a/parcels/examples/tutorial_periodic_boundaries.ipynb +++ b/parcels/examples/tutorial_periodic_boundaries.ipynb @@ -18,7 +18,26 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The idea in Parcels is to do two things:\n", + "In case you have a global model on a C-grid, then there is typically not much that needs to be done. The only thing you have to be aware of, is that there is no 'gap' between the longitude values on the right side of the grid and on the left side of the grid (modulo 360). In other words, that \n", + "```python\n", + "fieldset.U.lon[:, 0] >= fieldset.U.lon[:, -1]\n", + "``` \n", + "\n", + "This is the case for most [curvilinear NEMO model outputs on a C-grid](https://nbviewer.jupyter.org/github/OceanParcels/parcels/blob/master/parcels/examples/tutorial_nemo_curvilinear.ipynb), so that periodic boundary conditions work out of the box, without any special code required. \n", + "\n", + "For [Hycom models](https://github.com/OceanParcels/parcels/issues/1240), we have found that it can help to add an extra column of longitudes at the end of the longitude array:\n", + "\n", + "```python\n", + "lon_c = np.expand_dims(fieldset.U.grid.lon[:, 0], axis=1) \n", + "fieldset.U.grid.lon = np.hstack((fieldset.U.grid.lon, lon_c))\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In case of 'simple' models on an A-grid, the idea in Parcels is to do two things:\n", "1) Extend the fieldset with a small 'halo'\n", "2) Add a periodic boundary kernel to the `.execute`" ]