Skip to content

Commit

Permalink
Merge pull request #139 from Hallberg-NOAA/less_checksums
Browse files Browse the repository at this point in the history
Only write checksums from root PE
  • Loading branch information
marshallward authored Apr 2, 2021
2 parents 9835058 + 60e53ff commit b85313a
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 79 deletions.
111 changes: 67 additions & 44 deletions src/ice_boundary_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ module ice_boundary_types
! develoment effort.
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!

use MOM_error_handler, only : stdout
use MOM_error_handler, only : stdout, is_root_pe
use MOM_domains, only : CGRID_NE, BGRID_NE, AGRID
use SIS_framework, only : coupler_2d_bc_type, coupler_3d_bc_type
use SIS_framework, only : SIS_chksum, coupler_type_write_chksums
use iso_fortran_env, only : int64

implicit none ; private

Expand Down Expand Up @@ -121,16 +122,22 @@ subroutine ocn_ice_bnd_type_chksum(id, timestep, bnd_type)
character(len=*), intent(in) :: id !< An identifying message fragment
integer , intent(in) :: timestep !< The timestep number
type(ocean_ice_boundary_type), intent(in) :: bnd_type !< The structure whose elements are to be checksummed
integer :: n, m, outunit

! Local variables
integer(kind=int64) :: chks ! A checksum for the field
logical :: root ! True only on the root PE
integer :: outunit ! The output unit to write to

outunit = stdout()
write(outunit,*) 'BEGIN CHECKSUM(ocean_ice_boundary_type):: ', id, timestep
write(outunit,100) 'ocn_ice_bnd_type%u ', SIS_chksum(bnd_type%u )
write(outunit,100) 'ocn_ice_bnd_type%v ', SIS_chksum(bnd_type%v )
write(outunit,100) 'ocn_ice_bnd_type%t ', SIS_chksum(bnd_type%t )
write(outunit,100) 'ocn_ice_bnd_type%s ', SIS_chksum(bnd_type%s )
write(outunit,100) 'ocn_ice_bnd_type%frazil ', SIS_chksum(bnd_type%frazil )
write(outunit,100) 'ocn_ice_bnd_type%sea_level', SIS_chksum(bnd_type%sea_level)
root = is_root_pe()

if (root) write(outunit,*) 'BEGIN CHECKSUM(ocean_ice_boundary_type):: ', id, timestep
chks = SIS_chksum(bnd_type%u ) ; if (root) write(outunit,100) 'ocn_ice_bnd_type%u ', chks
chks = SIS_chksum(bnd_type%v ) ; if (root) write(outunit,100) 'ocn_ice_bnd_type%v ', chks
chks = SIS_chksum(bnd_type%t ) ; if (root) write(outunit,100) 'ocn_ice_bnd_type%t ', chks
chks = SIS_chksum(bnd_type%s ) ; if (root) write(outunit,100) 'ocn_ice_bnd_type%s ', chks
chks = SIS_chksum(bnd_type%frazil ) ; if (root) write(outunit,100) 'ocn_ice_bnd_type%frazil ', chks
chks = SIS_chksum(bnd_type%sea_level) ; if (root) write(outunit,100) 'ocn_ice_bnd_type%sea_level', chks
! write(outunit,100) 'ocn_ice_bnd_type%data ', SIS_chksum(bnd_type%data )
100 FORMAT("CHECKSUM::",A32," = ",Z20)

Expand All @@ -143,36 +150,46 @@ subroutine atm_ice_bnd_type_chksum(id, timestep, bnd_type)
character(len=*), intent(in) :: id !< An identifying message fragment
integer , intent(in) :: timestep !< The timestep number
type(atmos_ice_boundary_type), intent(in) :: bnd_type !< The structure whose elements are to be checksummed
integer :: n, outunit

! Local variables
integer(kind=int64) :: chks ! A checksum for the field
logical :: root ! True only on the root PE
integer :: outunit ! The output unit to write to

outunit = stdout()
write(outunit,*) 'BEGIN CHECKSUM(atmos_ice_boundary_type):: ', id, timestep
write(outunit,100) 'atm_ice_bnd_type%u_flux ', SIS_chksum(bnd_type%u_flux)
write(outunit,100) 'atm_ice_bnd_type%v_flux ', SIS_chksum(bnd_type%v_flux)
write(outunit,100) 'atm_ice_bnd_type%u_star ', SIS_chksum(bnd_type%u_star)
write(outunit,100) 'atm_ice_bnd_type%t_flux ', SIS_chksum(bnd_type%t_flux)
write(outunit,100) 'atm_ice_bnd_type%q_flux ', SIS_chksum(bnd_type%q_flux)
write(outunit,100) 'atm_ice_bnd_type%lw_flux ', SIS_chksum(bnd_type%lw_flux)
write(outunit,100) 'atm_ice_bnd_type%sw_flux_vis_dir ', SIS_chksum(bnd_type%sw_flux_vis_dir)
write(outunit,100) 'atm_ice_bnd_type%sw_flux_vis_dif ', SIS_chksum(bnd_type%sw_flux_vis_dif)
write(outunit,100) 'atm_ice_bnd_type%sw_flux_nir_dir ', SIS_chksum(bnd_type%sw_flux_nir_dir)
write(outunit,100) 'atm_ice_bnd_type%sw_flux_nir_dif ', SIS_chksum(bnd_type%sw_flux_nir_dif)
if (associated(bnd_type%sw_down_vis_dir)) &
write(outunit,100) 'atm_ice_bnd_type%sw_down_vis_dir ', SIS_chksum(bnd_type%sw_down_vis_dir)
if (associated(bnd_type%sw_down_vis_dif)) &
write(outunit,100) 'atm_ice_bnd_type%sw_down_vis_dif ', SIS_chksum(bnd_type%sw_down_vis_dif)
if (associated(bnd_type%sw_down_nir_dir)) &
write(outunit,100) 'atm_ice_bnd_type%sw_down_nir_dir ', SIS_chksum(bnd_type%sw_down_nir_dir)
if (associated(bnd_type%sw_down_nir_dif)) &
write(outunit,100) 'atm_ice_bnd_type%sw_down_nir_dif ', SIS_chksum(bnd_type%sw_down_nir_dif)
write(outunit,100) 'atm_ice_bnd_type%lprec ', SIS_chksum(bnd_type%lprec)
write(outunit,100) 'atm_ice_bnd_type%fprec ', SIS_chksum(bnd_type%fprec)
write(outunit,100) 'atm_ice_bnd_type%dhdt ', SIS_chksum(bnd_type%dhdt)
write(outunit,100) 'atm_ice_bnd_type%dedt ', SIS_chksum(bnd_type%dedt)
write(outunit,100) 'atm_ice_bnd_type%drdt ', SIS_chksum(bnd_type%drdt)
write(outunit,100) 'atm_ice_bnd_type%coszen ', SIS_chksum(bnd_type%coszen)
write(outunit,100) 'atm_ice_bnd_type%p ', SIS_chksum(bnd_type%p)
! write(outunit,100) 'atm_ice_bnd_type%data ', SIS_chksum(bnd_type%data)
root = is_root_pe()

if (root) write(outunit,*) 'BEGIN CHECKSUM(atmos_ice_boundary_type):: ', id, timestep
chks = SIS_chksum(bnd_type%u_flux) ; if (root) write(outunit,100) 'atm_ice_bnd_type%u_flux ', chks
chks = SIS_chksum(bnd_type%v_flux) ; if (root) write(outunit,100) 'atm_ice_bnd_type%v_flux ', chks
chks = SIS_chksum(bnd_type%u_star) ; if (root) write(outunit,100) 'atm_ice_bnd_type%u_star ', chks
chks = SIS_chksum(bnd_type%t_flux) ; if (root) write(outunit,100) 'atm_ice_bnd_type%t_flux ', chks
chks = SIS_chksum(bnd_type%q_flux) ; if (root) write(outunit,100) 'atm_ice_bnd_type%q_flux ', chks
chks = SIS_chksum(bnd_type%lw_flux) ; if (root) write(outunit,100) 'atm_ice_bnd_type%lw_flux ', chks
chks = SIS_chksum(bnd_type%sw_flux_vis_dir) ; if (root) write(outunit,100) 'atm_ice_bnd_type%sw_flux_vis_dir ', chks
chks = SIS_chksum(bnd_type%sw_flux_vis_dif) ; if (root) write(outunit,100) 'atm_ice_bnd_type%sw_flux_vis_dif ', chks
chks = SIS_chksum(bnd_type%sw_flux_nir_dir) ; if (root) write(outunit,100) 'atm_ice_bnd_type%sw_flux_nir_dir ', chks
chks = SIS_chksum(bnd_type%sw_flux_nir_dif) ; if (root) write(outunit,100) 'atm_ice_bnd_type%sw_flux_nir_dif ', chks
if (associated(bnd_type%sw_down_vis_dir)) then
chks = SIS_chksum(bnd_type%sw_down_vis_dir) ; if (root) write(outunit,100) 'atm_ice_bnd_type%sw_down_vis_dir ', chks
endif
if (associated(bnd_type%sw_down_vis_dif)) then
chks = SIS_chksum(bnd_type%sw_down_vis_dif) ; if (root) write(outunit,100) 'atm_ice_bnd_type%sw_down_vis_dif ', chks
endif
if (associated(bnd_type%sw_down_nir_dir)) then
chks = SIS_chksum(bnd_type%sw_down_nir_dir) ; if (root) write(outunit,100) 'atm_ice_bnd_type%sw_down_nir_dir ', chks
endif
if (associated(bnd_type%sw_down_nir_dif)) then
chks = SIS_chksum(bnd_type%sw_down_nir_dif) ; if (root) write(outunit,100) 'atm_ice_bnd_type%sw_down_nir_dif ', chks
endif
chks = SIS_chksum(bnd_type%lprec) ; if (root) write(outunit,100) 'atm_ice_bnd_type%lprec ', chks
chks = SIS_chksum(bnd_type%fprec) ; if (root) write(outunit,100) 'atm_ice_bnd_type%fprec ', chks
chks = SIS_chksum(bnd_type%dhdt) ; if (root) write(outunit,100) 'atm_ice_bnd_type%dhdt ', chks
chks = SIS_chksum(bnd_type%dedt) ; if (root) write(outunit,100) 'atm_ice_bnd_type%dedt ', chks
chks = SIS_chksum(bnd_type%drdt) ; if (root) write(outunit,100) 'atm_ice_bnd_type%drdt ', chks
chks = SIS_chksum(bnd_type%coszen) ; if (root) write(outunit,100) 'atm_ice_bnd_type%coszen ', chks
chks = SIS_chksum(bnd_type%p) ; if (root) write(outunit,100) 'atm_ice_bnd_type%p ', chks
! chks = SIS_chksum(bnd_type%data) ; if (root) write(outunit,100) 'atm_ice_bnd_type%data ', chks
100 FORMAT("CHECKSUM::",A32," = ",Z20)

end subroutine atm_ice_bnd_type_chksum
Expand All @@ -182,15 +199,21 @@ subroutine lnd_ice_bnd_type_chksum(id, timestep, bnd_type)
character(len=*), intent(in) :: id !< An identifying message fragment
integer , intent(in) :: timestep !< The timestep number
type(land_ice_boundary_type), intent(in) :: bnd_type !< The structure whose elements are to be checksummed
integer :: n, outunit

! Local variables
integer(kind=int64) :: chks ! A checksum for the field
logical :: root ! True only on the root PE
integer :: outunit ! The output unit to write to

outunit = stdout()
write(outunit,*) 'BEGIN CHECKSUM(land_ice_boundary_type):: ', id, timestep
write(outunit,100) 'lnd_ice_bnd_type%runoff ', SIS_chksum(bnd_type%runoff)
write(outunit,100) 'lnd_ice_bnd_type%calving ', SIS_chksum(bnd_type%calving)
write(outunit,100) 'lnd_ice_bnd_type%runoff_hflx ', SIS_chksum(bnd_type%runoff_hflx)
write(outunit,100) 'lnd_ice_bnd_type%calving_hflx', SIS_chksum(bnd_type%calving_hflx)
! write(outunit,100) 'lnd_ice_bnd_type%data ', SIS_chksum(bnd_type%data)
root = is_root_pe()

if (root) write(outunit,*) 'BEGIN CHECKSUM(land_ice_boundary_type):: ', id, timestep
chks = SIS_chksum(bnd_type%runoff) ; if (root) write(outunit,100) 'lnd_ice_bnd_type%runoff ', chks
chks = SIS_chksum(bnd_type%calving) ; if (root) write(outunit,100) 'lnd_ice_bnd_type%calving ', chks
chks = SIS_chksum(bnd_type%runoff_hflx) ; if (root) write(outunit,100) 'lnd_ice_bnd_type%runoff_hflx ', chks
chks = SIS_chksum(bnd_type%calving_hflx) ; if (root) write(outunit,100) 'lnd_ice_bnd_type%calving_hflx', chks
! chks = SIS_chksum(bnd_type%data) ; if (root) write(outunit,100) 'lnd_ice_bnd_type%data ', chks
100 FORMAT("CHECKSUM::",A32," = ",Z20)
end subroutine lnd_ice_bnd_type_chksum

Expand Down
75 changes: 40 additions & 35 deletions src/ice_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module ice_type_mod
use ice_grid, only : ice_grid_type
use MOM_coms, only : PE_here
use MOM_domains, only : CGRID_NE, BGRID_NE, AGRID
use MOM_error_handler, only : SIS_error=>MOM_error, FATAL, WARNING, SIS_mesg=>MOM_mesg, stdout
use MOM_error_handler, only : SIS_error=>MOM_error, FATAL, WARNING, SIS_mesg=>MOM_mesg
use MOM_error_handler, only : is_root_pe, stdout
use MOM_file_parser, only : param_file_type
use MOM_hor_index, only : hor_index_type
use MOM_time_manager, only : time_type, time_type_to_real
Expand All @@ -23,6 +24,7 @@ module ice_type_mod
use SIS_types, only : ice_state_type, fast_ice_avg_type
use SIS2_ice_thm, only : ice_thermo_type, enth_from_TS, energy_melt_EnthS
use SIS2_ice_thm, only : get_SIS2_thermo_coefs, temp_from_En_S
use iso_fortran_env, only : int64

implicit none ; private

Expand Down Expand Up @@ -622,63 +624,66 @@ subroutine ice_data_type_chksum(mesg, timestep, Ice, init_call)
!! to output during initialization.

! Local variables
integer(kind=int64) :: chks ! A checksum for the field
logical :: root ! True only on the root PE.
logical :: init ! If true, omit checksums that do not make sense to output
! during initialization.
integer :: outunit ! The output unit to write to.

outunit = stdout()
root = is_root_pe()
init = .false. ; if (present(init_call)) init = init_call
write(outunit,*) "BEGIN CHECKSUM(ice_data_type):: ", mesg, timestep

if (root) write(outunit,*) "BEGIN CHECKSUM(ice_data_type):: ", mesg, timestep

if (Ice%fast_ice_PE) then
! These fields are only valid on fast ice PEs.
if (.not.init) then
write(outunit,100) 'ice_data_type%part_size ', SIS_chksum(Ice%part_size )
write(outunit,100) 'ice_data_type%t_surf ', SIS_chksum(Ice%t_surf )
write(outunit,100) 'ice_data_type%s_surf ', SIS_chksum(Ice%s_surf )
write(outunit,100) 'ice_data_type%albedo ', SIS_chksum(Ice%albedo )
write(outunit,100) 'ice_data_type%albedo_vis_dir ', SIS_chksum(Ice%albedo_vis_dir )
write(outunit,100) 'ice_data_type%albedo_nir_dir ', SIS_chksum(Ice%albedo_nir_dir )
write(outunit,100) 'ice_data_type%albedo_vis_dif ', SIS_chksum(Ice%albedo_vis_dif )
write(outunit,100) 'ice_data_type%albedo_nir_dif ', SIS_chksum(Ice%albedo_nir_dif )
chks = SIS_chksum(Ice%part_size ) ; if (root) write(outunit,100) 'ice_data_type%part_size ', chks
chks = SIS_chksum(Ice%t_surf ) ; if (root) write(outunit,100) 'ice_data_type%t_surf ', chks
chks = SIS_chksum(Ice%s_surf ) ; if (root) write(outunit,100) 'ice_data_type%s_surf ', chks
chks = SIS_chksum(Ice%albedo ) ; if (root) write(outunit,100) 'ice_data_type%albedo ', chks
chks = SIS_chksum(Ice%albedo_vis_dir ) ; if (root) write(outunit,100) 'ice_data_type%albedo_vis_dir ', chks
chks = SIS_chksum(Ice%albedo_nir_dir ) ; if (root) write(outunit,100) 'ice_data_type%albedo_nir_dir ', chks
chks = SIS_chksum(Ice%albedo_vis_dif ) ; if (root) write(outunit,100) 'ice_data_type%albedo_vis_dif ', chks
chks = SIS_chksum(Ice%albedo_nir_dif ) ; if (root) write(outunit,100) 'ice_data_type%albedo_nir_dif ', chks
endif
write(outunit,100) 'ice_data_type%rough_mom ', SIS_chksum(Ice%rough_mom )
write(outunit,100) 'ice_data_type%rough_heat ', SIS_chksum(Ice%rough_heat )
write(outunit,100) 'ice_data_type%rough_moist ', SIS_chksum(Ice%rough_moist )
chks = SIS_chksum(Ice%rough_mom ) ; if (root) write(outunit,100) 'ice_data_type%rough_mom ', chks
chks = SIS_chksum(Ice%rough_heat ) ; if (root) write(outunit,100) 'ice_data_type%rough_heat ', chks
chks = SIS_chksum(Ice%rough_moist ) ; if (root) write(outunit,100) 'ice_data_type%rough_moist', chks

if (.not.init) then
write(outunit,100) 'ice_data_type%u_surf ', SIS_chksum(Ice%u_surf )
write(outunit,100) 'ice_data_type%v_surf ', SIS_chksum(Ice%v_surf )
chks = SIS_chksum(Ice%u_surf) ; if (root) write(outunit,100) 'ice_data_type%u_surf ', chks
chks = SIS_chksum(Ice%v_surf) ; if (root) write(outunit,100) 'ice_data_type%v_surf ', chks
endif

call coupler_type_write_chksums(Ice%ocean_fields, outunit, 'ice%')
endif

if (Ice%slow_ice_PE) then
! These fields are only valid on slow ice PEs.
write(outunit,100) 'ice_data_type%flux_u ', SIS_chksum(Ice%flux_u )
write(outunit,100) 'ice_data_type%flux_v ', SIS_chksum(Ice%flux_v )
write(outunit,100) 'ice_data_type%flux_t ', SIS_chksum(Ice%flux_t )
write(outunit,100) 'ice_data_type%flux_q ', SIS_chksum(Ice%flux_q )
write(outunit,100) 'ice_data_type%flux_lw ', SIS_chksum(Ice%flux_lw )
write(outunit,100) 'ice_data_type%flux_sw_vis_dir ', SIS_chksum(Ice%flux_sw_vis_dir )
write(outunit,100) 'ice_data_type%flux_sw_vis_dif ', SIS_chksum(Ice%flux_sw_vis_dif )
write(outunit,100) 'ice_data_type%flux_sw_nir_dir ', SIS_chksum(Ice%flux_sw_nir_dir )
write(outunit,100) 'ice_data_type%flux_sw_nir_dif ', SIS_chksum(Ice%flux_sw_nir_dif )
write(outunit,100) 'ice_data_type%flux_lh ', SIS_chksum(Ice%flux_lh )
write(outunit,100) 'ice_data_type%lprec ', SIS_chksum(Ice%lprec )
write(outunit,100) 'ice_data_type%fprec ', SIS_chksum(Ice%fprec )
write(outunit,100) 'ice_data_type%p_surf ', SIS_chksum(Ice%p_surf )
write(outunit,100) 'ice_data_type%runoff ', SIS_chksum(Ice%runoff )
write(outunit,100) 'ice_data_type%calving ', SIS_chksum(Ice%calving )
write(outunit,100) 'ice_data_type%flux_salt ', SIS_chksum(Ice%flux_salt )
chks = SIS_chksum(Ice%flux_u ) ; if (root) write(outunit,100) 'ice_data_type%flux_u ', chks
chks = SIS_chksum(Ice%flux_v ) ; if (root) write(outunit,100) 'ice_data_type%flux_v ', chks
chks = SIS_chksum(Ice%flux_t ) ; if (root) write(outunit,100) 'ice_data_type%flux_t ', chks
chks = SIS_chksum(Ice%flux_q ) ; if (root) write(outunit,100) 'ice_data_type%flux_q ', chks
chks = SIS_chksum(Ice%flux_lw ) ; if (root) write(outunit,100) 'ice_data_type%flux_lw ', chks
chks = SIS_chksum(Ice%flux_sw_vis_dir ) ; if (root) write(outunit,100) 'ice_data_type%flux_sw_vis_dir ', chks
chks = SIS_chksum(Ice%flux_sw_vis_dif ) ; if (root) write(outunit,100) 'ice_data_type%flux_sw_vis_dif ', chks
chks = SIS_chksum(Ice%flux_sw_nir_dir ) ; if (root) write(outunit,100) 'ice_data_type%flux_sw_nir_dir ', chks
chks = SIS_chksum(Ice%flux_sw_nir_dif ) ; if (root) write(outunit,100) 'ice_data_type%flux_sw_nir_dif ', chks
chks = SIS_chksum(Ice%flux_lh ) ; if (root) write(outunit,100) 'ice_data_type%flux_lh ', chks
chks = SIS_chksum(Ice%lprec ) ; if (root) write(outunit,100) 'ice_data_type%lprec ', chks
chks = SIS_chksum(Ice%fprec ) ; if (root) write(outunit,100) 'ice_data_type%fprec ', chks
chks = SIS_chksum(Ice%p_surf ) ; if (root) write(outunit,100) 'ice_data_type%p_surf ', chks
chks = SIS_chksum(Ice%runoff ) ; if (root) write(outunit,100) 'ice_data_type%runoff ', chks
chks = SIS_chksum(Ice%calving ) ; if (root) write(outunit,100) 'ice_data_type%calving ', chks
chks = SIS_chksum(Ice%flux_salt ) ; if (root) write(outunit,100) 'ice_data_type%flux_salt ', chks

if (associated(Ice%sCS)) then ; if (Ice%sCS%pass_iceberg_area_to_ocean) then
write(outunit,100) 'ice_data_type%ustar_berg ', SIS_chksum(Ice%ustar_berg )
write(outunit,100) 'ice_data_type%area_berg ', SIS_chksum(Ice%area_berg )
write(outunit,100) 'ice_data_type%mass_berg ', SIS_chksum(Ice%mass_berg )
chks = SIS_chksum(Ice%ustar_berg ) ; if (root) write(outunit,100) 'ice_data_type%ustar_berg ', chks
chks = SIS_chksum(Ice%area_berg ) ; if (root) write(outunit,100) 'ice_data_type%area_berg ', chks
chks = SIS_chksum(Ice%mass_berg ) ; if (root) write(outunit,100) 'ice_data_type%mass_berg ', chks
endif ; endif

endif

100 FORMAT(" CHECKSUM::",A32," = ",Z20)
Expand Down

0 comments on commit b85313a

Please sign in to comment.