Skip to content

Commit 6da5668

Browse files
authored
Add dorebin and docleanup optional arguments to icepack_step_ridge (#503)
Add dorebin and docleanup optional arguments to icepack_step_ridge to support NOT calling cleanup_itd and NOT calling rebin in the ridge_ice. Closes #478 Rename limit_aice_in argument in ridge_ice to limit_aice. This argument is not used in Icepack or CICE at the moment. Update interface document Based on https://github.com/ESMG/Icepack/tree/optional_cleanup
1 parent f5f03b9 commit 6da5668

File tree

3 files changed

+60
-21
lines changed

3 files changed

+60
-21
lines changed

columnphysics/icepack_itd.F90

+24-15
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,8 @@ end subroutine column_conservation_check
738738
!=======================================================================
739739

740740
! Cleanup subroutine that rebins thickness categories if necessary,
741-
! eliminates very small ice areas while conserving mass and energy,
742-
! aggregates state variables, and does a boundary call.
741+
! eliminates very small ice areas while conserving mass and energy
742+
! and aggregates state variables.
743743
! It is a good idea to call this subroutine after the thermodynamics
744744
! (thermo_vertical/thermo_itd) and again after the dynamics
745745
! (evp/transport/ridging).
@@ -758,7 +758,8 @@ subroutine cleanup_itd (dt, hin_max, &
758758
fpond, fresh, &
759759
fsalt, fhocn, &
760760
faero_ocn, fiso_ocn, &
761-
flux_bio, Tf, limit_aice_in)
761+
flux_bio, Tf, &
762+
limit_aice, dorebin)
762763

763764
real (kind=dbl_kind), intent(in) :: &
764765
dt ! time step
@@ -817,8 +818,9 @@ subroutine cleanup_itd (dt, hin_max, &
817818
fiso_ocn ! isotope flux to ocean (kg/m^2/s)
818819

819820
logical (kind=log_kind), intent(in), optional :: &
820-
limit_aice_in ! if false, allow aice to be out of bounds
821-
! may want to allow this for unit tests
821+
dorebin, & ! if false, do not call rebin (default true)
822+
limit_aice ! if false, allow aice to be out of bounds
823+
! may want to allow this for unit tests (default true)
822824

823825
! local variables
824826

@@ -842,18 +844,25 @@ subroutine cleanup_itd (dt, hin_max, &
842844
dflux_bio ! zapped biology flux (mmol/m^2/s)
843845

844846
logical (kind=log_kind) :: &
845-
limit_aice ! if true, check for aice out of bounds
847+
ldorebin , & ! if true, call rebin
848+
llimit_aice ! if true, check for aice out of bounds
846849

847850
character(len=*),parameter :: subname='(cleanup_itd)'
848851

849852
!-----------------------------------------------------------------
850853
! Initialize
851854
!-----------------------------------------------------------------
852855

853-
if (present(limit_aice_in)) then
854-
limit_aice = limit_aice_in
856+
if (present(limit_aice)) then
857+
llimit_aice = limit_aice
855858
else
856-
limit_aice = .true.
859+
llimit_aice = .true.
860+
endif
861+
862+
if (present(dorebin)) then
863+
ldorebin = dorebin
864+
else
865+
ldorebin = .true.
857866
endif
858867

859868
dfpond = c0
@@ -871,7 +880,7 @@ subroutine cleanup_itd (dt, hin_max, &
871880
call aggregate_area (aicen, aice, aice0)
872881
if (icepack_warnings_aborted(subname)) return
873882

874-
if (limit_aice) then ! check for aice out of bounds
883+
if (llimit_aice) then ! check for aice out of bounds
875884
if (aice > c1+puny .or. aice < -puny) then
876885
call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
877886
call icepack_warnings_add(subname//' aggregate ice area out of bounds')
@@ -883,13 +892,13 @@ subroutine cleanup_itd (dt, hin_max, &
883892
enddo
884893
return
885894
endif
886-
endif ! limit_aice
895+
endif ! llimit_aice
887896

888897
!-----------------------------------------------------------------
889898
! Identify grid cells with ice.
890899
!-----------------------------------------------------------------
891900

892-
if (aice > puny) then
901+
if (ldorebin .and. aice > puny) then
893902

894903
!-----------------------------------------------------------------
895904
! Make sure ice in each category is within its thickness bounds.
@@ -898,7 +907,7 @@ subroutine cleanup_itd (dt, hin_max, &
898907
! correctly (e.g., very fast ice growth).
899908
!-----------------------------------------------------------------
900909

901-
call rebin (trcr_depend, &
910+
call rebin (trcr_depend, &
902911
trcr_base, &
903912
n_trcr_strata, &
904913
nt_strata, &
@@ -913,7 +922,7 @@ subroutine cleanup_itd (dt, hin_max, &
913922
! Zero out ice categories with very small areas.
914923
!-----------------------------------------------------------------
915924

916-
if (limit_aice) then
925+
if (llimit_aice) then
917926
call zap_small_areas (dt, &
918927
aice, aice0, &
919928
aicen, trcrn, &
@@ -937,7 +946,7 @@ subroutine cleanup_itd (dt, hin_max, &
937946
return
938947
endif
939948

940-
endif ! l_limit_aice
949+
endif ! llimit_aice
941950

942951
!-------------------------------------------------------------------
943952
! Zap snow that has out of bounds temperatures

columnphysics/icepack_mechred.F90

+29-5
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,9 @@ subroutine icepack_step_ridge(dt, ndtd, &
17401740
araftn, vraftn, &
17411741
aice, fsalt, &
17421742
first_ice, fzsal, &
1743-
flux_bio, closing, Tf )
1743+
flux_bio, closing, &
1744+
Tf, &
1745+
docleanup, dorebin)
17441746

17451747
real (kind=dbl_kind), intent(in) :: &
17461748
dt ! time step
@@ -1815,13 +1817,21 @@ subroutine icepack_step_ridge(dt, ndtd, &
18151817
logical (kind=log_kind), dimension(:), intent(inout) :: &
18161818
first_ice ! true until ice forms
18171819

1820+
logical (kind=log_kind), intent(in), optional :: &
1821+
docleanup, & ! if false, do not call cleanup_itd (default true)
1822+
dorebin ! if false, do not call rebin in cleanup_itd (default true)
1823+
18181824
!autodocument_end
18191825

18201826
! local variables
18211827

18221828
real (kind=dbl_kind) :: &
18231829
dtt ! thermo time step
18241830

1831+
logical (kind=log_kind) :: &
1832+
ldocleanup, &! if true, call cleanup_itd
1833+
ldorebin ! if true, call rebin in cleanup_itd
1834+
18251835
logical (kind=log_kind), save :: &
18261836
first_call = .true. ! first call flag
18271837

@@ -1841,6 +1851,17 @@ subroutine icepack_step_ridge(dt, ndtd, &
18411851
endif
18421852
endif
18431853

1854+
if (present(docleanup)) then
1855+
ldocleanup = docleanup
1856+
else
1857+
ldocleanup = .true.
1858+
endif
1859+
1860+
if (present(dorebin)) then
1861+
ldorebin = dorebin
1862+
else
1863+
ldorebin = .true.
1864+
endif
18441865

18451866
!-----------------------------------------------------------------
18461867
! Identify ice-ocean cells.
@@ -1880,8 +1901,9 @@ subroutine icepack_step_ridge(dt, ndtd, &
18801901
! categories with very small areas.
18811902
!-----------------------------------------------------------------
18821903

1883-
dtt = dt * ndtd ! for proper averaging over thermo timestep
1884-
call cleanup_itd (dtt, hin_max, &
1904+
if (ldocleanup) then
1905+
dtt = dt * ndtd ! for proper averaging over thermo timestep
1906+
call cleanup_itd(dtt, hin_max, &
18851907
aicen, trcrn, &
18861908
vicen, vsnon, &
18871909
aice0, aice, &
@@ -1893,8 +1915,10 @@ subroutine icepack_step_ridge(dt, ndtd, &
18931915
fpond, fresh, &
18941916
fsalt, fhocn, &
18951917
faero_ocn, fiso_ocn, &
1896-
flux_bio, Tf)
1897-
if (icepack_warnings_aborted(subname)) return
1918+
flux_bio, Tf, &
1919+
dorebin = ldorebin)
1920+
if (icepack_warnings_aborted(subname)) return
1921+
endif
18981922

18991923
first_call = .false.
19001924

doc/source/user_guide/interfaces.include

+7-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,9 @@ icepack_step_ridge
497497
araftn, vraftn, &
498498
aice, fsalt, &
499499
first_ice, fzsal, &
500-
flux_bio, closing, Tf )
500+
flux_bio, closing, &
501+
Tf, &
502+
docleanup, dorebin)
501503

502504
real (kind=dbl_kind), intent(in) :: &
503505
dt ! time step
@@ -572,6 +574,10 @@ icepack_step_ridge
572574
logical (kind=log_kind), dimension(:), intent(inout) :: &
573575
first_ice ! true until ice forms
574576

577+
logical (kind=log_kind), intent(in), optional :: &
578+
docleanup, & ! if false, do not call cleanup_itd (default true)
579+
dorebin ! if false, do not call rebin in cleanup_itd (default true)
580+
575581

576582

577583
icepack_mushy_physics.F90

0 commit comments

Comments
 (0)