Skip to content

Commit

Permalink
Merge branch 'concepts/restore-nul' into 'concepts/main' (!35)
Browse files Browse the repository at this point in the history
ice_restoring: allow restoring ice state to zero
  • Loading branch information
phil-blain committed Feb 9, 2024
2 parents cf0419d + 39fb640 commit 567cc6a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
8 changes: 6 additions & 2 deletions cicecore/cicedyn/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ subroutine input_data
algo_nonlin, fpfunc_andacc, dim_andacc, reltol_andacc, &
damping_andacc, start_andacc, use_mean_vrel, ortho_type
use ice_transport_driver, only: advection, conserv_check
use ice_restoring, only: restore_ice
use ice_restoring, only: restore_ice, restore_ice_to
use ice_timers, only: timer_stats
use ice_memusage, only: memory_stats
#ifdef CESMCOUPLED
Expand Down Expand Up @@ -265,7 +265,7 @@ subroutine input_data
highfreq, natmiter, atmiter_conv, calc_dragio, &
ustar_min, emissivity, iceruf, iceruf_ocn, &
fbot_xfer_type, update_ocn_f, l_mpond_fresh, tfrz_option, &
saltflux_option,ice_ref_salinity,zTrf, &
saltflux_option,ice_ref_salinity,zTrf, restore_ice_to, &
oceanmixed_ice, restore_ice, restore_ocn, trestore, &
precip_units, default_season, wave_spec_type,nfreq, &
atm_data_type, ocn_data_type, bgc_data_type, fe_data_type, &
Expand Down Expand Up @@ -532,6 +532,7 @@ subroutine input_data
restore_ocn = .false. ! restore sst if true
trestore = 90 ! restoring timescale, days (0 instantaneous)
restore_ice = .false. ! restore ice state on grid edges if true
restore_ice_to = 'initial' ! restore ice state to initial ice state ('initial'), hardcoded values ('defined') or zero ('zero')
debug_forcing = .false. ! true writes diagnostics for input forcing

latpnt(1) = 90._dbl_kind ! latitude of diagnostic point 1 (deg)
Expand Down Expand Up @@ -1035,6 +1036,7 @@ subroutine input_data
call broadcast_scalar(restore_ocn, master_task)
call broadcast_scalar(trestore, master_task)
call broadcast_scalar(restore_ice, master_task)
call broadcast_scalar(restore_ice_to, master_task)
call broadcast_scalar(debug_forcing, master_task)
call broadcast_array (latpnt(1:2), master_task)
call broadcast_array (lonpnt(1:2), master_task)
Expand Down Expand Up @@ -2339,6 +2341,8 @@ subroutine input_data
write(nu_diag,1011) ' restore_ocn = ', restore_ocn
endif
write(nu_diag,1011) ' restore_ice = ', restore_ice
if (restore_ice) &
write(nu_diag,1031) ' restore_ice_to = ', restore_ice_to
if (restore_ice .or. restore_ocn) &
write(nu_diag,1021) ' trestore = ', trestore

Expand Down
25 changes: 15 additions & 10 deletions cicecore/cicedyn/infrastructure/ice_restoring.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ module ice_restoring
logical (kind=log_kind), public :: &
restore_ice ! restore ice state if true

character(len=char_len), public :: &
restore_ice_to ! values to which ice state is restored
! 'initial' => restore to initial ice state
! 'defined' => restore to hardcoded values
! 'zero' => restore to zero

!-----------------------------------------------------------------
! state of the ice for each category
!-----------------------------------------------------------------
Expand Down Expand Up @@ -70,10 +76,6 @@ subroutine ice_HaloRestore_init
ntrcr, &!
npad ! padding column/row counter

character (len=7), parameter :: &
! restore_ic = 'defined' ! otherwise restore to initial ice state
restore_ic = 'initial' ! restore to initial ice state

type (block) :: &
this_block ! block info for current block

Expand All @@ -88,9 +90,7 @@ subroutine ice_HaloRestore_init

if ((ew_boundary_type == 'open' .or. &
ns_boundary_type == 'open') .and. .not.(restart_ext)) then
if (my_task == master_task) write (nu_diag,*) 'ERROR: restart_ext=F and open boundaries'
call abort_ice(error_message=subname//'open boundary and restart_ext=F', &
file=__FILE__, line=__LINE__)
if (my_task == master_task) write (nu_diag,*) 'WARNING: restart_ext=F and open boundaries'
endif

allocate (aicen_rest(nx_block,ny_block,ncat,max_blocks), &
Expand All @@ -109,7 +109,7 @@ subroutine ice_HaloRestore_init
! these arrays could be set to values read from a file...
!-----------------------------------------------------------------------

if (trim(restore_ic) == 'defined') then
if (trim(restore_ice_to) == 'defined') then

! restore to defined ice state
!$OMP PARALLEL DO PRIVATE(iblk,ilo,ihi,jlo,jhi,this_block, &
Expand Down Expand Up @@ -140,7 +140,7 @@ subroutine ice_HaloRestore_init
enddo ! iblk
!$OMP END PARALLEL DO

else ! restore_ic
elseif (trim(restore_ice_to) == 'initial') then

! restore to initial ice state

Expand Down Expand Up @@ -257,7 +257,12 @@ subroutine ice_HaloRestore_init
enddo ! iblk
!$OMP END PARALLEL DO

endif ! restore_ic
elseif (trim(restore_ice_to) == 'zero') then
! nothing more to do, already zero-initialized
else ! restore_ice_to
call abort_ice(error_message=subname//'wrong value for restore_ice_to: ' // restore_ice_to, &
file=__FILE__, line=__LINE__)
endif ! restore_ice_to

!-----------------------------------------------------------------
! Impose land mask
Expand Down
1 change: 1 addition & 0 deletions configuration/scripts/ice_in
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@
nfreq = 25
restart_coszen = .false.
restore_ice = .false.
restore_ice_to = 'initial'
restore_ocn = .false.
trestore = 90
precip_units = 'mm_per_month'
Expand Down

0 comments on commit 567cc6a

Please sign in to comment.