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

Bug in the vector rotation operator #3744

Merged
merged 12 commits into from
Aug 29, 2024
Merged

Conversation

simone-silvestri
Copy link
Collaborator

@simone-silvestri simone-silvestri commented Aug 28, 2024

The meridional velocity had the wrong sign in the vector rotation operator for switching from extrinsic to intrinsic coordinates in an OrthogonalSphericalShellGrid.
The test was also poorly designed (my bad) and conspired to hide the bug. This PR should fix the rotation and update the test to make sure everything is correct.

@glwagner
Copy link
Member

We need more tests

@glwagner
Copy link
Member

Can we add a test that uses OrthogonalSphericalShellGrids?

u = XFaceField(grid)
v = YFaceField(grid)

# Purely zonal flow.
Copy link
Member

Choose a reason for hiding this comment

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

not for all grids right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right, it's in the extrinsic frame. I have changed the comment

@glwagner
Copy link
Member

Perhaps we don't have this, but can we rotate a LatitudeLongitudeGrid by a certain angle, and then test that the vectors are rotated exactly by that angle? This would provide a simple deterministic test. This could work for a very small grid on the equator, for example...

Copy link
Member

@glwagner glwagner left a comment

Choose a reason for hiding this comment

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

I see that the challenge of writing tests is that we don't have a good way of generating general grids...

@test all(sic_model.velocities.v.data[i, j, :] .≈ per_model[i, j].velocities.v.data[1, 1, :])
@test all(sic_model.tracers.c.data[i, j, :] .≈ per_model[i, j].tracers.c.data[1, 1, :])
end

Copy link
Member

Choose a reason for hiding this comment

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

was this sent to the wrong PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah this was meant to be in #3741. I have moved it there

@simone-silvestri simone-silvestri merged commit a7fffa2 into main Aug 29, 2024
46 checks passed
@simone-silvestri simone-silvestri deleted the ss/bugfix-intrinsic-vectors branch August 29, 2024 19:31
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