Skip to content

Commit

Permalink
Merge pull request #1255 from OceanParcels/periodic_boundaries_tutori…
Browse files Browse the repository at this point in the history
…al_globalmodel_explanation

Adding info on periodic boundaries in global models to tutorial
  • Loading branch information
erikvansebille authored Oct 11, 2022
2 parents a1e8dc3 + ac0658b commit ecda521
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion parcels/examples/tutorial_periodic_boundaries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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`"
]
Expand Down

0 comments on commit ecda521

Please sign in to comment.