Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating conformal cubed sphere grids #1586

Closed
ali-ramadhan opened this issue Apr 14, 2021 · 2 comments · Fixed by #2836 or #2871
Closed

Generating conformal cubed sphere grids #1586

ali-ramadhan opened this issue Apr 14, 2021 · 2 comments · Fixed by #2836 or #2871

Comments

@ali-ramadhan
Copy link
Member

Right now we load cubed sphere grids from a file which is a Julia/JLD2.jl version of the binary files used by MITgcm. These grid files are currently stored at https://github.com/CliMA/OceananigansArtifacts.jl.

The easiest way to use them is to load them as a data dependency with DataDeps.jl: https://github.com/CliMA/Oceananigans.jl/blob/master/test/data_dependencies.jl

This works well for the CS32 and CS96 grids, but for much larger grids like the CS510 the grid file is ~200 MiB uncompressed (~118 MiB compressed with JLD2's compress=true) which is bigger than GitHub's 100 MiB file size limit. 200 MiB for a grid file is also a bit cumbersome. Right now I'm thinking of hosting CS510 on the engaging cluster, although git lfs for OceananigansArtifacts.jl may be an option.

It would be nice to be able to generate conformal cubed sphere grid files to make it easier for users to use cubed sphere grids, and also for the added flexibility of not being limited to three common resolutions (CS32, CS96, and CS510).

It would also be good to keep the ability to load a cubed sphere grid from file since we may want to do this for other grids besides the cubed sphere in the future (lat-lon-cap or LLC grids?), and it would be useful to test that the grids we generate are indeed correct by comparing with the grid files.

I'm opening this issue just to document what we know about conformal cubed sphere grid generation.

It's not a particularly urgent issue.

Computing grid metrics

We already have some code that generates conformal cubed sphere grids with the coordinates, but they are missing the grid metrics (grid spacings and areas).

@christophernhill has pointed out these MITgcm MATLAB scripts that may just be what we need to compute the grid metrics.

http://wwwcvs.mitgcm.org/viewvc/MITgcm/MITgcm_contrib/high_res_cube/matlab-grid-generator/README?revision=1.1.1.1&view=markup
http://wwwcvs.mitgcm.org/viewvc/MITgcm/MITgcm_contrib/high_res_cube/matlab-grid-generator/calc_fvgrid.m?revision=1.1.1.1&view=markup
http://wwwcvs.mitgcm.org/viewvc/MITgcm/MITgcm_contrib/high_res_cube/matlab-grid-generator/gengrid_fn.m?revision=1.1.1.1&view=markup

He also mentioned Ives & Zacharias (1989) as being a good reference for this. Attached here: ives_zacharias.pdf

More accurate cubed sphere conformal mapping

Not sure if this will be an issue, but the cubed sphere conformal mapping we use from https://github.com/CliMA/CubedSphere.jl/blob/main/src/conformal_cubed_sphere.jl involves evaluating a Taylor series as described by Rančić et al. (1996).

In appendices A and B, Rančić et al. (1996) describes how to map from the cube faces to the surface of the sphere and how to compute the Taylor coefficients, but after spending several hours trying to reproduce them I was not able to (my complex analysis is quite rusty) and so I copy-pasted the 30 coefficients given in Table B.1.

However, we may need more than 30 coefficients for a truly accurate numerical mapping. I'm guessing the accuracy of the mapping matters more at higher resolutions, but not sure if it's ever an issue for the kind of work we're doing. Rančić et al. (1996) find that you need 128 terms for 15-figure accuracy in Appendix B.

I'm attaching Rančić et al. (1996) here for reference:

Rančić et al, 1996, Quarterly Journal of the Royal Meteorological Society, A global shallow-water model using an expanded spherical cube - Gnomonic versus conformal coordinates.pdf

@glwagner
Copy link
Member

@navidcy figured this out.

@glwagner
Copy link
Member

In #2836 and #2871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment