Skip to content

Commit

Permalink
drivers/nemo_concepts: add 'debug_ice' calls throughout 'ice_step'
Browse files Browse the repository at this point in the history
In 97370d7 (Update testing, in particular for diagnostics and
decompositions (CICE-Consortium#602), 2021-05-26), the 'debug_model' namelist flag was
added and calls to 'debug_ice' were added throughout the standalone
model's 'ice_step'. This is useful for debugging model runs (in the
scientific sense) since this subroutine prints the complete ice state,
so calling it several times per time step can help diagnose where things
go wrong.

Do the same in the 'nemo_concepts' driver.
  • Loading branch information
phil-blain committed Jun 5, 2023
1 parent 0b540b5 commit 520cca2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cicecore/drivers/direct/nemo_concepts/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ subroutine ice_step

use ice_boundary, only: ice_HaloUpdate
use ice_calendar, only: dt, dt_dyn, ndtd, diagfreq, write_restart, istep
use ice_diagnostics, only: init_mass_diags, runtime_diags
use ice_diagnostics, only: init_mass_diags, runtime_diags, debug_model, debug_model_iblk, debug_ice
use ice_diagnostics_bgc, only: hbrine_diags, zsal_diags, bgc_diags
use ice_domain, only: halo_info, nblocks
use ice_domain_size, only: nslyr
Expand Down Expand Up @@ -197,6 +197,8 @@ subroutine ice_step
call da_state_update
#endif

if (debug_model) call debug_ice(debug_model_iblk, 'beginning time step')

!-----------------------------------------------------------------
! restoring on grid boundaries
!-----------------------------------------------------------------
Expand All @@ -210,6 +212,8 @@ subroutine ice_step
if (istep == 1 .and. runtype == 'initial' .and. .not. restart) &
call init_shortwave

if (debug_model) call debug_ice(debug_model_iblk, 'post re-init_shortwave')

!-----------------------------------------------------------------
! initialize diagnostics and save initial state values
!-----------------------------------------------------------------
Expand All @@ -234,14 +238,19 @@ subroutine ice_step

if (calc_Tsfc .and. ktherm >= 0) call prep_radiation (iblk)

if (debug_model) call debug_ice(iblk, 'post prep_radiation')

!-----------------------------------------------------------------
! thermodynamics and biogeochemistry
!-----------------------------------------------------------------

call step_therm1 (dt, iblk) ! vertical thermodynamics
if (debug_model) call debug_ice(iblk, 'post step_therm1')

if (ktherm >= 0) then
call biogeochemistry (dt, iblk) ! biogeochemistry
call step_therm2 (dt, iblk) ! ice thickness distribution thermo
if (debug_model) call debug_ice(iblk, 'post step_therm2')
endif

enddo ! iblk
Expand All @@ -266,20 +275,24 @@ subroutine ice_step

! momentum, stress, transport
call step_dyn_horiz (dt_dyn)
if (debug_model) call debug_ice(debug_model_iblk, 'post step_dyn_horiz')

! ridging
!$OMP PARALLEL DO PRIVATE(iblk)
do iblk = 1, nblocks
call step_dyn_ridge (dt_dyn, ndtd, iblk)
enddo
!$OMP END PARALLEL DO
if (debug_model) call debug_ice(debug_model_iblk, 'post step_dyn_ridge')

! clean up, update tendency diagnostics
offset = c0
call update_state (dt_dyn, daidtd, dvidtd, dagedtd, offset)

enddo

if (debug_model) call debug_ice(debug_model_iblk, 'post dynamics')

!-----------------------------------------------------------------
! albedo, shortwave radiation
!-----------------------------------------------------------------
Expand All @@ -291,12 +304,14 @@ subroutine ice_step
do iblk = 1, nblocks

if (ktherm >= 0) call step_radiation (dt, iblk)
if (debug_model) call debug_ice(iblk, 'post step_radiation')

!-----------------------------------------------------------------
! get ready for coupling and the next time step
!-----------------------------------------------------------------

call coupling_prep (iblk)
if (debug_model) call debug_ice(iblk, 'post coupling_prep')

! compute components of diagnostic wind
call diagnostic_wind_components(iblk)
Expand Down

0 comments on commit 520cca2

Please sign in to comment.