-
Notifications
You must be signed in to change notification settings - Fork 42
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
New cubed sphere 2 grid #245
base: develop
Are you sure you want to change the base?
New cubed sphere 2 grid #245
Conversation
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.
Looks good to see a much simpler CS grid! I've added some changes. It's mostly style related. I'm sure @wdeconinck can make some more comments/suggestions.
After this, we should probably plumb the grid into the grid builder.
@wdeconinck, what do you think?
|
||
// Get point between [-pi/4..pi/4] given index and number of points along edge | ||
// Applies offset to get from prime to dual mesh | ||
double CubedSphere2::index_to_curvilinear(idx_t index) const { |
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.
I think the intent is clearer if we define:
using PointAlphaBeta = Point2;
PointAlphaBeta CubedSphere2::ij_to_curvilinear_coord(idx_t i, idx_t j) {
const auto get_coord = [&](idx_t idx){
return M_PI / 2 * (-0.5 + (0.5 + idx) / N());
};
return {get_coord(i), get_coord(j)};
}
PointXY CubedSphere2::curvilinear_to_tangent_coord(const PointAlphaBeta& curvi_coord) {
return {std::tan(curvi_coord[0]), std::tan(curvi_coord[1])};
}
PointXYZ CubedSphere2::tangent_to_xyz_coord(const PointXY& tan_coord) {
/// Perform coordinate rotations...
}
Description
Initial implementation of a new cubed sphere grid.
@odlomax and @wdeconinck can both have a look over to recommend any changes - I expect this will have changed once everything else has also been implemented.
Using this implementation generates the following lonlat points - n=12, red=tile0, purple=tile5, darkest point of each colour is tij=0, lightest point is tij=143. This matches the sequence of the points in the LFRic cubed sphere.
Impact
Once everything else is also implemented, this makes the cubed sphere more maintainable.
Checklist