Skip to content

Commit

Permalink
Add pre-transposed lfric rotations
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-jonasganderton committed Jan 23, 2025
1 parent ca27678 commit 295bc88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/atlas/grid/detail/grid/CubedSphere2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ PointXYZ CubedSphere2::tangent_to_xyz_coord(const PointXY& tan_coord, idx_t tile

tan_point << tan_coord[0], tan_coord[1], 1;

xyz = lfric_rotations_[tile].transpose() * tan_point;
xyz = lfric_rotations_transposed_[tile] * tan_point;
xyz.normalize();

return {xyz(0), xyz(1), xyz(2)};
Expand Down
9 changes: 9 additions & 0 deletions src/atlas/grid/detail/grid/CubedSphere2.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ class CubedSphere2 : public Grid {
Matrix({{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}})
};

std::array<Matrix, 6> lfric_rotations_transposed_ = {
Matrix({{0, 0, 1}, {1, 0, 0}, {0, -1, 0}}),
Matrix({{-1, 0, 0}, {0, 0, 1}, {0, -1, 0}}),
Matrix({{0, 0, -1}, {-1, 0, 0}, {0, -1, 0}}),
Matrix({{1, 0, 0}, {0, 0, -1}, {0, -1, 0}}),
Matrix({{-1, 0, 0}, {0, 1, 0}, {0, 0, 1}}),
Matrix({{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}})
};

};

} // namespace grid
Expand Down

0 comments on commit 295bc88

Please sign in to comment.