Grid rotation (DEGREES, counter-clockwise from true east — MOM6’s
angle_dx sense) at every T node (2i, 2j) of a supergrid, from
the node geography alone: the direction of the local +i axis is
the chord from the cell’s west-face node (2i-1, 2j) to its
east-face node (2i+1, 2j), projected onto a local east/north
plane (dx_east = dlon*cos(lat), dy_north = dlat). Other nodes
are left at zero (nothing reads them). Used where the mosaic has
no angle_dx and by the analytic tripolar generator.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | sg_x(:,:) |
Node longitude (degrees), |
||
| real(kind=wp), | intent(in) | :: | sg_y(:,:) |
Node latitude (degrees), |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | dlat | ||||
| real(kind=wp), | private | :: | dlon | ||||
| integer, | private | :: | m | ||||
| integer, | private | :: | n |
pure function supergrid_angle_dx_from_geography(sg_x, sg_y) result(angle_deg) !! Grid rotation (DEGREES, counter-clockwise from true east — MOM6's !! `angle_dx` sense) at every T node `(2i, 2j)` of a supergrid, from !! the node geography alone: the direction of the local +i axis is !! the chord from the cell's west-face node `(2i-1, 2j)` to its !! east-face node `(2i+1, 2j)`, projected onto a local east/north !! plane (`dx_east = dlon*cos(lat)`, `dy_north = dlat`). Other nodes !! are left at zero (nothing reads them). Used where the mosaic has !! no `angle_dx` and by the analytic tripolar generator. real(wp), intent(in) :: sg_x(:, :) !! Node longitude (degrees), `(nxp, nyp)`. real(wp), intent(in) :: sg_y(:, :) !! Node latitude (degrees), `(nxp, nyp)`. real(wp) :: angle_deg(size(sg_x, 1), size(sg_x, 2)) integer :: m, n real(wp) :: dlon, dlat angle_deg = 0.0_wp do n = 2, size(sg_x, 2) - 1, 2 do m = 2, size(sg_x, 1) - 1, 2 dlon = modulo(sg_x(m + 1, n) - sg_x(m - 1, n) + 180.0_wp, 360.0_wp) - 180.0_wp dlat = sg_y(m + 1, n) - sg_y(m - 1, n) angle_deg(m, n) = atan2(dlat, dlon*cos(sg_y(m, n)*DEG2RAD))/DEG2RAD end do end do end function supergrid_angle_dx_from_geography