From be5de2aca959ec0c6ccbf94b927b09b14f55cd23 Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Mon, 11 Mar 2024 14:09:20 -0400 Subject: [PATCH] Always buffer the data --- diag_manager/fms_diag_field_object.F90 | 8 ++++++++ diag_manager/fms_diag_object.F90 | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/diag_manager/fms_diag_field_object.F90 b/diag_manager/fms_diag_field_object.F90 index 7ad46ba16..b685ce4ad 100644 --- a/diag_manager/fms_diag_field_object.F90 +++ b/diag_manager/fms_diag_field_object.F90 @@ -169,6 +169,7 @@ module fms_diag_field_object_mod procedure :: get_dimnames procedure :: get_var_skind procedure :: get_longname_to_write + procedure :: get_multiple_send_data procedure :: write_field_metadata procedure :: write_coordinate_attribute procedure :: get_math_needs_to_be_done @@ -1072,6 +1073,13 @@ pure function get_var_skind(this, field_yaml) & end function get_var_skind +pure function get_multiple_send_data(this) & +result(rslt) + class (fmsDiagField_type), intent(in) :: this !< diag field + logical :: rslt + rslt = this%multiple_send_data +end function get_multiple_send_data + !> @brief Determine the long name to write for the field !! @return Long name to write pure function get_longname_to_write(this, field_yaml) & diff --git a/diag_manager/fms_diag_object.F90 b/diag_manager/fms_diag_object.F90 index d490a4b02..7c8f279a9 100644 --- a/diag_manager/fms_diag_object.F90 +++ b/diag_manager/fms_diag_object.F90 @@ -626,6 +626,11 @@ logical function fms_diag_accept_data (this, diag_field_id, field_data, mask, rm shape(field_data)) endif + !< If send data is called multiple times, buffer the data + !! This is so that the other reduction methods work and just averaging + if (this%FMS_diag_fields(diag_field_id)%get_multiple_send_data()) & + buffer_the_data = .true. + !If this is true, buffer data main_if: if (buffer_the_data) then !> Only 1 thread allocates the output buffer and sets set_math_needs_to_be_done