← back to index

src/diagnostics/MOM_obsolete_diagnostics.F90

portedportable, not yet portedexecuted, not portableexecutable, not hit by this run

1! This file is part of MOM6, the Modular Ocean Model version 6.
2! See the LICENSE file for licensing information.
3! SPDX-License-Identifier: Apache-2.0
4
5!> Provides a mechanism for recording diagnostic variables that are no longer
6!! valid, along with their replacement name if appropriate.
7module MOM_obsolete_diagnostics
8
9use MOM_diag_mediator, only : diag_ctrl, found_in_diagtable
10use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe
11use MOM_file_parser, only : param_file_type, log_version, get_param
12
13implicit none ; private
14
15#include <MOM_memory.h>
16
17public register_obsolete_diagnostics
18
19contains
20
21!> Scan through the diag_table searching for obsolete parameters and issue informational
22!! messages and optionallly a FATAL error.
231subroutine register_obsolete_diagnostics(param_file, diag)
24 type(param_file_type), intent(in) :: param_file !< The parameter file handle.
25 type(diag_ctrl), intent(in) :: diag !< A structure used to control diagnostics.
26! This include declares and sets the variable "version".
27#include "version_variable.h"
28 ! Local variables
29 character(len=40) :: mdl = "MOM_obsolete_diagnostics" !< This module's name.
30 logical :: foundEntry, causeFatal
31 integer :: errType
32
331 call log_version(param_file, mdl, version)
34 call get_param(param_file, mdl, "OBSOLETE_DIAGNOSTIC_IS_FATAL", causeFatal, &
35 "If an obsolete diagnostic variable appears in the diag_table, "// &
361 "cause a FATAL error rather than issue a WARNING.", default=.true.)
37
381 foundEntry = .false.
39 ! Each obsolete entry, with replacement name is available.
401 if (diag_found(diag, 'Net_Heat', 'net_heat_surface or net_heat_coupler')) foundEntry = .true.
411 if (diag_found(diag, 'PmE', 'PRCmE')) foundEntry = .true.
421 if (diag_found(diag, 'froz_precip', 'fprec')) foundEntry = .true.
431 if (diag_found(diag, 'liq_precip', 'lprec')) foundEntry = .true.
441 if (diag_found(diag, 'virt_precip', 'vprec')) foundEntry = .true.
451 if (diag_found(diag, 'froz_runoff', 'frunoff')) foundEntry = .true.
461 if (diag_found(diag, 'liq_runoff', 'lrunoff')) foundEntry = .true.
471 if (diag_found(diag, 'calving_heat_content', 'heat_content_frunoff')) foundEntry = .true.
481 if (diag_found(diag, 'precip_heat_content', 'heat_content_lprec')) foundEntry = .true.
491 if (diag_found(diag, 'evap_heat_content', 'heat_content_massout')) foundEntry = .true.
501 if (diag_found(diag, 'runoff_heat_content', 'heat_content_lrunoff')) foundEntry = .true.
511 if (diag_found(diag, 'latent_fprec')) foundEntry = .true.
521 if (diag_found(diag, 'latent_calve')) foundEntry = .true.
531 if (diag_found(diag, 'heat_rest', 'heat_restore')) foundEntry = .true.
541 if (diag_found(diag, 'KPP_dTdt', 'KPP_NLT_dTdt')) foundEntry = .true.
551 if (diag_found(diag, 'KPP_dSdt', 'KPP_NLT_dSdt')) foundEntry = .true.
56
571 if (causeFatal) then ; errType = FATAL
580 else ; errType = WARNING ; endif
591 if (foundEntry .and. is_root_pe()) &
600 call MOM_error(errType, 'MOM_obsolete_diagnostics: Obsolete diagnostics found in diag_table.')
61
621end subroutine register_obsolete_diagnostics
63
64!> Determines whether an obsolete parameter appears in the diag_table.
6516logical function diag_found(diag, varName, newVarName)
66 type(diag_ctrl), intent(in) :: diag !< A structure used to control diagnostics.
67 character(len=*), intent(in) :: varName !< The obsolete diagnostic name
68 character(len=*), optional, intent(in) :: newVarName !< The valid name of this diagnostic
69
7032 diag_found = found_in_diagtable(diag, varName)
71
7216 if (diag_found .and. is_root_pe()) then
730 if (present(newVarName)) then
74 call MOM_error(WARNING, 'MOM_obsolete_params: '//'diag_table entry "'// &
750 trim(varName)//'" found. Use ''"'//trim(newVarName)//'" instead.' )
76 else
77 call MOM_error(WARNING, 'MOM_obsolete_params: '//'diag_table entry "'// &
780 trim(varName)//'" is obsolete.' )
79 endif
80 endif
81
8232end function diag_found
83
840end module MOM_obsolete_diagnostics