createSingleTileField Subroutine

subroutine createSingleTileField(rc)

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: rc

Source Code

  subroutine createSingleTileField(rc)
    ! Creates a single-tile field and associated field bundle for failure testing
    integer, intent(out) :: rc

    type(ESMF_ArraySpec) :: arraySpec

    !------------------------------------------------------------------------
    ! Set up a single-tile grid
    !------------------------------------------------------------------------

    gridSingleTile = ESMF_GridCreateNoPeriDimUfrm( &
         maxIndex = [4,4], &
         minCornerCoord = [0._ESMF_KIND_R8, 0._ESMF_KIND_R8], &
         maxCornerCoord = [4._ESMF_KIND_R8, 4._ESMF_KIND_R8], &
         staggerLocList = [ESMF_STAGGERLOC_CENTER], &
         rc = rc)
    if (rc /= ESMF_SUCCESS) return

    !------------------------------------------------------------------------
    ! Create a field on the single-tile grid and associated field bundle
    !------------------------------------------------------------------------

    call ESMF_ArraySpecSet(arraySpec, typekind=ESMF_TYPEKIND_R8, rank=2, rc=rc)
    if (rc /= ESMF_SUCCESS) return

    fieldSingleTile = ESMF_FieldCreate(gridSingleTile, arraySpec, name="fieldSingleTile", rc=rc)
    if (rc /= ESMF_SUCCESS) return
    call ESMF_FieldFill(fieldSingleTile, dataFillScheme='sincos', rc=rc)
    if (rc /= ESMF_SUCCESS) return

    fieldBundleMixedTileCounts = ESMF_FieldBundleCreate(name="fbmixed", rc=rc)
    if (rc /= ESMF_SUCCESS) return
    call ESMF_FieldBundleAdd(fieldBundleMixedTileCounts, [field1, fieldSingleTile], rc=rc)
    if (rc /= ESMF_SUCCESS) return

  end subroutine createSingleTileField