subroutine land_run(comp, importState, exportState, clock, rc)
type(ESMF_GridComp) :: comp
type(ESMF_State) :: importState, exportState
type(ESMF_Clock) :: clock
integer, intent(out) :: rc
! Local variables
real(ESMF_KIND_R8) :: pi, kx, ky
type(ESMF_Field) :: field
real(ESMF_KIND_R8), pointer :: farrayPtr(:,:) ! matching F90 array pointer
integer :: i, j, elb(2), eub(2)
! Initialize return code
rc = ESMF_SUCCESS
print *, "Land Run starting"
pi = 3.14159d0
! Get the source Field from the export State
call ESMF_StateGet(exportState, "F_lnd", field, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
! Gain access to actual data via F90 array pointer
call ESMF_FieldGet(field, localDe=0, farrayPtr=farrayPtr, &
exclusiveLBound=elb, exclusiveUBound=eub, rc=rc)
if (rc/=ESMF_SUCCESS) return ! bail out
! Fill source Field with data
kx = 2.*pi/(eub(1)-elb(1))
ky = 2.*pi/(eub(2)-elb(2))
do i = elb(1), eub(1)
do j = elb(2), eub(2)
farrayPtr(i,j) = cos(kx*i)*sin(ky*j)
enddo
enddo
print *, "Land Run returning"
end subroutine land_run