supergrid_angle_dx_from_geography Function

public 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.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: sg_x(:,:)

Node longitude (degrees), (nxp, nyp).

real(kind=wp), intent(in) :: sg_y(:,:)

Node latitude (degrees), (nxp, nyp).

Return Value real(kind=wp), (size(sg_x,1),size(sg_x,2))


Called by

proc~~supergrid_angle_dx_from_geography~~CalledByGraph proc~supergrid_angle_dx_from_geography supergrid_angle_dx_from_geography proc~metrics_fill_from_supergrid metrics_fill_from_supergrid proc~metrics_fill_from_supergrid->proc~supergrid_angle_dx_from_geography proc~metrics_fill_tripolar_whole metrics_fill_tripolar_whole proc~metrics_fill_tripolar_whole->proc~supergrid_angle_dx_from_geography proc~configure_ocean_metrics configure_ocean_metrics proc~configure_ocean_metrics->proc~metrics_fill_from_supergrid proc~metrics_fill_tripolar metrics_fill_tripolar proc~configure_ocean_metrics->proc~metrics_fill_tripolar proc~metrics_fill_tripolar->proc~metrics_fill_tripolar_whole proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_metrics proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: dlat
real(kind=wp), private :: dlon
integer, private :: m
integer, private :: n

Source Code

   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