Skip to content

Commit

Permalink
Update the opticep unit test to be consistent with the latest changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
apcraig committed Mar 8, 2024
1 parent e68dd14 commit 29e1226
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
3 changes: 2 additions & 1 deletion cicecore/drivers/unittest/opticep/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ subroutine cice_init
floe_binwidth, c_fsd_range
use ice_state, only: alloc_state
use ice_flux_bgc, only: alloc_flux_bgc
use ice_calendar, only: dt, dt_dyn, write_ic, &
use ice_calendar, only: dt, write_ic, &
init_calendar, advance_timestep, calc_timesteps
use ice_communicate, only: init_communicate, my_task, master_task
use ice_diagnostics, only: init_diags
Expand Down Expand Up @@ -244,6 +244,7 @@ subroutine cice_init
call init_flux_ocn ! initialize ocean fluxes sent to coupler

call dealloc_grid ! deallocate temporary grid arrays

if (my_task == master_task) then
call ice_memusage_print(nu_diag,subname//':end')
endif
Expand Down
8 changes: 5 additions & 3 deletions cicecore/drivers/unittest/opticep/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ subroutine ice_step
use ice_dyn_eap, only: write_restart_eap
use ice_dyn_shared, only: kdyn, kridge
use ice_flux, only: scale_factor, init_history_therm, &
daidtt, daidtd, dvidtt, dvidtd, dagedtt, dagedtd
daidtt, daidtd, dvidtt, dvidtd, dvsdtd, dagedtt, dagedtd
use ice_history, only: accum_hist
use ice_history_bgc, only: init_history_bgc
use ice_restart, only: final_restart
Expand Down Expand Up @@ -265,7 +265,8 @@ subroutine ice_step

! clean up, update tendency diagnostics
offset = dt
call update_state (dt, daidtt, dvidtt, dagedtt, offset)
call update_state (dt=dt, daidt=daidtt, dvidt=dvidtt, dagedt=dagedtt, &
offset=offset)

call ice_timer_stop(timer_thermo) ! thermodynamics
call ice_timer_stop(timer_column) ! column physics
Expand Down Expand Up @@ -306,7 +307,8 @@ subroutine ice_step

! clean up, update tendency diagnostics
offset = c0
call update_state (dt_dyn, daidtd, dvidtd, dagedtd, offset)
call update_state (dt=dt_dyn, daidt=daidtd, dvidt=dvidtd, dvsdt=dvsdtd, &
dagedt=dagedtd, offset=offset)

enddo

Expand Down
42 changes: 22 additions & 20 deletions cicecore/drivers/unittest/opticep/ice_step_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ end subroutine step_therm2
!
! authors: Elizabeth Hunke, LANL

subroutine update_state (dt, daidt, dvidt, dagedt, offset)
subroutine update_state (dt, daidt, dvidt, dvsdt, dagedt, offset)

use ice_domain_size, only: ncat
! use ice_grid, only: tmask
Expand All @@ -768,6 +768,7 @@ subroutine update_state (dt, daidt, dvidt, dagedt, offset)
real (kind=dbl_kind), dimension(:,:,:), intent(inout), optional :: &
daidt, & ! change in ice area per time step
dvidt, & ! change in ice volume per time step
dvsdt, & ! change in snow volume per time step
dagedt ! change in ice age per time step

real (kind=dbl_kind), intent(in), optional :: &
Expand Down Expand Up @@ -829,25 +830,26 @@ subroutine update_state (dt, daidt, dvidt, dagedt, offset)
nt_strata = nt_strata(:,:), &
Tf = Tf(i,j,iblk))

if (present(offset)) then

!-----------------------------------------------------------------
! Compute thermodynamic area and volume tendencies.
!-----------------------------------------------------------------

daidt(i,j,iblk) = (aice(i,j,iblk) - daidt(i,j,iblk)) / dt
dvidt(i,j,iblk) = (vice(i,j,iblk) - dvidt(i,j,iblk)) / dt
if (tr_iage) then
if (offset > c0) then ! thermo
if (trcr(i,j,nt_iage,iblk) > c0) &
dagedt(i,j,iblk) = (trcr(i,j,nt_iage,iblk) &
- dagedt(i,j,iblk) - offset) / dt
else ! dynamics
dagedt(i,j,iblk) = (trcr(i,j,nt_iage,iblk) &
- dagedt(i,j,iblk)) / dt
endif
endif ! tr_iage
endif ! present(offset)
if (present(offset)) then

!-----------------------------------------------------------------
! Compute thermodynamic area and volume tendencies.
!-----------------------------------------------------------------

if (present(daidt)) daidt(i,j,iblk) = (aice(i,j,iblk) - daidt(i,j,iblk)) / dt
if (present(dvidt)) dvidt(i,j,iblk) = (vice(i,j,iblk) - dvidt(i,j,iblk)) / dt
if (present(dvsdt)) dvsdt(i,j,iblk) = (vsno(i,j,iblk) - dvsdt(i,j,iblk)) / dt
if (present(dagedt) .and. tr_iage) then
if (offset > c0) then ! thermo
if (trcr(i,j,nt_iage,iblk) > c0) &
dagedt(i,j,iblk) = (trcr(i,j,nt_iage,iblk) &
- dagedt(i,j,iblk) - offset) / dt
else ! dynamics
dagedt(i,j,iblk) = (trcr(i,j,nt_iage,iblk) &
- dagedt(i,j,iblk)) / dt
endif
endif ! tr_iage
endif ! present(offset)

enddo ! i
enddo ! j
Expand Down

0 comments on commit 29e1226

Please sign in to comment.