FMS  2025.04
Flexible Modeling System
fms_diag_fieldbuff_update.F90
1 !***********************************************************************
2 !* Apache License 2.0
3 !*
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
5 !*
6 !* Licensed under the Apache License, Version 2.0 (the "License");
7 !* you may not use this file except in compliance with the License.
8 !* You may obtain a copy of the License at
9 !*
10 !* http://www.apache.org/licenses/LICENSE-2.0
11 !*
12 !* FMS is distributed in the hope that it will be useful, but WITHOUT
13 !* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied;
14 !* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 !* PARTICULAR PURPOSE. See the License for the specific language
16 !* governing permissions and limitations under the License.
17 !***********************************************************************
18 
19 !> @defgroup fms_diag_fieldbuff_update_mod fms_diag_fieldbuff_update_mod
20 !> @ingroup diag_manager
21 !> @brief fms_diag_fieldbuff_update_mod Contains routines for updating the
22 !! buffer (array) of field data statistics (e.g. average, rms) with new field data.
23 !!
24 !> @author Miguel Zuniga
25 !!
26 !! <TT>fms_diag_fieldbuff_update_mod</TT> contains routines for updating the buffer
27 !!(array) of field data statistics (e.g. average, rms) with new field data. These
28 !! routines are called by the send_data routines in the diag_manager.
29 !!
30 !> @file
31 !> @brief File for @ref fms_diag_fieldbuff_update_mod
32 !> @addtogroup fms_diag_fieldbuff_update_mod
33 !> @{
34 MODULE fms_diag_fieldbuff_update_mod
35  USE platform_mod
36  USE mpp_mod, ONLY: mpp_pe, mpp_root_pe
37  USE time_manager_mod, ONLY: time_type
38  USE fms_mod, ONLY: error_mesg, fatal, warning, note, stdout, stdlog, write_version_number,fms_error_handler
39  USE diag_data_mod, ONLY: debug_diag_manager
40  USE fms_diag_outfield_mod, ONLY: fmsdiagoutfieldindex_type, fmsdiagoutfield_type
41  USE diag_util_mod, ONLY: fms_diag_check_out_of_bounds
42  USE fms_diag_time_reduction_mod, ONLY: fmsdiagtimereduction_type
43  USE fms_diag_elem_weight_procs_mod, ONLY: addwf
44  USE fms_diag_bbox_mod, ONLY: fmsdiagibounds_type
45 
46  implicit none
47 
48  !!TODO: (MDM) Remove commented integer versions.
49 
50  !> @brief Interface fieldbuff_update updates elements of field output buffer based on input field
51  !! data and mathematical operations on the field data.
52  !> @ingroup fms_diag_fieldbuff_update_mod
53  interface fieldbuff_update
54  !< r4 version of the interface
55  module procedure fieldbuff_update_r4
56  !< r8 version of the interface
57  module procedure fieldbuff_update_r8
58  !< r4 version of the interface, where the field is 3D
59  module procedure fieldbuff_update_3d_r4
60  !< r8 version of the interface
61  module procedure fieldbuff_update_3d_r8
62  !< i4 version of the interface, , where the field is 3D
63  !module procedure fieldbuff_update_i4
64  !< i8 version of the interface
65  ! module procedure fieldbuff_update_i8
66  end interface
67 
68  !> @brief Interface fieldbuff_copy_missvals updates elements of the field output buffer with
69  !! the missvalue input argument.
70  !> @ingroup fms_diag_fieldbuff_update_mod
72  !< r4 version of the interface
73  module procedure fieldbuff_copy_missvals_r4
74  !< r8 version of the interface
75  module procedure fieldbuff_copy_missvals_r8
76  !< r4 version of the interface, , where the field is 3D
77  module procedure fieldbuff_copy_missvals_3d_r4
78  !< r8 version of the interface, , where the field is 3D
79  module procedure fieldbuff_copy_missvals_3d_r8
80  !< i4 version of the interface
81  !module procedure fieldbuff_copy_missvals_i4
82  !< i8 version of the interface
83  !module procedure fieldbuff_copy_missvals_i8
84  end interface
85 
86  !> @brief Interface fieldbuff_copy_fieldvals updates elements of the field output buffer with
87  !! copies of corresponding element values in the input field data.
88  !> @ingroup fms_diag_fieldbuff_update_mod
90  !< r4 version of the interface
91  module procedure fieldbuff_copy_fieldvals_r4
92  !< r8 version of the interface
93  module procedure fieldbuff_copy_fieldvals_r8
94  !< r4 version of the interface, , where the field is 3D
95  module procedure fieldbuff_copy_fieldvals_3d_r4
96  !< r8 version of the interface, , where the field is 3D
97  module procedure fieldbuff_copy_fieldvals_3d_r8
98  !< i4 version of the interface
99  !module procedure fieldbuff_copy_fieldvals_i4
100  !< i8 version of the interface
101  !module procedure fieldbuff_copy_fieldvals_i8
102  end interface
103 contains
104 
105 #include "fms_diag_fieldbuff_update.inc"
106 
107 END MODULE fms_diag_fieldbuff_update_mod
108 !> @}
109 ! close documentation grouping
Interface for the elemental function addwf, which Calculates and returns the value given by this form...
Interface fieldbuff_copy_fieldvals updates elements of the field output buffer with copies of corresp...
Interface fieldbuff_copy_missvals updates elements of the field output buffer with the missvalue inpu...
Interface fieldbuff_update updates elements of field output buffer based on input field data and math...
Class fmsDiagOutfield_type (along with class ms_diag_outfield_index_type ) contain information used i...
Class fms_diag_outfield_index_type which (along with class fmsDiagOutfield_type) encapsulate related ...
subroutine, public write_version_number(version, tag, unit)
Prints to the log file (or a specified unit) the version id string and tag name.
Definition: fms.F90:701
logical function, public fms_error_handler(routine, message, err_msg)
Facilitates the control of fatal error conditions.
Definition: fms.F90:468
subroutine, public error_mesg(routine, message, level)
Print notes, warnings and error messages; terminates program for warning and error messages....
Definition: fms.F90:441
integer function stdout()
This function returns the current standard fortran unit numbers for output.
Definition: mpp_util.inc:42
integer function stdlog()
This function returns the current standard fortran unit numbers for log messages. Log messages,...
Definition: mpp_util.inc:58
integer function mpp_pe()
Returns processor ID.
Definition: mpp_util.inc:406
Type to represent amounts of time. Implemented as seconds and days to allow for larger intervals.
Data structure holding a 3D bounding box. It is commonlyused to represent the interval bounds or limi...