Skip to content

Commit

Permalink
one hopeless cause at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
uramirez8707 committed Apr 8, 2024
1 parent 6a26aae commit 4f193ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ integer function fms_register_diag_field_obj &
call bufferptr%set_diurnal_sample_size(yamlfptr%get_n_diurnal())
endif
call bufferptr%init_buffer_time(init_time)
call bufferptr%set_next_output(this%FMS_diag_files(file_ids(i))%get_next_output(), fieldptr%is_static())
call bufferptr%set_next_output(this%FMS_diag_files(file_ids(i))%get_next_output(), &
this%FMS_diag_files(file_ids(i))%get_next_next_output(), is_static=fieldptr%is_static())
enddo

nullify (fileptr)
Expand Down Expand Up @@ -850,7 +851,7 @@ subroutine fms_diag_do_io(this, end_time)
endif
endif
call diag_file%write_field_data(diag_field, diag_buff, unlim_dim_was_increased)
call diag_buff%set_next_output(diag_file%get_next_next_output())
call diag_buff%set_next_output(diag_file%get_next_output(), diag_file%get_next_next_output())
endif
nullify(diag_buff)
nullify(field_yaml)
Expand Down
14 changes: 11 additions & 3 deletions diag_manager/fms_diag_output_buffer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,24 @@ subroutine init_buffer_time(this, time)
end subroutine init_buffer_time

!> @brief Sets the next output
subroutine set_next_output(this, time, is_static)
subroutine set_next_output(this, next_output, next_next_output, is_static)
class(fmsDiagOutputBuffer_type), intent(inout) :: this !< Buffer object
type(time_type), intent(in) :: time !< time to add to the buffer
type(time_type), intent(in) :: next_output !< time to add to the buffer
type(time_type), intent(in) :: next_next_output
logical, optional, intent(in) :: is_static !< .True. if the field is static

this%next_output = time
if (present(is_static)) then
!< If the field is static set the next_output to be equal to time
!! this should only be used in the init, so next_output will be equal to the the init time
if (is_static) this%next_output = this%time
return
endif

!TODO documentation #WUT
if (next_output > this%next_output) then
this%next_output = next_output
else
this%next_output = next_next_output
endif
end subroutine set_next_output

Expand Down

0 comments on commit 4f193ee

Please sign in to comment.