Skip to content

Commit

Permalink
Merge branch 'akturner/mpas-framework/forcing-error-messages' (PR #5498)
Browse files Browse the repository at this point in the history
Removed confusing warning error messages from forcing

Added framework function to check if pool exists. Then in forcing
framework check for input pool before accessing to avoid confusing
error messages

Fixes #5497

[BFB]
  • Loading branch information
jonbob committed Mar 22, 2023
2 parents a7b916b + 0006c99 commit 68760cd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/mpas-framework/src/framework/mpas_forcing.F
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,11 @@ subroutine setup_input_fields(&!{{{
lInputPoolCreated = .false.

nullify(forcingPoolInput)
call MPAS_pool_get_subpool(block % structs, trim(poolnameInput), forcingPoolInput)

if (MPAS_pool_exists(block % structs, trim(poolnameInput), forcingPoolInput)) then
call MPAS_pool_get_subpool(block % structs, trim(poolnameInput), forcingPoolInput)
endif

if (.not. associated(forcingPoolInput)) then
call MPAS_pool_create_pool(forcingPoolInput)
lInputPoolCreated = .true.
Expand Down
34 changes: 34 additions & 0 deletions components/mpas-framework/src/framework/mpas_pool_routines.F
Original file line number Diff line number Diff line change
Expand Up @@ -5376,6 +5376,40 @@ subroutine mpas_pool_get_subpool(inPool, key, subPool)!{{{
end subroutine mpas_pool_get_subpool!}}}


!-----------------------------------------------------------------------
! subroutine mpas_pool_exists
!
!> \brief MPAS Pool check subpool exists function
!> \author Adrian K. Turner
!> \date 03/03/2023
!> \details
!> This function returns whether a subpool named key exists within
!> inPool.
!
!-----------------------------------------------------------------------
function mpas_pool_exists(inPool, key, subPool) result(exists)!{{{

implicit none

type (mpas_pool_type), intent(in) :: inPool
character (len=*), intent(in) :: key
type (mpas_pool_type), pointer :: subPool

type (mpas_pool_data_type), pointer :: mem

logical :: exists

mem => pool_get_member(inPool, key, MPAS_POOL_SUBPOOL)

if (associated(mem)) then
exists = .true.
else
exists = .false.
end if

end function mpas_pool_exists!}}}


!-----------------------------------------------------------------------
! subroutine mpas_pool_add_package
!
Expand Down

0 comments on commit 68760cd

Please sign in to comment.