10 use diag_manager_mod,
only : register_static_field_fms=>register_static_field
12 implicit none ;
private
14 #include <MOM_memory.h>
16 public register_obsolete_diagnostics
22 subroutine register_obsolete_diagnostics(param_file, diag)
26 #include "version_variable.h"
28 character(len=40) :: mdl =
"MOM_obsolete_diagnostics"
29 logical :: foundentry, causefatal
33 call get_param(param_file, mdl,
"OBSOLETE_DIAGNOSTIC_IS_FATAL", causefatal, &
34 "If an obsolete diagnostic variable appears in the diag_table, "// &
35 "cause a FATAL error rather than issue a WARNING.", default=.true.)
39 if (found_in_diagtable(diag,
'Net_Heat',
'net_heat_surface or net_heat_coupler')) foundentry = .true.
40 if (found_in_diagtable(diag,
'PmE',
'PRCmE')) foundentry = .true.
41 if (found_in_diagtable(diag,
'froz_precip',
'fprec')) foundentry = .true.
42 if (found_in_diagtable(diag,
'liq_precip',
'lprec')) foundentry = .true.
43 if (found_in_diagtable(diag,
'virt_precip',
'vprec')) foundentry = .true.
44 if (found_in_diagtable(diag,
'froz_runoff',
'frunoff')) foundentry = .true.
45 if (found_in_diagtable(diag,
'liq_runoff',
'lrunoff')) foundentry = .true.
46 if (found_in_diagtable(diag,
'calving_heat_content',
'heat_content_frunoff')) foundentry = .true.
47 if (found_in_diagtable(diag,
'precip_heat_content',
'heat_content_lprec')) foundentry = .true.
48 if (found_in_diagtable(diag,
'evap_heat_content',
'heat_content_massout')) foundentry = .true.
49 if (found_in_diagtable(diag,
'runoff_heat_content',
'heat_content_lrunoff')) foundentry = .true.
50 if (found_in_diagtable(diag,
'latent_fprec')) foundentry = .true.
51 if (found_in_diagtable(diag,
'latent_calve')) foundentry = .true.
52 if (found_in_diagtable(diag,
'heat_rest',
'heat_restore')) foundentry = .true.
53 if (found_in_diagtable(diag,
'KPP_dTdt',
'KPP_NLT_dTdt')) foundentry = .true.
54 if (found_in_diagtable(diag,
'KPP_dSdt',
'KPP_NLT_dSdt')) foundentry = .true.
56 if (causefatal) then; errtype = fatal
57 else ; errtype = warning ;
endif
58 if (foundentry .and. is_root_pe()) &
59 call mom_error(errtype,
'MOM_obsolete_diagnostics: '//&
60 'Obsolete diagnostics found in diag_table')
62 end subroutine register_obsolete_diagnostics
66 logical function found_in_diagtable(diag, varName, newVarName)
68 character(len=*),
intent(in) :: varname
69 character(len=*),
optional,
intent(in) :: newvarname
75 handle = register_static_field_fms(
'ocean_model', varname, &
76 diag%axesT1%handles,
'Obsolete parameter',
'N/A')
78 found_in_diagtable = (handle>0)
80 if (handle>0 .and. is_root_pe())
then
81 if (
present(newvarname))
then
82 call mom_error(warning,
'MOM_obsolete_params: '// &
83 'diag_table entry "'//trim(varname)//
'" found. Use '// &
84 '"'//trim(newvarname)//
'" instead.' )
86 call mom_error(warning,
'MOM_obsolete_params: '// &
87 'diag_table entry "'//trim(varname)//
'" is obsolete.' )
91 end function found_in_diagtable