Skip to content

Commit

Permalink
Add new unit tests sumchk and bcstchk and update tests (#606)
Browse files Browse the repository at this point in the history
* Update testing

- Set default debug_model_step=0 (was 99999999)
- Add debug_model_[i,j,iblk,task] to define the debug_model diagnostic point
  in local grid index space.  If this point is not set and debug_model
  is turned on, it will use lonpnt(1),latpnt(1).
- Rename forcing_diag namelist/variable to debug_forcing to be more
  consistent with other "debug_" namelist variables
- Rename the local variable forcing_debug in ice_forcing.F90 to local_debug
  to avoid confusion with global varaible debug_forcing.
- Add namelist variable optics_file.  Was hardwired in ice_forcing_bgc.F90
- Update optics file variable name to read, still hardwired in model.
- Update setting of nbtrcr_sw and allocation of trcrn_sw.   nbtrcr_sw
  was not set in icepack after it was computed and trcrn_sw was allocated
  before nbtrcr_sw was computed.  This impacts the dedd_algae implementation
  which still isn't working.
- move default distribution_wgt_file for gx1 to set_nml.gx1
- update test suite, add testing of debug_model_[i,j,iblk,task], add addtional
  testing of maskhalo
- update documentation

* add sumchk unit test to test global reduction methods

* - add bcstchk unit test
- update ice_broadcast to sync up serial and mpi versions
- add get_rank to ice_communicate.F90
- add global_[min/max]val_scalar_int_nodist method to ice_global_reductions.F90
- add tripole output in ice_blocks.F90 with debug_blocks
- update set_nml.tx1 to set ns_boundary_type to 'tripole', was 'open'

* update lsum16 to revert to double precision if NO_R16 is set

* sync up serial ice_global_reductions.F90

* - add optics_file_fieldname namelist
- add grid_type and ns_boundary_type tripole check
- update sumchk unit test to check both Nface and center points.  these are treated
  differently for tripole grids.
- update documentation of unit tests
  • Loading branch information
apcraig committed Jun 10, 2021
1 parent a63cc1c commit d6eb125
Show file tree
Hide file tree
Showing 36 changed files with 2,619 additions and 280 deletions.
45 changes: 32 additions & 13 deletions cicecore/cicedynB/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module ice_diagnostics
print_global ! if true, print global data

integer (kind=int_kind), public :: &
debug_model_step = 999999999 ! begin printing at istep1=debug_model_step
debug_model_step = 0 ! begin printing at istep1=debug_model_step

integer (kind=int_kind), parameter, public :: &
npnt = 2 ! total number of points to be printed
Expand Down Expand Up @@ -73,6 +73,12 @@ module ice_diagnostics
integer (kind=int_kind), dimension(npnt), public :: &
piloc, pjloc, pbloc, pmloc ! location of diagnostic points

integer (kind=int_kind), public :: &
debug_model_i = -1, & ! location of debug_model point, local i index
debug_model_j = -1, & ! location of debug_model point, local j index
debug_model_iblk = -1, & ! location of debug_model point, local block number
debug_model_task = -1 ! location of debug_model point, local task number

! for hemispheric water and heat budgets
real (kind=dbl_kind) :: &
totmn , & ! total ice/snow water mass (nh)
Expand Down Expand Up @@ -1432,9 +1438,9 @@ subroutine init_diags
write(nu_diag,*) ' Find indices of diagnostic points '
endif

piloc(:) = 0
pjloc(:) = 0
pbloc(:) = 0
piloc(:) = -1
pjloc(:) = -1
pbloc(:) = -1
pmloc(:) = -999
plat(:) = -999._dbl_kind
plon(:) = -999._dbl_kind
Expand Down Expand Up @@ -1535,16 +1541,29 @@ subroutine debug_ice(iblk, plabeld)
integer (kind=int_kind) :: i, j, m
character(len=*), parameter :: subname='(debug_ice)'

! tcraig, do this only on one point, the first point
! do m = 1, npnt
m = 1
if (istep1 >= debug_model_step .and. &
iblk == pbloc(m) .and. my_task == pmloc(m)) then
i = piloc(m)
j = pjloc(m)
call print_state(plabeld,i,j,iblk)
if (istep1 >= debug_model_step) then

! set debug point to 1st global point if not set as local values
if (debug_model_i < 0 .and. debug_model_j < 0 .and. &
debug_model_iblk < 0 .and. debug_model_task < 0) then
debug_model_i = piloc(1)
debug_model_j = pjloc(1)
debug_model_task = pmloc(1)
debug_model_iblk = pbloc(1)
endif

! if debug point is messed up, abort
if (debug_model_i < 0 .or. debug_model_j < 0 .or. &
debug_model_iblk < 0 .or. debug_model_task < 0) then
call abort_ice (subname//'ERROR: debug_model_[i,j,iblk,mytask] not set correctly')
endif
! enddo

! write out debug info
if (debug_model_iblk == iblk .and. debug_model_task == my_task) then
call print_state(plabeld,debug_model_i,debug_model_j,debug_model_iblk)
endif

endif

end subroutine debug_ice

Expand Down
Loading

0 comments on commit d6eb125

Please sign in to comment.