test_get_coordinate_field_change_units_center Subroutine

public subroutine test_get_coordinate_field_change_units_center(this)

Arguments

Type IntentOptional Attributes Name
class(ESMF_TestMethod), intent(inout) :: this

Calls

proc~~test_get_coordinate_field_change_units_center~~CallsGraph proc~test_get_coordinate_field_change_units_center test_get_coordinate_field_change_units_center assert_that assert_that proc~test_get_coordinate_field_change_units_center->assert_that equal_to equal_to proc~test_get_coordinate_field_change_units_center->equal_to esmf_fieldget esmf_fieldget proc~test_get_coordinate_field_change_units_center->esmf_fieldget every_item every_item proc~test_get_coordinate_field_change_units_center->every_item initialize initialize proc~test_get_coordinate_field_change_units_center->initialize none~get_coordinate_field~2 ModelVerticalGrid%get_coordinate_field proc~test_get_coordinate_field_change_units_center->none~get_coordinate_field~2 none~get_export_couplers StateRegistry%get_export_couplers proc~test_get_coordinate_field_change_units_center->none~get_export_couplers none~of~139 ComponentDriverPtrVector%of proc~test_get_coordinate_field_change_units_center->none~of~139 proc~make_geom~3 make_geom proc~test_get_coordinate_field_change_units_center->proc~make_geom~3 proc~mapl_verify MAPL_Verify proc~test_get_coordinate_field_change_units_center->proc~mapl_verify proc~setup~6 setup proc~test_get_coordinate_field_change_units_center->proc~setup~6 run run proc~test_get_coordinate_field_change_units_center->run true true proc~test_get_coordinate_field_change_units_center->true

Source Code

   subroutine test_get_coordinate_field_change_units_center(this)
      class(ESMF_TestMethod), intent(inout) :: this
      type(ModelVerticalGrid) :: vgrid
      type(ESMF_Field) :: vcoord
      type(ESMF_Geom) :: geom
      integer :: status
      real(ESMF_KIND_R4), pointer :: a(:,:,:)
      type(ComponentDriverPtrVector) :: couplers
      type(ComponentDriverPtr) :: driver
      type(GriddedComponentDriver), pointer :: coupler
      integer :: i, rc

      call setup("PL", vgrid, _RC)
      geom = make_geom(_RC)

      call vgrid%get_coordinate_field( &
           vcoord, coupler, &
           standard_name="air_pressure", &
           geom=geom, &
           typekind=ESMF_TYPEKIND_R4, units="Pa", &
           vertical_dim_spec=VERTICAL_DIM_CENTER, &
           _RC)
      @assert_that(associated(coupler), is(true()))

      call r%allocate(_RC)

      call ESMF_FieldGet(vcoord, fArrayPtr=a, _RC)
      ! usually update is called on imports, but here we don't have an import handy,
      ! so we force updates on all export couplers in registry r.
      couplers = r%get_export_couplers()
      do i = 1, couplers%size()
         driver = couplers%of(i)
         call driver%ptr%initialize(_RC)
         call driver%ptr%run(phase_idx=GENERIC_COUPLER_UPDATE, _RC)
      end do
      @assert_that(shape(a), is(equal_to([IM, JM, LM])))
      @assert_that(a, every_item(is(equal_to(300.))))
      _UNUSED_DUMMY(this)
   end subroutine test_get_coordinate_field_change_units_center