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

Organise and enhance spherical coordinate transforms #409

Merged
merged 18 commits into from
Sep 26, 2023

Conversation

tommbendall
Copy link
Contributor

@tommbendall tommbendall commented Jul 27, 2023

Adds some handy routines for spherical coordinate transforms, and reorganises some of our existing ones. This addresses #335 .

There are quite aspects to this change:

  1. There are new routines to:
  • convert between (x,y,z) and (lon,lat,r) coordinates
  • convert between the (x,y,z) and (lon,lat,r) components of vectors
  • calculate distances between points on (a) periodic Cartesian meshes and (b) on the surface of a sphere
  • compute rotated (lon,lat,r) coordinates, effectively allowing spherical meshes to be easily rotated

Underpinning these new routines is the aim to have a set of routines that can be used both with Firedrake expressions and numpy arrays.

  1. The model's internal coordinates can now be rotated (lon,lat,r) coordinates. The rotation of coordinates is threaded through the model by passing it to the Domain and Coordinates objects. The rotated coordinates are now used in the Williamson 2 test.

  2. There is now a calculation in the Domain object to evaluate the radius of the mesh that has been provided. When outputting for a 3D spherical domain, the vertical coordinate is now r-radius instead of r.

  3. The vector component diagnostics have been consolidated and use the rotation capability.

  4. There are unit-tests for all of the new routines.

@tommbendall tommbendall marked this pull request as ready for review September 15, 2023 17:25
Copy link
Contributor

@jshipton jshipton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants