-
Notifications
You must be signed in to change notification settings - Fork 191
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
Momentum dynamics validation on the CubedSphere #3306
base: main
Are you sure you want to change the base?
Changes from 162 commits
53f7fb5
c9aa1b3
58e0145
5d964b2
b282ca3
2bdf043
dd35637
d8b83c5
b3f5e24
aeb39ed
4b22581
7eec30c
a1784b4
4c6f9ee
c4ca9e9
cced0d3
20ed9c4
74cc1d3
99c1e78
4701920
e5dd568
d171972
bb2e248
4292835
fde5e2e
ad15c0e
746532f
ae15f9c
87a5d45
4646a5c
0454188
581fdb9
bb28847
e6f0d68
e3cb76d
51a7d96
bb47cf8
8b962b3
9408a01
49ef46f
ff5f208
689f769
bea55d6
ea1b27a
355587a
cf3f03e
1496f43
5d669bb
b7483e8
e7ac069
a6792f6
b481e98
ea9e71f
a173d58
e07552a
21d8520
ed2cd84
66222dc
b4afa0d
092f215
71ebad3
77354c2
0c236de
49f90a2
abb577f
837067d
9435af1
b6d833d
842189d
d064b1f
75c3f28
ac68144
c1fe98d
f4b9896
121e109
b910398
e25151d
9e561b6
0bc4142
e358091
0c34873
9b50474
8bc5508
dbcce8f
f73dfd2
896fab0
8479281
fddef06
6fe1308
cd7e66c
50d41be
b8481e6
ef01019
b58b12f
605f18b
fb34b28
5c6b2c5
a15b0aa
3029997
693e12d
0122a10
3ee51f6
deb0d8b
9d16534
78da645
8dd1417
00cd2b8
dac8db2
f604c6c
3d5ea90
42436d7
769e357
96e4241
2c1e39a
7935d43
212fc16
dc6b4ac
50d4381
6a000e5
54ba43d
f7cd926
cff9e5e
4fbd188
1bba4ec
499ffd3
35ec029
bee9fcd
8351eec
eb990ac
4c32749
9b50d93
9c099ee
187e631
bbede50
391789a
16ba6e4
558d93f
d85a2d2
6993302
b478a1d
3e19e8a
e4420c2
35d1a69
010d4ab
9897096
941260f
f86278e
930b915
b05b709
532df46
9ec9f54
1f27841
b9197c8
2f29cca
01a1afc
5b8fc15
07fa4ef
67e212d
5161be1
37e66e2
1b1ec0a
f3d2a5d
22d5a37
c24a936
42c37cf
43e970a
2ea3bbd
1f99f74
2406d2c
03bdefc
8c9ca4e
cdd742d
0447313
fa1868c
6868203
f66153b
204933f
5e1d5a9
659b1b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ const GriddedMultiRegionFieldTuple{N, T} = NTuple{N, T} where {N, T<:GriddedMult | |
const GriddedMultiRegionFieldNamedTuple{S, N} = NamedTuple{S, N} where {S, N<:GriddedMultiRegionFieldTuple} | ||
|
||
# Utils | ||
Base.size(f::GriddedMultiRegionField) = size(getregion(f.grid, 1)) | ||
Base.size(f::GriddedMultiRegionField) = size(getregion(f, 1)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice catch |
||
|
||
@inline isregional(f::GriddedMultiRegionField) = true | ||
@inline devices(f::GriddedMultiRegionField) = devices(f.grid) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,23 @@ | |
ζ₃ᶠᶠᶜ(i, j, k, grid, u, v) | ||
|
||
The vertical vorticity associated with horizontal velocities ``u`` and ``v``. | ||
navidcy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
""" | ||
@inline ζ₃ᶠᶠᶜ(i, j, k, grid, u, v) = Γᶠᶠᶜ(i, j, k, grid, u, v) / Azᶠᶠᶜ(i, j, k, grid) | ||
|
||
@inline function ζ₃ᶠᶠᶜ(i, j, k, grid::OrthogonalSphericalShellGrid{FT}, u, v) where FT | ||
scaling = ifelse(on_corner(i, j, grid), convert(FT, 1), 1) | ||
return scaling * Γᶠᶠᶜ(i, j, k, grid, u, v) / Azᶠᶠᶜ(i, j, k, grid) | ||
end | ||
|
||
# Corner | ||
@inline on_corner(i, j, grid) = on_south_west_corner(i, j, grid) | on_south_east_corner(i, j, grid) | on_north_west_corner(i, j, grid) | on_north_east_corner(i, j, grid) | ||
|
||
# South-west, south-east, north-west, north-east corners | ||
@inline on_south_west_corner(i, j, grid) = (i == 1 && j == 1) | ||
@inline on_south_east_corner(i, j, grid) = (i == grid.Nx+1 && j == 1) | ||
@inline on_north_east_corner(i, j, grid) = (i == grid.Nx+1 && j == grid.Ny+1) | ||
@inline on_north_west_corner(i, j, grid) = (i == 1 && j == grid.Ny+1) | ||
|
||
##### | ||
##### Vertical circulation at the corners of the cubed sphere needs to treated in a special manner. | ||
##### See: https://github.com/CliMA/Oceananigans.jl/issues/1584 | ||
|
@@ -17,26 +31,26 @@ | |
Γᶠᶠᶜ(i, j, k, grid, u, v) | ||
|
||
The vertical circulation associated with horizontal velocities ``u`` and ``v``. | ||
navidcy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
@inline function Γᶠᶠᶜ(i, j, k, grid::OrthogonalSphericalShellGrid, u, v) | ||
# South-west corner | ||
if i == 1 && j == 1 | ||
return Δy_qᶜᶠᶜ(i, j, k, grid, v) - Δx_qᶠᶜᶜ(i, j, k, grid, u) + Δx_qᶠᶜᶜ(i, j-1, k, grid, u) | ||
|
||
# South-east corner | ||
elseif i == grid.Nx+1 && j == 1 | ||
return - Δy_qᶜᶠᶜ(i-1, j, k, grid, v) - Δx_qᶠᶜᶜ(i, j, k, grid, u) + Δx_qᶠᶜᶜ(i, j-1, k, grid, u) | ||
|
||
# North-west corner | ||
elseif i == 1 && j == grid.Ny+1 | ||
return Δy_qᶜᶠᶜ(i, j, k, grid, v) - Δx_qᶠᶜᶜ(i, j, k, grid, u) + Δx_qᶠᶜᶜ(i, j-1, k, grid, u) | ||
|
||
# North-east corner | ||
elseif i == grid.Nx+1 && j == grid.Ny+1 | ||
return - Δy_qᶜᶠᶜ(i-1, j, k, grid, v) - Δx_qᶠᶜᶜ(i, j, k, grid, u) + Δx_qᶠᶜᶜ(i, j-1, k, grid, u) | ||
|
||
# Not a corner | ||
""" | ||
#= | ||
@inline Γᶠᶠᶜ(i, j, k, grid::OrthogonalSphericalShellGrid, u, v) = | ||
ifelse(on_south_west_corner(i, j, grid) | on_north_west_corner(i, j, grid), | ||
Δy_qᶜᶠᶜ(i, j, k, grid, v) - Δx_qᶠᶜᶜ(i, j, k, grid, u) + Δx_qᶠᶜᶜ(i, j-1, k, grid, u), | ||
ifelse(on_south_east_corner(i, j, grid) | on_north_east_corner(i, j, grid), | ||
- Δy_qᶜᶠᶜ(i-1, j, k, grid, v) - Δx_qᶠᶜᶜ(i, j, k, grid, u) + Δx_qᶠᶜᶜ(i, j-1, k, grid, u), | ||
δxᶠᶜᶜ(i, j, k, grid, Δy_qᶜᶠᶜ, v) - δyᶜᶠᶜ(i, j, k, grid, Δx_qᶠᶜᶜ, u))) | ||
=# | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this old/deprecated code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I will delete it. |
||
function Γᶠᶠᶜ(i, j, k, grid::OrthogonalSphericalShellGrid, u, v) | ||
Hx, Hy = grid.Hx, grid.Hy | ||
if i == 1 - Hx || j == 1 - Hy | ||
Γ = NaN | ||
elseif on_south_west_corner(i, j, grid) || on_north_west_corner(i, j, grid) | ||
Γ = Δy_qᶜᶠᶜ(i, j, k, grid, v) - Δx_qᶠᶜᶜ(i, j, k, grid, u) + Δx_qᶠᶜᶜ(i, j-1, k, grid, u) | ||
elseif on_south_east_corner(i, j, grid) || on_north_east_corner(i, j, grid) | ||
Γ = - Δy_qᶜᶠᶜ(i-1, j, k, grid, v) + Δx_qᶠᶜᶜ(i, j-1, k, grid, u) - Δx_qᶠᶜᶜ(i, j, k, grid, u) | ||
else | ||
return δxᶠᵃᵃ(i, j, k, grid, Δy_qᶜᶠᶜ, v) - δyᵃᶠᵃ(i, j, k, grid, Δx_qᶠᶜᶜ, u) | ||
Γ = δxᶠᶠᶜ(i, j, k, grid, Δy_qᶜᶠᶜ, v) - δyᶠᶠᶜ(i, j, k, grid, Δx_qᶠᶜᶜ, u) | ||
end | ||
end | ||
return Γ | ||
end | ||
navidcy marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
this reads like a hack..
also, what's "ssh" mentioned in the comment?
what if
size(data)[2] == 1
... then nothing needs to happen?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.
Yes, it is a temporary hack. I have outlined the issue arising in the absence of this hack in issue #3572 and created PR #3573 to resolve it. In the comment,
ssh
refers to fields like ssh defined on thexy
plane, for which the parent array takes the z-halo into consideration even though it does not exist. In case of a field like the meridional average of a scalar quantity which is defined on thexz
plane, the same issue arises without an equivalent hack.