cell_center2 Subroutine

private subroutine cell_center2(q11, q12, q21, q22, q31, q32, q41, q42, e2)

Arguments

Type IntentOptional Attributes Name
real(kind=ESMF_KIND_R8), intent(in) :: q11
real(kind=ESMF_KIND_R8), intent(in) :: q12
real(kind=ESMF_KIND_R8), intent(in) :: q21
real(kind=ESMF_KIND_R8), intent(in) :: q22
real(kind=ESMF_KIND_R8), intent(in) :: q31
real(kind=ESMF_KIND_R8), intent(in) :: q32
real(kind=ESMF_KIND_R8), intent(in) :: q41
real(kind=ESMF_KIND_R8), intent(in) :: q42
real(kind=ESMF_KIND_R8), intent(out) :: e2(2)

Source Code

 subroutine cell_center2(q11, q12, q21, q22, q31, q32, q41, q42, e2)
      real(ESMF_KIND_R8) , intent(in)  :: q11, q12, q21, q22, q31, q32, q41, q42
      real(ESMF_KIND_R8) , intent(out) :: e2(2)
! Local
      real(ESMF_KIND_R8) p1(3), p2(3), p3(3), p4(3)
      real(ESMF_KIND_R8) ec(3)
      real(ESMF_KIND_R8) dd
      integer k
      
      call latlon2xyz2(q11, q12, p1)
      call latlon2xyz2(q21, q22, p2)
      call latlon2xyz2(q31, q32, p3)
      call latlon2xyz2(q41, q42, p4)

      do k=1,3
         ec(k) = p1(k) + p2(k) + p3(k) + p4(k)
      enddo
      dd = sqrt( ec(1)**2 + ec(2)**2 + ec(3)**2 )

      do k=1,3
         ec(k) = ec(k) / dd
      enddo

      call cart_to_latlon(1, ec, e2(1), e2(2))

 end subroutine cell_center2