-
Notifications
You must be signed in to change notification settings - Fork 186
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
Add metric calculation in the face grid of the cubed sphere + general clean up of CubedSphere code #2836
Conversation
…ell_grid.jl, zeros.jl -> zeros_and_ones.jl
…ell_grid.jl, zeros.jl -> zeros_and_ones.jl
021b3f1 made some progress on computing area elements for the conformal cubed sphere grid. E.g., the area elements at locations (Center, Center, Any) should sum up to 1/6-th of the total surface area of the sphere... julia> grid = OrthogonalSphericalShellGrid(size=(16, 16, 1), z=(-1, 0), radius=1); abs(sum(grid.Azᶜᶜᵃ) - 4π / 6) / (4π / 6)
0.0009221387464206299
julia> grid = OrthogonalSphericalShellGrid(size=(160, 160, 1), z=(-1, 0), radius=1); abs(sum(grid.Azᶜᶜᵃ) - 4π / 6) / (4π / 6)
8.970705743640503e-6 |
julia> grid = OrthogonalSphericalShellGrid(size=(16, 16, 1), z=(-1, 0), radius=1);
julia> abs.((sum(grid.Azᶜᶜᵃ), sum(grid.Azᶠᶜᵃ), sum(grid.Azᶜᶠᵃ), sum(grid.Azᶠᶠᵃ)) .- 4π/6)
(0.00047706407919712035, 0.0006835619385658909, 0.0006835619385658909, 0.10180181116525588)
julia> grid = OrthogonalSphericalShellGrid(size=(256, 256, 1), z=(-1, 0), radius=1);
julia> abs.((sum(grid.Azᶜᶜᵃ), sum(grid.Azᶠᶜᵃ), sum(grid.Azᶜᶠᵃ), sum(grid.Azᶠᶠᵃ)) .- 4π/6)
(2.7476636894618878e-6, 2.8613381126696424e-6, 2.8613381126696424e-6, 0.006253695587488561) |
@glwagner, @simone-silvestri: Question: How is Δx^faa, defined for the F at the edge of the domain? Is it the distance between For a curvilinear grid with variable distances (as the |
Curvilinear and Rectilinear coordinates are done in the same way here Oceananigans.jl/src/Grids/grid_generation.jl Lines 100 to 104 in c568df3
I think for the CubedSphere we need to exchange the metrics as halos between the faces (we have to define a field of metrics and fill_halo_regions! to have to correct metrics in the halos) |
We can do that just as a construction step, then |
This make sense! |
So this solution means that we have to think about boundary conditions and halo exchange for a Field on a CubedSphere before completing the grid |
Yeap. I'll leave the halo metrics zero for now and think about halo filling across faces ;) |
The MIT grid seems to just copy the metrics from the first cell...
|
doi:10.1002/qj.4230 seems relevant for halo filling. They talk about the gnomonic cubed sphere -- not sure if same properties that they utilize apply to the conformal. |
@simone-silvestri, from symmetry arguments, the metrics on the halo on one face should be the same as the metrics on some other face. E.g., So we could hardcode these in from a single face instead of constructing 6 faces and filling halos to fill the halo metrics. It will assume, thought, that a specific face configuration is implied. |
Well, we could also hardcode them, as all six faces should be equal. We just have to mind the rotations and the inter-face divisions |
OK, this is not perfect but there has been a lot of improvements. I think to move forward we need to properly fill halos! I'd like to merge this and then continue over at https://github.com/CliMA/Oceananigans.jl/tree/jmc-ss/cubed_sphere |
A bunch of utility functions in the |
@@ -9,7 +9,7 @@ | |||
##### See: https://github.com/CliMA/Oceananigans.jl/issues/1584 | |||
##### | |||
|
|||
@inline function Γᶠᶠᶜ(i, j, k, grid::ConformalCubedSphereFaceGrid, u, v) | |||
@inline function Γᶠᶠᶜ(i, j, k, grid::OrthogonalSphericalShellGrid, u, v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably we are going to have to change this when we subdivide the face in multiple regions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okie!
Sounds good! |
Will leave this for a future PR. |
I'm merging. The document failing is irrelevant. It has to do with the size of |
This is a first start on a cleanup on the cubed sphere code.
This PR develops a way to compute the metrics for an OrthogonalSphericalShellGrid using the haversine formula for the central angle between two points on the sphere and also a formula for computing the area of a spherical triangle.
Closes #1586