user_init Subroutine

public subroutine user_init(comp, importState, exportState, clock, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_CplComp) :: comp
type(ESMF_State) :: importState
type(ESMF_State) :: exportState
type(ESMF_Clock) :: clock
integer :: rc

Source Code

    subroutine user_init(comp, importState, exportState, clock, rc)
      type(ESMF_CplComp) :: comp
      type(ESMF_State) :: importState, exportState
      type(ESMF_Clock) :: clock
      integer :: rc

      ! Local variables
      integer :: itemcount
      type(ESMF_Field) :: humidity1, humidity2
      type(ESMF_VM) :: vm


      print *, "User Coupler Init starting"

      call ESMF_StateGet(importState, itemcount=itemcount, rc=rc)
      print *, "Import State contains ", itemcount, " items."
       
      ! Get input data
      call ESMF_StateGetField(importState, "humidity", humidity1, rc=rc)
      ! call ESMF_FieldPrint(humidity1, rc=rc)

      ! Get location of output data
      call ESMF_StateGetField(exportState, "humidity", humidity2, rc=rc)
      ! call ESMF_FieldPrint(humidity2, rc=rc)

      ! Get VM from coupler component
      call ESMF_CplCompGet(comp, vm=vm, rc=rc)

      ! These are fields on different IGrids - call RegridStore to set
      ! up the precomputed Regrid communication calls.

      call ESMF_FieldRegridStore(humidity1, humidity2, vm, &
                                 routehandle, &
                                 regridmethod=ESMF_REGRIDMETHOD_BILINEAR, &
                                 rc=rc)


      print *, "User Coupler Init returning"
   
      rc = ESMF_SUCCESS

    end subroutine user_init