xgcm / xgcm-examples

Examples and tutorials for xgcm
MIT License
12 stars 12 forks source link

Mistake in computation horizontal divergence #14

Open daanreijnders opened 3 years ago

daanreijnders commented 3 years ago

First of all, thanks for making these tutorials! They've really helped me master xgcm, which I use almost daily now.

I spotted a mistake in the MITgcm example. The computation of the divergence is incorrect. The right MITgcm discrete form is found here. The difference is that there should be no multiplication by ds.drF (which in the link you currently include is present to correctly represent the z-derivative of the vertical velocity in the continuity equation), and that there should be an additional division by ds.hFacC. This also means that you may want to rename u/v_transport, since you don't need the transport after all.

I figured it's easiest for me to open an issue over a PR, since I don't know your specific workflow/integration for getting these examples on the xgcm website.

daanreijnders commented 3 years ago

Actually, just submitted a PR