test_xgrid_w_ngon_mesh Subroutine

subroutine test_xgrid_w_ngon_mesh(rc)

Arguments

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

Source Code

  subroutine test_xgrid_w_ngon_mesh(rc)
    integer, intent(out) :: rc
    integer              :: localrc, i, npet
    type(ESMF_XGrid)     :: xgrid
    type(ESMF_Mesh)      :: mesh_ngon, mesh_qt 
    type(ESMF_VM)        :: vm
    real(ESMF_KIND_R8)   :: xgrid_area(12), B_area(2,2)

    rc = ESMF_SUCCESS
    localrc = ESMF_SUCCESS

    call ESMF_VMGetCurrent(vm=vm, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    call ESMF_VMGet(vm, petcount=npet, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! Create ngon mesh
    call createTestMeshPH(mesh_ngon, localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! Create mesh containing quads and triangles
    call CreateTestMesh2x2_1(mesh_qt, localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    
    ! Create XGrid from meshes
    xgrid = ESMF_XGridCreate(sideAMesh=(/mesh_ngon/), &
                             sideBMesh=(/mesh_qt/), &
                             storeOverlay = .true., &
                             rc=localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! Test flux exchange through xgrid
    call flux_exchange_sph_mesh(xgrid, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! Get rid of meshes
    call ESMF_MeshDestroy(mesh_ngon, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    call ESMF_MeshDestroy(mesh_qt, rc=localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return
    
  end subroutine test_xgrid_w_ngon_mesh