Skip to content

Commit

Permalink
This PR has been updated to include dvsdtt (thermodynamic tendency
Browse files Browse the repository at this point in the history
for snow). Also, the calls to update_state have been updated in all
of the drivers. Note that I can only test the NUOPC/CMEPS and standalone
drivers, so it would be good if others could test.
  • Loading branch information
dabail10 committed Mar 14, 2024
1 parent e68dd14 commit 73e4338
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 47 deletions.
5 changes: 4 additions & 1 deletion cicecore/cicedyn/general/ice_flux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ module ice_flux
dsnow, & ! change in snow thickness (m/step-->cm/day)
daidtt, & ! ice area tendency thermo. (s^-1)
dvidtt, & ! ice volume tendency thermo. (m/s)
dvsdtt, & ! snow volume tendency thermo. (m/s)
dagedtt,& ! ice age tendency thermo. (s/s)
mlt_onset, &! day of year that sfc melting begins
frz_onset, &! day of year that freezing begins (congel or frazil)
Expand Down Expand Up @@ -532,6 +533,7 @@ subroutine alloc_flux
dsnow (nx_block,ny_block,max_blocks), & ! change in snow thickness (m/step-->cm/day)
daidtt (nx_block,ny_block,max_blocks), & ! ice area tendency thermo. (s^-1)
dvidtt (nx_block,ny_block,max_blocks), & ! ice volume tendency thermo. (m/s)
dvsdtt (nx_block,ny_block,max_blocks), & ! snow volume tendency thermo. (m/s)
dagedtt (nx_block,ny_block,max_blocks), & ! ice age tendency thermo. (s/s)
mlt_onset (nx_block,ny_block,max_blocks), & ! day of year that sfc melting begins
frz_onset (nx_block,ny_block,max_blocks), & ! day of year that freezing begins (congel or frazil)
Expand Down Expand Up @@ -920,7 +922,7 @@ end subroutine init_flux_ocn

subroutine init_history_therm

use ice_state, only: aice, vice, trcr
use ice_state, only: aice, vice, vsno, trcr
use ice_arrays_column, only: &
hfreebd, hdraft, hridge, distrdg, hkeel, dkeel, lfloe, dfloe, &
Cdn_atm_skin, Cdn_atm_floe, Cdn_atm_pond, Cdn_atm_rdg, &
Expand Down Expand Up @@ -967,6 +969,7 @@ subroutine init_history_therm
meltl (:,:,:) = c0
daidtt (:,:,:) = aice(:,:,:) ! temporary initial area
dvidtt (:,:,:) = vice(:,:,:) ! temporary initial volume
dvsdtt (:,:,:) = vsno(:,:,:) ! temporary initial volume
if (tr_iage) then
dagedtt(:,:,:) = trcr(:,:,nt_iage,:) ! temporary initial age
else
Expand Down
8 changes: 5 additions & 3 deletions cicecore/drivers/direct/hadgem3/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ subroutine ice_step
use ice_dyn_eap, only: write_restart_eap
use ice_dyn_shared, only: kdyn
use ice_flux, only: scale_factor, init_history_therm, &
daidtt, daidtd, dvidtt, dvidtd, dagedtt, dagedtd
daidtt, daidtd, dvidtt, dvidtd, dvsdtt, 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 @@ -238,7 +238,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, dvsdt=dvsdtt, &
dagedt=dagedtt, offset=offset)

call ice_timer_stop(timer_thermo) ! thermodynamics
call ice_timer_stop(timer_column) ! column physics
Expand All @@ -265,7 +266,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
8 changes: 5 additions & 3 deletions cicecore/drivers/direct/nemo_concepts/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ subroutine ice_step
use ice_dyn_eap, only: write_restart_eap
use ice_dyn_shared, only: kdyn
use ice_flux, only: scale_factor, init_history_therm, &
daidtt, daidtd, dvidtt, dvidtd, dagedtt, dagedtd
daidtt, daidtd, dvidtt, dvidtd, dvsdtt, 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 @@ -238,7 +238,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, dvsdt=dvsdtt, &
dagedt=dagedtt, offset=offset)

call ice_timer_stop(timer_thermo) ! thermodynamics
call ice_timer_stop(timer_column) ! column physics
Expand All @@ -265,7 +266,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
10 changes: 6 additions & 4 deletions cicecore/drivers/mct/cesm1/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,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, dvsdtt, 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 @@ -261,7 +261,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, dvsdt=dvsdtt, &
dagedt=dagedtt, offset=offset)

call ice_timer_stop(timer_thermo) ! thermodynamics
call ice_timer_stop(timer_column) ! column physics
Expand Down Expand Up @@ -302,7 +303,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 All @@ -326,7 +328,7 @@ subroutine ice_step
call step_snow (dt, iblk)
enddo
!$OMP END PARALLEL DO
call update_state (dt) ! clean up
call update_state (dt=dt) ! clean up
endif

!$OMP PARALLEL DO PRIVATE(iblk) SCHEDULE(runtime)
Expand Down
10 changes: 6 additions & 4 deletions cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,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, dvsdtd, dagedtt, dagedtd
daidtt, daidtd, dvidtt, dvidtd, dvsdtt, 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 @@ -250,7 +250,8 @@ subroutine ice_step

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

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

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

enddo
if (debug_model) then
Expand All @@ -318,7 +320,7 @@ subroutine ice_step
do iblk = 1, nblocks
call step_snow (dt, iblk)
enddo
call update_state (dt) ! clean up
call update_state (dt=dt) ! clean up
endif

!MHRI: CHECK THIS OMP
Expand Down
10 changes: 6 additions & 4 deletions cicecore/drivers/nuopc/dmi/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,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, dvsdtt, 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 @@ -273,7 +273,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, dvsdt=dvsdtt, &
dagedt=dagedtt, offset=offset)

call ice_timer_stop(timer_thermo) ! thermodynamics
call ice_timer_stop(timer_column) ! column physics
Expand Down Expand Up @@ -314,7 +315,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 All @@ -338,7 +340,7 @@ subroutine ice_step
call step_snow (dt, iblk)
enddo
!$OMP END PARALLEL DO
call update_state (dt) ! clean up
call update_state (dt=dt) ! clean up
endif

!MHRI: CHECK THIS OMP
Expand Down
8 changes: 4 additions & 4 deletions cicecore/drivers/standalone/cice/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, dvsdtd, dagedtt, dagedtd
daidtt, daidtd, dvidtt, dvidtd, dvsdtt, 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,8 +265,8 @@ subroutine ice_step

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

call ice_timer_stop(timer_thermo) ! thermodynamics
call ice_timer_stop(timer_column) ! column physics
Expand Down Expand Up @@ -332,7 +332,7 @@ subroutine ice_step
call step_snow (dt, iblk)
enddo
!$OMP END PARALLEL DO
call update_state (dt) ! clean up
call update_state (dt=dt) ! clean up
endif

!$OMP PARALLEL DO PRIVATE(iblk) SCHEDULE(runtime)
Expand Down
10 changes: 6 additions & 4 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, dvsdtt, 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, dvsdt=dvsdtt, &
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, daidtd=daidtd, dvidt=dvidtd, dvsdt=dvsdtd, &
dagedt=dagedtd, offset=offset)

enddo

Expand All @@ -330,7 +332,7 @@ subroutine ice_step
call step_snow (dt, iblk)
enddo
!$OMP END PARALLEL DO
call update_state (dt) ! clean up
call update_state (dt=dt) ! clean up
endif

!$OMP PARALLEL DO PRIVATE(iblk) SCHEDULE(runtime)
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 (tr_iage .and. present(dagedt)) 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 73e4338

Please sign in to comment.