test_1_width_DE_GtoM Subroutine

subroutine test_1_width_DE_GtoM(correct, rc)

Arguments

Type IntentOptional Attributes Name
logical :: correct
integer :: rc

Source Code

subroutine test_1_width_DE_GtoM(correct, rc)
  logical :: correct
  integer :: rc

  type(ESMF_Grid) :: grid
  type(ESMF_Mesh) :: mesh
  type(ESMF_VM) :: vm
  integer :: localPet, petCount

  ! get global VM
  call ESMF_VMGetGlobal(vm, rc=rc)
  if (rc /= ESMF_SUCCESS) return
  call ESMF_VMGet(vm, localPet=localPet, petCount=petCount, rc=rc)
  if (rc /= ESMF_SUCCESS) return

  ! Init correct
  correct=.true.

  ! Create Grid
  grid=ESMF_GridCreateNoPeriDimUfrm( &
!       maxIndex=(/6,6/), &
       maxIndex=(/3,3/), &
       minCornerCoord=(/0.0_ESMF_KIND_R8,0.0_ESMF_KIND_R8/), &
       maxCornerCoord=(/10.0_ESMF_KIND_R8,10.0_ESMF_KIND_R8/), &
!        regDecomp=(/4,1/), & ! Gives a couple of 1 width DEs (this works)
!       regDecomp=(/8,1/), & ! Gives a couple of 0 width and the rest 1 (now works)
       regDecomp=(/4,1/), & ! Gives one 0 width and the rest 1 (now works)
       staggerLocList=(/ESMF_STAGGERLOC_CENTER, ESMF_STAGGERLOC_CORNER/), &
       coordSys=ESMF_COORDSYS_CART, &
       rc=localrc)
  if (localrc /=ESMF_SUCCESS) then
    rc=ESMF_FAILURE
    return
  endif

   ! Create Mesh structure in 1 step
   mesh=ESMF_MeshCreate(grid, rc=localrc)
   if (localrc /=ESMF_SUCCESS) then
      rc=ESMF_FAILURE
      return
   endif
#if 0
   ! Output Mesh for debugging
   call ESMF_MeshWrite(mesh,"mesh_1de_gtom",rc=localrc)
   if (localrc /=ESMF_SUCCESS) then
      rc=ESMF_FAILURE
      return
   endif
#endif

   ! Get rid of Grid
   call ESMF_GridDestroy(grid, rc=localrc)
   if (localrc /=ESMF_SUCCESS) then
      rc=ESMF_FAILURE
      return
   endif

   ! Get rid of Mesh
   call ESMF_MeshDestroy(mesh, rc=localrc)
   if (localrc /=ESMF_SUCCESS) then
      rc=ESMF_FAILURE
      return
   endif

   ! Return success
   rc=ESMF_SUCCESS

end subroutine test_1_width_DE_GtoM