From e4d984a7ad66527c3508e28c8f64798b76740044 Mon Sep 17 00:00:00 2001 From: Robert Hallberg Date: Thu, 14 Jan 2021 12:47:53 -0500 Subject: [PATCH] +Created MOM_diag_manager to wrap diag_manager Moved MOM_diag_manager_wrapper.F90 to MOM_diag_manager.F90 (mostly for brevity) and added use statements and provided interfaces for all of the diag_manager_mod, diag_data_mod and diag_axis_mod routines that are used within the MOM6 code, with some renaming of interfaces to reflect their use within the MOM6 code. All answers are bitwise identical. --- src/diagnostics/MOM_obsolete_diagnostics.F90 | 4 +- ...nager_wrapper.F90 => MOM_diag_manager.F90} | 19 +++++++--- src/framework/MOM_diag_mediator.F90 | 38 +++++++------------ src/framework/MOM_diag_remap.F90 | 4 +- src/ice_shelf/MOM_ice_shelf_diag_mediator.F90 | 18 ++++----- 5 files changed, 39 insertions(+), 44 deletions(-) rename src/framework/{MOM_diag_manager_wrapper.F90 => MOM_diag_manager.F90} (88%) diff --git a/src/diagnostics/MOM_obsolete_diagnostics.F90 b/src/diagnostics/MOM_obsolete_diagnostics.F90 index e30749984d..bba8379bbb 100644 --- a/src/diagnostics/MOM_obsolete_diagnostics.F90 +++ b/src/diagnostics/MOM_obsolete_diagnostics.F90 @@ -4,10 +4,10 @@ module MOM_obsolete_diagnostics ! This file is part of MOM6. See LICENSE.md for the license. +use MOM_diag_manager, only : register_static_field_fms +use MOM_diag_mediator, only : diag_ctrl use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe use MOM_file_parser, only : param_file_type, log_version, get_param -use MOM_diag_mediator, only : diag_ctrl -use diag_manager_mod, only : register_static_field_fms=>register_static_field implicit none ; private diff --git a/src/framework/MOM_diag_manager_wrapper.F90 b/src/framework/MOM_diag_manager.F90 similarity index 88% rename from src/framework/MOM_diag_manager_wrapper.F90 rename to src/framework/MOM_diag_manager.F90 index 47dc701798..0c9f875bcd 100644 --- a/src/framework/MOM_diag_manager_wrapper.F90 +++ b/src/framework/MOM_diag_manager.F90 @@ -1,14 +1,23 @@ -!> A simple (very thin) wrapper for register_diag_field to avoid a compiler bug with PGI -module MOM_diag_manager_wrapper +!> A simple (very thin) wrapper for the FMS diag_manager routines, with some name changes +module MOM_diag_manager ! This file is part of MOM6. See LICENSE.md for the license. use MOM_time_manager, only : time_type +use diag_axis_mod, only : diag_axis_init, get_diag_axis_name, EAST, NORTH +use diag_data_mod, only : null_axis_id +use diag_manager_mod, only : diag_manager_init, diag_manager_end +use diag_manager_mod, only : send_data, diag_field_add_attribute, DIAG_FIELD_NOT_FOUND use diag_manager_mod, only : register_diag_field +use diag_manager_mod, only : register_static_field_fms=>register_static_field +use diag_manager_mod, only : get_diag_field_id_fms=>get_diag_field_id implicit none ; private -public register_diag_field_fms +public diag_manager_init, diag_manager_end +public diag_axis_init, get_diag_axis_name, EAST, NORTH, null_axis_id +public send_data, diag_field_add_attribute, DIAG_FIELD_NOT_FOUND +public register_diag_field_fms, register_static_field_fms, get_diag_field_id_fms !> A wrapper for register_diag_field_array() interface register_diag_field_fms @@ -85,11 +94,11 @@ integer function register_diag_field_scalar_fms(module_name, field_name, init_ti end function register_diag_field_scalar_fms -!> \namespace mom_diag_manager_wrapper +!> \namespace mom_diag_manager !! !! This module simply wraps register_diag_field() from FMS's diag_manager_mod. !! We used to be able to import register_diag_field and rename it to register_diag_field_fms !! with a simple "use, only : register_diag_field_fms => register_diag_field" but PGI 16.5 !! has a bug that refuses to compile this - earlier versions did work. -end module MOM_diag_manager_wrapper +end module MOM_diag_manager diff --git a/src/framework/MOM_diag_mediator.F90 b/src/framework/MOM_diag_mediator.F90 index fa4a4a2701..071585a951 100644 --- a/src/framework/MOM_diag_mediator.F90 +++ b/src/framework/MOM_diag_mediator.F90 @@ -9,37 +9,28 @@ module MOM_diag_mediator use MOM_coms, only : PE_here use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end use MOM_cpu_clock, only : CLOCK_MODULE, CLOCK_ROUTINE +use MOM_diag_manager, only : diag_manager_init, diag_manager_end +use MOM_diag_manager, only : diag_axis_init, get_diag_axis_name, null_axis_id +use MOM_diag_manager, only : send_data, diag_field_add_attribute, EAST, NORTH +use MOM_diag_manager, only : register_diag_field_fms, register_static_field_fms +use MOM_diag_manager, only : get_diag_field_id_fms, DIAG_FIELD_NOT_FOUND +use MOM_diag_remap, only : diag_remap_ctrl, diag_remap_update, diag_remap_calc_hmask +use MOM_diag_remap, only : diag_remap_init, diag_remap_end, diag_remap_do_remap +use MOM_diag_remap, only : vertically_reintegrate_diag_field, vertically_interpolate_diag_field +use MOM_diag_remap, only : horizontally_average_diag_field, diag_remap_get_axes_info +use MOM_diag_remap, only : diag_remap_configure_axes, diag_remap_axes_configured +use MOM_diag_remap, only : diag_remap_diag_registration_closed, diag_remap_set_active +use MOM_EOS, only : EOS_type use MOM_error_handler, only : MOM_error, FATAL, WARNING, is_root_pe, assert use MOM_file_parser, only : get_param, log_version, param_file_type use MOM_grid, only : ocean_grid_type -use MOM_io, only : slasher, vardesc, query_vardesc, mom_read_data +use MOM_io, only : slasher, vardesc, query_vardesc, MOM_read_data use MOM_io, only : get_filename_appendix use MOM_safe_alloc, only : safe_alloc_ptr, safe_alloc_alloc use MOM_string_functions, only : lowercase use MOM_time_manager, only : time_type use MOM_unit_scaling, only : unit_scale_type use MOM_verticalGrid, only : verticalGrid_type -use MOM_EOS, only : EOS_type -use MOM_diag_remap, only : diag_remap_ctrl -use MOM_diag_remap, only : diag_remap_update -use MOM_diag_remap, only : diag_remap_calc_hmask -use MOM_diag_remap, only : diag_remap_init, diag_remap_end, diag_remap_do_remap -use MOM_diag_remap, only : vertically_reintegrate_diag_field, vertically_interpolate_diag_field -use MOM_diag_remap, only : diag_remap_configure_axes, diag_remap_axes_configured -use MOM_diag_remap, only : diag_remap_get_axes_info, diag_remap_set_active -use MOM_diag_remap, only : diag_remap_diag_registration_closed -use MOM_diag_remap, only : horizontally_average_diag_field - -use diag_axis_mod, only : get_diag_axis_name -use diag_data_mod, only : null_axis_id -use diag_manager_mod, only : diag_manager_init, diag_manager_end -use diag_manager_mod, only : send_data, diag_axis_init, EAST, NORTH, diag_field_add_attribute -! The following module is needed for PGI since the following line does not compile with PGI 6.5.0 -! was: use diag_manager_mod, only : register_diag_field_fms=>register_diag_field -use MOM_diag_manager_wrapper, only : register_diag_field_fms -use diag_manager_mod, only : register_static_field_fms=>register_static_field -use diag_manager_mod, only : get_diag_field_id_fms=>get_diag_field_id -use diag_manager_mod, only : DIAG_FIELD_NOT_FOUND implicit none ; private @@ -482,10 +473,9 @@ subroutine set_axes_info(G, GV, US, param_file, diag_cs, set_vertical) call define_axes_group(diag_cs, (/ id_xh, id_yq /), diag_cs%axesCv1, & x_cell_method='mean', y_cell_method='point', is_v_point=.true.) - ! Axis group for special null axis from diag manager + ! Axis group for special null axis from diag manager. (Could null_axis_id be made MOM specific?) call define_axes_group(diag_cs, (/ null_axis_id /), diag_cs%axesNull) - !Non-native Non-downsampled if (diag_cs%num_diag_coords>0) then allocate(diag_cs%remap_axesZL(diag_cs%num_diag_coords)) diff --git a/src/framework/MOM_diag_remap.F90 b/src/framework/MOM_diag_remap.F90 index f27a153a2b..462ba7bf5e 100644 --- a/src/framework/MOM_diag_remap.F90 +++ b/src/framework/MOM_diag_remap.F90 @@ -60,6 +60,8 @@ module MOM_diag_remap use MOM_coms, only : reproducing_sum_EFP, EFP_to_real use MOM_coms, only : EFP_type, assignment(=), EFP_sum_across_PEs use MOM_error_handler, only : MOM_error, FATAL, assert, WARNING +use MOM_debugging, only : check_column_integrals +use MOM_diag_manager, only : diag_axis_init use MOM_diag_vkernels, only : interpolate_column, reintegrate_column use MOM_file_parser, only : get_param, log_param, param_file_type use MOM_io, only : slasher, mom_read_data @@ -80,9 +82,7 @@ module MOM_diag_remap use coord_sigma, only : build_sigma_column use coord_rho, only : build_rho_column -use diag_manager_mod, only : diag_axis_init -use MOM_debugging, only : check_column_integrals implicit none ; private public diag_remap_ctrl diff --git a/src/ice_shelf/MOM_ice_shelf_diag_mediator.F90 b/src/ice_shelf/MOM_ice_shelf_diag_mediator.F90 index 90ae47450d..397696c0ba 100644 --- a/src/ice_shelf/MOM_ice_shelf_diag_mediator.F90 +++ b/src/ice_shelf/MOM_ice_shelf_diag_mediator.F90 @@ -3,19 +3,15 @@ module MOM_IS_diag_mediator ! This file is a part of SIS2. See LICENSE.md for the license. -use MOM_grid, only : ocean_grid_type - -use MOM_coms, only : PE_here +use MOM_coms, only : PE_here +use MOM_diag_manager, only : diag_manager_init, send_data, diag_axis_init, EAST, NORTH +use MOM_diag_manager, only : register_diag_field_fms, register_static_field_fms use MOM_error_handler, only : MOM_error, FATAL, is_root_pe, assert -use MOM_file_parser, only : get_param, log_param, log_version, param_file_type -use MOM_safe_alloc, only : safe_alloc_ptr, safe_alloc_alloc +use MOM_file_parser, only : get_param, log_param, log_version, param_file_type +use MOM_grid, only : ocean_grid_type +use MOM_safe_alloc, only : safe_alloc_ptr, safe_alloc_alloc use MOM_string_functions, only : lowercase, uppercase, slasher -use MOM_time_manager, only : time_type - -use diag_manager_mod, only : diag_manager_init -use diag_manager_mod, only : send_data, diag_axis_init,EAST,NORTH -use diag_manager_mod, only : register_diag_field_fms=>register_diag_field -use diag_manager_mod, only : register_static_field_fms=>register_static_field +use MOM_time_manager, only : time_type implicit none ; private