Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+Cleanup of MOM_diag_manager_infra interfaces #1316

Merged
merged 2 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 38 additions & 18 deletions src/diagnostics/MOM_obsolete_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,50 @@ subroutine register_obsolete_diagnostics(param_file, diag)

foundEntry = .false.
! Each obsolete entry, with replacement name is available.
if (found_in_diagtable(diag, 'Net_Heat', 'net_heat_surface or net_heat_coupler')) foundEntry = .true.
if (found_in_diagtable(diag, 'PmE', 'PRCmE')) foundEntry = .true.
if (found_in_diagtable(diag, 'froz_precip', 'fprec')) foundEntry = .true.
if (found_in_diagtable(diag, 'liq_precip', 'lprec')) foundEntry = .true.
if (found_in_diagtable(diag, 'virt_precip', 'vprec')) foundEntry = .true.
if (found_in_diagtable(diag, 'froz_runoff', 'frunoff')) foundEntry = .true.
if (found_in_diagtable(diag, 'liq_runoff', 'lrunoff')) foundEntry = .true.
if (found_in_diagtable(diag, 'calving_heat_content', 'heat_content_frunoff')) foundEntry = .true.
if (found_in_diagtable(diag, 'precip_heat_content', 'heat_content_lprec')) foundEntry = .true.
if (found_in_diagtable(diag, 'evap_heat_content', 'heat_content_massout')) foundEntry = .true.
if (found_in_diagtable(diag, 'runoff_heat_content', 'heat_content_lrunoff')) foundEntry = .true.
if (found_in_diagtable(diag, 'latent_fprec')) foundEntry = .true.
if (found_in_diagtable(diag, 'latent_calve')) foundEntry = .true.
if (found_in_diagtable(diag, 'heat_rest', 'heat_restore')) foundEntry = .true.
if (found_in_diagtable(diag, 'KPP_dTdt', 'KPP_NLT_dTdt')) foundEntry = .true.
if (found_in_diagtable(diag, 'KPP_dSdt', 'KPP_NLT_dSdt')) foundEntry = .true.
if (diag_found(diag, 'Net_Heat', 'net_heat_surface or net_heat_coupler')) foundEntry = .true.
if (diag_found(diag, 'PmE', 'PRCmE')) foundEntry = .true.
if (diag_found(diag, 'froz_precip', 'fprec')) foundEntry = .true.
if (diag_found(diag, 'liq_precip', 'lprec')) foundEntry = .true.
if (diag_found(diag, 'virt_precip', 'vprec')) foundEntry = .true.
if (diag_found(diag, 'froz_runoff', 'frunoff')) foundEntry = .true.
if (diag_found(diag, 'liq_runoff', 'lrunoff')) foundEntry = .true.
if (diag_found(diag, 'calving_heat_content', 'heat_content_frunoff')) foundEntry = .true.
if (diag_found(diag, 'precip_heat_content', 'heat_content_lprec')) foundEntry = .true.
if (diag_found(diag, 'evap_heat_content', 'heat_content_massout')) foundEntry = .true.
if (diag_found(diag, 'runoff_heat_content', 'heat_content_lrunoff')) foundEntry = .true.
if (diag_found(diag, 'latent_fprec')) foundEntry = .true.
if (diag_found(diag, 'latent_calve')) foundEntry = .true.
if (diag_found(diag, 'heat_rest', 'heat_restore')) foundEntry = .true.
if (diag_found(diag, 'KPP_dTdt', 'KPP_NLT_dTdt')) foundEntry = .true.
if (diag_found(diag, 'KPP_dSdt', 'KPP_NLT_dSdt')) foundEntry = .true.

if (causeFatal) then; errType = FATAL
else ; errType = WARNING ; endif
if (foundEntry .and. is_root_pe()) &
call MOM_error(errType, 'MOM_obsolete_diagnostics: '//&
'Obsolete diagnostics found in diag_table')
call MOM_error(errType, 'MOM_obsolete_diagnostics: Obsolete diagnostics found in diag_table.')

end subroutine register_obsolete_diagnostics

!> Determines whether an obsolete parameter appears in the diag_table.
logical function diag_found(diag, varName, newVarName)
type(diag_ctrl), intent(in) :: diag !< A structure used to control diagnostics.
character(len=*), intent(in) :: varName !< The obsolete diagnostic name
character(len=*), optional, intent(in) :: newVarName !< The valid name of this diagnostic
! Local
integer :: handle ! Integer handle returned from diag_manager

diag_found = found_in_diagtable(diag, varName)

if (diag_found .and. is_root_pe()) then
if (present(newVarName)) then
call MOM_error(WARNING, 'MOM_obsolete_params: '//'diag_table entry "'// &
trim(varName)//'" found. Use ''"'//trim(newVarName)//'" instead.' )
else
call MOM_error(WARNING, 'MOM_obsolete_params: '//'diag_table entry "'// &
trim(varName)//'" is obsolete.' )
endif
endif

end function diag_found

end module MOM_obsolete_diagnostics
Loading