Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dmUpdate: add time_average reduction method and test #1421

Merged
merged 18 commits into from
Dec 27, 2023

Conversation

rem1776
Copy link
Contributor

@rem1776 rem1776 commented Nov 28, 2023

Description
adds the time average reduction method and some other (basically getters/setters) routines that were needed for it to work properly along with a unit test for it.

Just getting an error with the modern end to end test, but that might be related to the reductions we haven't added yet.

draft for now, still some TODO's to clean up after some discussion

How Has This Been Tested?
amd box with the latest oneapi. Also compiled with all the runtime checks while working on this so that one test might still pass in the ci.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

@rem1776 rem1776 requested a review from uramirez8707 November 28, 2023 21:50
@rem1776 rem1776 marked this pull request as ready for review November 29, 2023 20:04
Copy link
Member

@thomas-robinson thomas-robinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs more documentation

Comment on lines 1714 to 1716
class(fmsDiagField_type), intent(in) :: this
class(*), allocatable, intent(out) :: missing_val
real(r8_kind) :: res
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs documentation

!! this just indicates whether the mask array itself has been alloc'd
!! this is different from @ref has_mask_variant, which is set earlier for whether a mask is being used at all
pure logical function has_mask_allocated(this)
class(fmsDiagField_type),intent(in) :: this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs documentation

!> \brief Gets the buffer_id list from the file object
pure function get_buffer_ids (this)
class(fmsDiagFile_type), intent(in) :: this !< The file object
integer, allocatable :: get_buffer_ids(:)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs documentation

diag_manager/fms_diag_file_object.F90 Show resolved Hide resolved

pure function get_number_of_buffers(this)
class(fmsDiagFile_type), intent(in) :: this !< file object
integer :: get_number_of_buffers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs documentation

@@ -654,7 +663,7 @@ subroutine fms_diag_send_complete(this, time_step)
character(len=128) :: error_string
type(fmsDiagIbounds_type) :: bounds
integer, dimension(:), allocatable :: file_ids !< Array of file IDs for a field
logical, parameter :: DEBUG_SC = .true. !< turn on output for debugging
logical, parameter :: DEBUG_SC = .false. !< turn on output for debugging
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't turn this on if it's a parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the debug output they are just local parameters for if your working on the code so I figured they would be changed manually.

If we want to make them more accessible we could do a CPP macro or namelist option instead but I think this should be a parameter either way since it's value shouldn't change over the course of this routine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a parameter, then it can't be a namelist option. It would be good to make it a namelist option. This can be a TODO

TYPE (time_type), pointer :: model_time!< The current model time

integer, allocatable :: buff_ids(:) !< ids for output buffers to loop through
integer :: ibuff, mask_zbounds(2), mask_shape(4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs documentation. Should probably all be on separate lines for documentation purposes

Comment on lines 728 to 732
logical :: force_write, is_writing, has_mask
logical, parameter :: DEBUG_REDUCT = .false.
class(*), allocatable :: missing_val
real(r8_kind) :: mval
character(len=128) :: error_string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs documentation

Comment on lines 638 to 643
!logical, intent(in) :: is_subregional !< if subregional output
!logical, intent(in) :: has_halo !< true if halo region is being used
!logical, optional, intent(in) :: mask(:,:,:,:) !< whether a mask variant reduction
!logical, allocatable :: mask_tmp(:,:,:,:)
!integer :: is, ie, js, je, ks, ke, zs, ze
!integer :: i, halo_size(4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this all be removed?

@thomas-robinson
Copy link
Member

The PR failed the CI

@thomas-robinson thomas-robinson merged commit 54c5d7e into NOAA-GFDL:dmUpdate Dec 27, 2023
19 checks passed
rem1776 added a commit to rem1776/FMS that referenced this pull request May 1, 2024
* add tests and routines from other branch

* move weight check to output buffer, more comments + cleanup

* simplify reduction done

* update avg test for send_data_r4

* Add time to the buffer object so the counter is only increased if data has not been recived for that time

---------

Co-authored-by: rem1776 <[email protected]>
Co-authored-by: Uriel Ramirez <[email protected]>
rem1776 added a commit to rem1776/FMS that referenced this pull request May 1, 2024
* add tests and routines from other branch

* move weight check to output buffer, more comments + cleanup

* simplify reduction done

* update avg test for send_data_r4

* Add time to the buffer object so the counter is only increased if data has not been recived for that time

---------

Co-authored-by: rem1776 <[email protected]>
Co-authored-by: Uriel Ramirez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants