Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use the correct function to compute the rotation angle#5677

Merged
simone-silvestri merged 3 commits into
mainfrom
ss/correct-rotation
Jun 11, 2026
Merged

Use the correct function to compute the rotation angle#5677
simone-silvestri merged 3 commits into
mainfrom
ss/correct-rotation

Conversation

@simone-silvestri

Copy link
Copy Markdown
Collaborator

atan(sin / cos) might change the sign of the cosine function, atan(sin, cos) retains the sign, MWE:

function test_signstrue)
    cosθ, sinθ = costrue), sintrue)        
    θ1 = atan(sinθ / cosθ)                         
    θ2 = atan(sinθ, cosθ)                         
    @info θtrue, θ1, θ2
end

returns

julia> test_signs(deg2rad(30))
[ Info: (0.5235987755982988, 0.5235987755982987, 0.5235987755982987)

julia> test_signs(deg2rad(170))
[ Info: (2.9670597283903604, -0.17453292519943292, 2.9670597283903604)

julia> test_signs(deg2rad(-135))
[ Info: (-2.356194490192345, 0.7853981633974484, -2.356194490192345)

@simone-silvestri simone-silvestri merged commit 52369bf into main Jun 11, 2026
81 of 84 checks passed
@simone-silvestri simone-silvestri deleted the ss/correct-rotation branch June 11, 2026 09:40
@navidcy

navidcy commented Jun 13, 2026

Copy link
Copy Markdown
Member

Did this had an effect on the tripolar seam issue?

@navidcy navidcy added the numerics 🧮 So things don't blow up and boil the lobsters alive label Jun 13, 2026
@simone-silvestri

Copy link
Copy Markdown
Collaborator Author

I think it did, it changes the values of the rotated components inside the north halos (all interior values were correct). But we do use rotation inside the halos if we use a prescribed atmosphere (we interpolate inside the halos instead of filling the halos). I saw some differences in an arctic sea ice simulation forced by a prescribed atmosphere that had some artifacts at the north pole (on a rotated latitude longitude grid, so no tripolar involved!!) which now are absent

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

Labels

numerics 🧮 So things don't blow up and boil the lobsters alive

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants