From 099e8ba520dbe50d6f696751198ee0680b7f711c Mon Sep 17 00:00:00 2001 From: Philippe Blain Date: Fri, 7 Apr 2023 16:09:48 -0400 Subject: [PATCH] drivers/nemo_concepts: add 'debug_ice' calls throughout 'ice_step' In 97370d7 (Update testing, in particular for diagnostics and decompositions (#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. --- .../direct/nemo_concepts/CICE_RunMod.F90 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cicecore/drivers/direct/nemo_concepts/CICE_RunMod.F90 b/cicecore/drivers/direct/nemo_concepts/CICE_RunMod.F90 index 384dbc909..cf0b55960 100644 --- a/cicecore/drivers/direct/nemo_concepts/CICE_RunMod.F90 +++ b/cicecore/drivers/direct/nemo_concepts/CICE_RunMod.F90 @@ -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 @@ -196,6 +196,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 !----------------------------------------------------------------- @@ -209,6 +211,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 !----------------------------------------------------------------- @@ -233,14 +237,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 @@ -265,6 +274,7 @@ 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) @@ -272,6 +282,7 @@ subroutine ice_step 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 @@ -279,6 +290,8 @@ subroutine ice_step enddo + if (debug_model) call debug_ice(debug_model_iblk, 'post dynamics') + !----------------------------------------------------------------- ! albedo, shortwave radiation !----------------------------------------------------------------- @@ -290,12 +303,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)