From 0006c99b53adda023454c33a345e850b1d543aeb Mon Sep 17 00:00:00 2001 From: "Adrian K. Turner" Date: Fri, 3 Mar 2023 10:11:08 -0600 Subject: [PATCH] Removed confusing warning error messages from forcing Added framework function to check if pool exists In forcing framework check for input pool before accessing to avoid confusing error messages --- .../src/framework/mpas_forcing.F | 6 +++- .../src/framework/mpas_pool_routines.F | 34 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/components/mpas-framework/src/framework/mpas_forcing.F b/components/mpas-framework/src/framework/mpas_forcing.F index d02894de7963..950b103604c7 100644 --- a/components/mpas-framework/src/framework/mpas_forcing.F +++ b/components/mpas-framework/src/framework/mpas_forcing.F @@ -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. diff --git a/components/mpas-framework/src/framework/mpas_pool_routines.F b/components/mpas-framework/src/framework/mpas_pool_routines.F index 9c991cd7c6e9..9611129c8eae 100644 --- a/components/mpas-framework/src/framework/mpas_pool_routines.F +++ b/components/mpas-framework/src/framework/mpas_pool_routines.F @@ -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 !