Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ESMF_GridComp) | :: | comp | ||||
type(ESMF_State) | :: | importState | ||||
type(ESMF_State) | :: | exportState | ||||
type(ESMF_Clock) | :: | clock | ||||
integer, | intent(out) | :: | rc |
subroutine user_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 type(ESMF_Field) :: humidity type(ESMF_LocStream) :: locstream real(ESMF_KIND_R8), pointer :: lon(:),lat(:) real(ESMF_KIND_R8), pointer :: dstfptr(:) integer :: clb(1), cub(1), i rc = ESMF_SUCCESS print *, "User Comp2 Run starting" ! Get information from the component. call ESMF_StateGet(importState, "humidity", humidity, rc=rc) if(rc/=ESMF_SUCCESS) return ! Get locstream call ESMF_FieldGet(humidity, locstream=locstream, rc=rc) if(rc/=ESMF_SUCCESS) return ! Get coordinate memory call ESMF_LocStreamGetKey(locstream, & localDE=0, & keyName="ESMF:Lon", & farray=lon, & rc=rc) if (rc .ne. ESMF_SUCCESS) return ! Get Field memory call ESMF_FieldGet(humidity, localDe=0, farrayPtr=dstfptr, & computationalLBound=clb, computationalUBound=cub, & rc=rc) if (rc .ne. ESMF_SUCCESS) return ! Verify that the data in dstField(l) is correct. ! Before the regrid op, the dst Field contains all 0. do i = clb(1), cub(1) ! Check data depending on whether masked or not if ((lon(i) > 10.0) .and. (lon(i) < 20.0)) then ! Masked so should be 0.0 if(abs(dstfptr(i)) .gt. 1.0E-10) rc = ESMF_FAILURE else ! Not masked so should be analytic value if(abs(dstfptr(i) - lon(i)/360.0) .gt. 1.0E-10) rc = ESMF_FAILURE endif enddo print *, "User Comp2 Run returning" end subroutine user_run