Skip to content

Commit

Permalink
Modify to new ice_calendar in DMI NUOPC routines (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrib authored Apr 14, 2021
1 parent 4d9cf31 commit f462721
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 42 deletions.
18 changes: 9 additions & 9 deletions cicecore/drivers/nuopc/dmi/CICE_FinalMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ subroutine CICE_Finalize

character(len=*), parameter :: subname = '(CICE_Finalize)'

!-------------------------------------------------------------------
! stop timers and print timer info
!-------------------------------------------------------------------
!-------------------------------------------------------------------
! stop timers and print timer info
!-------------------------------------------------------------------

call ice_timer_stop(timer_total) ! stop timing entire run
call ice_timer_print_all(stats=.false.) ! print timing information
Expand All @@ -55,15 +55,15 @@ subroutine CICE_Finalize
!echmod if (nu_diag /= 6) close (nu_diag) ! diagnostic output
call release_all_fileunits

!-------------------------------------------------------------------
! write 'finished' file if needed
!-------------------------------------------------------------------
!-------------------------------------------------------------------
! write 'finished' file if needed
!-------------------------------------------------------------------

if (runid == 'bering') call writeout_finished_file()

!-------------------------------------------------------------------
! quit MPI
!-------------------------------------------------------------------
!-------------------------------------------------------------------
! quit MPI
!-------------------------------------------------------------------

#ifndef coupled
#ifndef CICE_DMI
Expand Down
27 changes: 12 additions & 15 deletions cicecore/drivers/nuopc/dmi/CICE_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ subroutine CICE_Initialize(mpi_comm)

integer (kind=int_kind), optional, intent(in) :: mpi_comm ! communicator from nuopc
character(len=*), parameter :: subname='(CICE_Initialize)'
!--------------------------------------------------------------------
! model initialization
!--------------------------------------------------------------------
!--------------------------------------------------------------------
! model initialization
!--------------------------------------------------------------------

if (present(mpi_comm)) then
call cice_init(mpi_comm)
Expand All @@ -69,14 +69,15 @@ subroutine cice_init(mpi_comm)
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, time, istep, istep1, write_ic, &
init_calendar, calendar
use ice_calendar, only: dt, dt_dyn, istep, istep1, write_ic, &
init_calendar, advance_timestep, calc_timesteps
use ice_communicate, only: init_communicate, my_task, master_task
use ice_diagnostics, only: init_diags
use ice_domain, only: init_domain_blocks
use ice_domain_size, only: ncat, nfsd
use ice_dyn_eap, only: init_eap, alloc_dyn_eap
use ice_dyn_shared, only: kdyn, init_dyn, alloc_dyn_shared
use ice_dyn_vp, only: init_vp
use ice_flux, only: init_coupler_flux, init_history_therm, &
init_history_dyn, init_flux_atm, init_flux_ocn, alloc_flux
use ice_forcing, only: init_forcing_ocn, init_forcing_atmo, &
Expand All @@ -87,7 +88,8 @@ subroutine cice_init(mpi_comm)
use ice_history, only: init_hist, accum_hist
use ice_restart_shared, only: restart, runtype
use ice_init, only: input_data, init_state
use ice_init_column, only: init_thermo_vertical, init_shortwave, init_zbgc, input_zbgc, count_tracers
use ice_init_column, only: init_thermo_vertical, init_shortwave, &
init_zbgc, input_zbgc, count_tracers
use ice_kinds_mod
use ice_restoring, only: ice_HaloRestore_init
use ice_timers, only: timer_total, init_ice_timers, ice_timer_start
Expand Down Expand Up @@ -166,9 +168,6 @@ subroutine cice_init(mpi_comm)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)
#ifndef CICE_DMI
call calendar(time) ! determine the initial date
#endif
#ifndef CICE_IN_NEMO
call init_forcing_ocn(dt) ! initialize sss and sst from data
#endif
Expand All @@ -188,6 +187,7 @@ subroutine cice_init(mpi_comm)
call init_diags ! initialize diagnostic output points
call init_history_therm ! initialize thermo history variables
call init_history_dyn ! initialize dynamic history variables
call calc_timesteps ! update timestep counter if not using npt_unit="1"

call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero)
call icepack_query_tracer_flags(tr_iso_out=tr_iso)
Expand All @@ -204,10 +204,7 @@ subroutine cice_init(mpi_comm)
if (trim(runtype) == 'continue' .or. restart) &
call init_shortwave ! initialize radiative transfer

istep = istep + 1 ! update time step counters
istep1 = istep1 + 1
time = time + dt ! determine the time and date
call calendar(time) ! at the end of the first timestep
call advance_timestep()

!--------------------------------------------------------------------
! coupler communication or forcing data initialization
Expand Down Expand Up @@ -252,7 +249,7 @@ subroutine init_restart

use ice_arrays_column, only: dhsn
use ice_blocks, only: nx_block, ny_block
use ice_calendar, only: time, calendar
use ice_calendar, only: calendar
use ice_constants, only: c0
use ice_domain, only: nblocks
use ice_domain_size, only: ncat, n_iso, n_aero, nfsd
Expand Down Expand Up @@ -314,7 +311,7 @@ subroutine init_restart
if (trim(runtype) == 'continue') then
! start from core restart file
call restartfile() ! given by pointer in ice_in
call calendar(time) ! update time parameters
call calendar() ! update time parameters
if (kdyn == 2) call read_restart_eap ! EAP
else if (restart) then ! ice_ic = core restart file
call restartfile (ice_ic) ! or 'default' or 'none'
Expand Down
34 changes: 16 additions & 18 deletions cicecore/drivers/nuopc/dmi/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module CICE_RunMod

subroutine CICE_Run

use ice_calendar, only: istep, istep1, time, dt, stop_now, calendar
use ice_calendar, only: istep, istep1, dt, stop_now, advance_timestep
use ice_forcing, only: get_forcing_atmo, get_forcing_ocn, &
get_wave_spec
use ice_forcing_bgc, only: get_forcing_bgc, get_atm_bgc, &
Expand Down Expand Up @@ -73,20 +73,16 @@ subroutine CICE_Run
file=__FILE__, line=__LINE__)

#ifndef CICE_IN_NEMO
!--------------------------------------------------------------------
! timestep loop
!--------------------------------------------------------------------
!--------------------------------------------------------------------
! timestep loop
!--------------------------------------------------------------------
#ifndef CICE_DMI
timeLoop: do
timeLoop: do
#endif
#endif
call ice_step

istep = istep + 1 ! update time step counters
istep1 = istep1 + 1
time = time + dt ! determine the time and date

call calendar(time) ! at the end of the timestep
call advance_timestep() ! advance time

#ifndef CICE_IN_NEMO
#ifndef CICE_DMI
Expand Down Expand Up @@ -361,8 +357,8 @@ subroutine coupling_prep (iblk)
albpnd, albcnt, apeff_ai, fpond, fresh, l_mpond_fresh, &
alvdf_ai, alidf_ai, alvdr_ai, alidr_ai, fhocn_ai, &
fresh_ai, fsalt_ai, fsalt, &
fswthru_ai, fhocn, fswthru, scale_factor, snowfrac, &
fswthru_vdr, fswthru_vdf, fswthru_idr, fswthru_idf, &
fswthru_ai, fhocn, scale_factor, snowfrac, &
fswthru, fswthru_vdr, fswthru_vdf, fswthru_idr, fswthru_idf, &
swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, &
fsens, flat, fswabs, flwout, evap, Tref, Qref, &
scale_fluxes, frzmlt_init, frzmlt
Expand Down Expand Up @@ -556,11 +552,12 @@ subroutine coupling_prep (iblk)
evap (:,:,iblk), &
Tref (:,:,iblk), Qref (:,:,iblk), &
fresh (:,:,iblk), fsalt (:,:,iblk), &
fhocn (:,:,iblk), fswthru (:,:,iblk), &
fswthru_vdr(:,:,iblk), &
fswthru_vdf(:,:,iblk), &
fswthru_idr(:,:,iblk), &
fswthru_idf(:,:,iblk), &
fhocn (:,:,iblk), &
fswthru (:,:,iblk), &
fswthru_vdr (:,:,iblk), &
fswthru_vdf (:,:,iblk), &
fswthru_idr (:,:,iblk), &
fswthru_idf (:,:,iblk), &
faero_ocn(:,:,:,iblk), &
alvdr (:,:,iblk), alidr (:,:,iblk), &
alvdf (:,:,iblk), alidf (:,:,iblk), &
Expand Down Expand Up @@ -635,11 +632,12 @@ subroutine sfcflux_to_ocn(nx_block, ny_block, &

real (kind=dbl_kind) :: &
puny, & !
Lsub, & !
rLsub ! 1/Lsub

character(len=*), parameter :: subname = '(sfcflux_to_ocn)'

call icepack_query_parameters(puny_out=puny)
call icepack_query_parameters(puny_out=puny, Lsub_out=Lsub)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)
Expand Down

0 comments on commit f462721

Please sign in to comment.