ut_ReGridding Program

Uses

  • program~~ut_regridding~~UsesGraph program~ut_regridding ut_ReGridding module~bundletestsupport BundleTestSupport program~ut_regridding->module~bundletestsupport ESMF ESMF module~bundletestsupport->ESMF module~esmfl_mod ESMFL_MOD module~bundletestsupport->module~esmfl_mod module~mapl_applicationsupport MAPL_ApplicationSupport module~bundletestsupport->module~mapl_applicationsupport module~mapl_basemod MAPL_BaseMod module~bundletestsupport->module~mapl_basemod module~mapl_commsmod MAPL_CommsMod module~bundletestsupport->module~mapl_commsmod module~mapl_esmffieldbundleread MAPL_ESMFFieldBundleRead module~bundletestsupport->module~mapl_esmffieldbundleread module~mapl_esmffieldbundlewrite MAPL_ESMFFieldBundleWrite module~bundletestsupport->module~mapl_esmffieldbundlewrite module~mapl_exceptionhandling MAPL_ExceptionHandling module~bundletestsupport->module~mapl_exceptionhandling module~mapl_filemetadatautilsmod MAPL_FileMetadataUtilsMod module~bundletestsupport->module~mapl_filemetadatautilsmod module~mapl_gridmanagermod MAPL_GridManagerMod module~bundletestsupport->module~mapl_gridmanagermod module~mapl_memutilsmod MAPL_MemUtilsMod module~bundletestsupport->module~mapl_memutilsmod module~mapl_profiler mapl_Profiler module~bundletestsupport->module~mapl_profiler module~mapl_servermanager MAPL_ServerManager module~bundletestsupport->module~mapl_servermanager module~mapl_shmemmod MAPL_ShmemMod module~bundletestsupport->module~mapl_shmemmod module~pfio pFIO module~bundletestsupport->module~pfio mpi mpi module~bundletestsupport->mpi

Calls

program~~ut_regridding~~CallsGraph program~ut_regridding ut_ReGridding ESMF_AttributeSet ESMF_AttributeSet program~ut_regridding->ESMF_AttributeSet ESMF_CalendarSetDefault ESMF_CalendarSetDefault program~ut_regridding->ESMF_CalendarSetDefault ESMF_ClockCreate ESMF_ClockCreate program~ut_regridding->ESMF_ClockCreate ESMF_Finalize ESMF_Finalize program~ut_regridding->ESMF_Finalize ESMF_Initialize ESMF_Initialize program~ut_regridding->ESMF_Initialize ESMF_TimeIntervalSet ESMF_TimeIntervalSet program~ut_regridding->ESMF_TimeIntervalSet ESMF_TimeSet ESMF_TimeSet program~ut_regridding->ESMF_TimeSet ESMF_VMGet ESMF_VMGet program~ut_regridding->ESMF_VMGet esmf_fieldbundlecreate esmf_fieldbundlecreate program~ut_regridding->esmf_fieldbundlecreate esmf_fieldbundleset esmf_fieldbundleset program~ut_regridding->esmf_fieldbundleset esmf_fieldcreate esmf_fieldcreate program~ut_regridding->esmf_fieldcreate esmf_fieldget esmf_fieldget program~ut_regridding->esmf_fieldget interface~mapl_fieldbundleadd MAPL_FieldBundleAdd program~ut_regridding->interface~mapl_fieldbundleadd interface~mapl_getnodeinfo MAPL_GetNodeInfo program~ut_regridding->interface~mapl_getnodeinfo none~create_from_bundle FieldBundleWriter%create_from_bundle program~ut_regridding->none~create_from_bundle none~finalize~5 ServerManager%finalize program~ut_regridding->none~finalize~5 none~initialize~6 ServerManager%initialize program~ut_regridding->none~initialize~6 none~make_grid~4 GridManager%make_grid program~ut_regridding->none~make_grid~4 none~write_to_file FieldBundleWriter%write_to_file program~ut_regridding->none~write_to_file proc~compare_bundle compare_bundle program~ut_regridding->proc~compare_bundle proc~create_cf~2 create_cf program~ut_regridding->proc~create_cf~2 proc~mapl_abort MAPL_abort program~ut_regridding->proc~mapl_abort proc~mapl_finalize MAPL_Finalize program~ut_regridding->proc~mapl_finalize proc~mapl_initialize MAPL_Initialize program~ut_regridding->proc~mapl_initialize proc~mapl_read_bundle MAPL_read_bundle program~ut_regridding->proc~mapl_read_bundle proc~mapl_verify MAPL_Verify program~ut_regridding->proc~mapl_verify proc~unpackgridname~2 UnpackGridName program~ut_regridding->proc~unpackgridname~2

Variables

Type Attributes Name Initial
character(len=2) :: dateline_new
character(len=2) :: pole_new
character(len=ESMF_MAXPATHLEN) :: astr
character(len=ESMF_MAXPATHLEN) :: str
character(len=ESMF_MAXSTR) :: filename
character(len=ESMF_MAXSTR) :: gridname
integer :: IM_World_new
integer :: JM_World_new
integer :: Nx
integer :: Ny
integer :: i
integer :: lm_world
integer :: myPET
integer :: nPET
integer :: nargs
integer :: status
real :: cs_stretch_param(3)
real, pointer :: ptr2d(:,:)
real, pointer :: ptr3d(:,:,:)
type(ESMF_Clock) :: clock
type(ESMF_Config) :: cfoutput
type(ESMF_Field) :: field
type(ESMF_Grid) :: grid_new
type(ESMF_Time) :: time
type(ESMF_TimeInterval) :: timeInterval
type(ESMF_VM) :: vm
type(ESMF_FieldBundle) :: bundle
type(ESMF_FieldBundle) :: bundle_new
type(FieldBundleWriter) :: newWriter
type(ServerManager) :: io_server

Source Code

    program ut_ReGridding

       use BundleTestSupport
       implicit none

!CONTAINS

!  Basic ESMF objects being used in this example
!  ---------------------------------------------
   type(ESMF_Grid)     :: grid_new
   type(ESMF_VM)       :: vm             ! ESMF Virtual Machine

!  Basic information about the parallel environment
!         PET = Persistent Execution Threads
!  In the current implementation, a PET is equivalent
!  to an MPI process
!  ------------------------------------------------
   integer :: myPET   ! The local PET number
   integer :: nPET    ! The total number of PETs you are running on

   integer :: status
   integer :: Nx,Ny,nargs
   integer :: IM_World_new, JM_World_new, lm_world

   type(ESMF_FieldBundle) :: bundle,bundle_new
   type(ESMF_Field) :: field
   type(ESMF_Time) :: time
   type(ESMF_TimeInterval) :: timeInterval
   type(ESMF_Clock) :: clock

   character(len=ESMF_MAXSTR) :: filename

   integer :: i

   character(len=2) :: pole_new,dateline_new
   character(len=ESMF_MAXSTR) :: gridname
   character(len=ESMF_MAXPATHLEN) :: str,astr
   type(ESMF_CONFIG) :: cfoutput

   type(FieldBundleWriter) :: newWriter
   type(ServerManager) :: io_server
   real, pointer :: ptr2d(:,:),ptr3d(:,:,:)
   real :: cs_stretch_param(3)

!   Initialize the ESMF. For performance reasons, it is important
!    to turn OFF ESMF's automatic logging feature
!   -------------------------------------------------------------
    call ESMF_Initialize (LogKindFlag=ESMF_LOGKIND_NONE, vm=vm, _RC)
    call ESMF_VMGet(vm, localPET=myPET, petCount=nPet, _RC)
    call MAPL_Initialize(_RC)

    call io_server%initialize(mpi_comm_world)

    nx=1
    ny=6
    cs_stretch_param=cs_stretch_uninit
    nargs = command_argument_count()
    do i=1,nargs
      call get_command_argument(i,str)
      select case(trim(str))
      case('-ogrid')
         call get_command_argument(i+1,Gridname)
      case('-nx')
         call get_command_argument(i+1,astr)
         read(astr,*)nx
      case('-ny')
         call get_command_argument(i+1,astr)
         read(astr,*)ny
      case('-o')
         call get_command_argument(i+1,filename)
      end select
    enddo

    call MAPL_GetNodeInfo (comm=MPI_COMM_WORLD, _RC)

    call ESMF_CalendarSetDefault ( ESMF_CALKIND_GREGORIAN, _RC )

    call ESMF_TimeSet(time, yy=2000, mm=3, dd=15,  h=21,  m=0, s=0,_RC)
    call ESMF_TimeIntervalSet( TimeInterval, h=6, m=0, s=0, _RC )
    Clock = ESMF_ClockCreate ( name="Eric", timeStep=TimeInterval, &
                               startTime=time, _RC )

    call UnpackGridName(Gridname,im_world_new,jm_world_new,dateline_new,pole_new)

    lm_world=3
    cfoutput = create_cf(trim(gridname),im_world_new,jm_world_new,nx,ny,lm_world,cs_stretch_param,_RC)
    grid_new=grid_manager%make_grid(cfoutput,prefix=trim(gridname)//".",_RC)
    bundle=ESMF_FieldBundleCreate(name="cfio_bundle",_RC)
    call ESMF_FieldBundleSet(bundle,grid=grid_new,_RC)
    bundle_new=ESMF_FieldBundleCreate(name="cfio_bundle",_RC)
    call ESMF_FieldBundleSet(bundle_new,grid=grid_new,_RC)

    field=ESMF_FieldCreate(grid=grid_new,typekind=ESMF_TYPEKIND_R4,name="f2d",_RC)
    call ESMF_AttributeSet(FIELD,'LONG_NAME','what_am_i',_RC)
    call ESMF_AttributeSet(FIELD,'UNITS','NA',_RC)
    call ESMF_AttributeSet(FIELD,'DIMS',MAPL_DimsHorzOnly,_RC)
    call ESMF_AttributeSet(FIELD,'VLOCATION',MAPL_VLocationNone,_RC)
    call ESMF_FieldGet(field,farrayPtr=ptr2d,_RC)
    ptr2d=17.0
    call MAPL_FieldBundleAdd(bundle,field,_RC)

    field=ESMF_FieldCreate(grid=grid_new,typekind=ESMF_TYPEKIND_R4,name="f3d", &
      ungriddedLBound=[1],ungriddedUBound=[lm_world],_RC)
    call ESMF_AttributeSet(FIELD,'LONG_NAME','what_am_i',_RC)
    call ESMF_AttributeSet(FIELD,'UNITS','NA',_RC)
    call ESMF_AttributeSet(FIELD,'DIMS',MAPL_DimsHorzVert,_RC)
    call ESMF_AttributeSet(FIELD,'VLOCATION',MAPL_VLocationCenter,_RC)
    call ESMF_FieldGet(field,farrayPtr=ptr3d,_RC)
    ptr3d=17.0
    call MAPL_FieldBundleAdd(bundle,field,_RC)


    call newWriter%create_from_bundle(bundle,clock,filename,_RC)
    call newWriter%write_to_file(_RC)
    call MAPL_Read_bundle(bundle_new,trim(filename),time=time,_RC)

    call Compare_Bundle(bundle,bundle_new,1.0e6,_RC)

    call io_server%finalize()
    call MAPL_Finalize(_RC)
    call ESMF_Finalize(_RC)

    end program ut_ReGridding