Skip to content

Commit

Permalink
+Changed interface to ice_line
Browse files Browse the repository at this point in the history
  Changed the interface to ice_line to take a time-type argument instead of a
list of integers.  Also made some minor rearragement of variable assignments and
clocks in SIS_dynamics_trans, which might fix a recently introduced issue with
slab ice configurations (which are not used or tested).  All answers are bitwise
identical in the MOM6-examples test cases.
  • Loading branch information
Hallberg-NOAA committed Feb 5, 2019
1 parent 3d718e8 commit 8c7dd19
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
35 changes: 12 additions & 23 deletions src/SIS_dyn_trans.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module SIS_dyn_trans
use MOM_hor_index, only : hor_index_type ! , hor_index_init
! use MOM_string_functions, only : uppercase
use MOM_time_manager, only : time_type, time_type_to_real, real_to_time
use MOM_time_manager, only : get_date, get_time, set_date, operator(+), operator(-)
use MOM_time_manager, only : operator(+), operator(-)
use MOM_time_manager, only : operator(>), operator(*), operator(/), operator(/=)
use MOM_EOS, only : EOS_type, calculate_density_derivs

Expand Down Expand Up @@ -309,22 +309,24 @@ subroutine SIS_dynamics_trans(IST, OSS, FIA, IOF, dt_slow, CS, icebergs_CS, G, I

real :: dt_slow_dyn ! The slow dynamics timestep [s].
real :: dt_adv ! The advective timestep [s].
real :: Idt_slow ! The inverse of dt_slow_dyn [s-1].
real :: Idt_slow ! The inverse of dt_slow [s-1].
real, dimension(SZI_(G),SZJ_(G)) :: &
! rdg_s2o, & ! snow mass [kg m-2] dumped into ocean during ridging
rdg_rate, & ! A ridging rate [s-1], this will be calculated from the strain rates in the dynamics.
snow2ocn ! Snow dumped into ocean during ridging [kg m-2]
integer :: i, j, k, l, m, n, isc, iec, jsc, jec, ncat
integer :: isd, ied, jsd, jed
integer :: ndyn_steps, nds ! The number of dynamic steps.
integer :: iyr, imon, iday, ihr, imin, isec

real, parameter :: T_0degC = 273.15 ! 0 degrees C in Kelvin

isc = G%isc ; iec = G%iec ; jsc = G%jsc ; jec = G%jec ; ncat = IG%CatIce
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed
Idt_slow = 0.0 ; if (dt_slow > 0.0) Idt_slow = 1.0/dt_slow

CS%n_calls = CS%n_calls + 1
IOF%stress_count = 0

if (CS%specified_ice) then
ndyn_steps = 0 ; dt_slow_dyn = 0.0
!$OMP parallel do default(shared)
Expand All @@ -338,9 +340,6 @@ subroutine SIS_dynamics_trans(IST, OSS, FIA, IOF, dt_slow, CS, icebergs_CS, G, I
ndyn_steps = max(CEILING(dt_slow/CS%dt_ice_dyn - 0.000001), 1)
dt_slow_dyn = dt_slow / ndyn_steps
endif
IOF%stress_count = 0

CS%n_calls = CS%n_calls + 1

do nds=1,ndyn_steps

Expand Down Expand Up @@ -615,11 +614,9 @@ subroutine SIS_dynamics_trans(IST, OSS, FIA, IOF, dt_slow, CS, icebergs_CS, G, I
! Add snow mass dumped into ocean to flux of frozen precipitation:
!### WARNING - rdg_s2o is never calculated!!!
! if (CS%do_ridging) then ; do k=1,ncat ; do j=jsc,jec ; do i=isc,iec
! FIA%fprec_top(i,j,k) = FIA%fprec_top(i,j,k) + rdg_s2o(i,j)/dt_slow
! FIA%fprec_top(i,j,k) = FIA%fprec_top(i,j,k) + rdg_s2o(i,j) * Idt_slow
! enddo ; enddo ; enddo ; endif

call mpp_clock_begin(iceClock9)

! Set appropriate surface quantities in categories with no ice.
if (allocated(IST%t_surf)) then
!$OMP parallel do default(shared)
Expand All @@ -628,35 +625,27 @@ subroutine SIS_dynamics_trans(IST, OSS, FIA, IOF, dt_slow, CS, icebergs_CS, G, I
enddo ; enddo ; enddo
endif

if (CS%bounds_check) call IST_bounds_check(IST, G, IG, "After ice_transport", OSS=OSS)
if (CS%debug) call IST_chksum("After ice_transport", IST, G, IG)
! Calculate and output various diagnostics of the ice state.
call mpp_clock_begin(iceClock9)

call enable_SIS_averaging(dt_slow, CS%Time, CS%diag)

call post_ice_state_diagnostics(CS, IST, OSS, IOF, dt_slow, CS%Time, G, IG, CS%diag)

call disable_SIS_averaging(CS%diag)

if (CS%verbose) then
call get_date(CS%Time, iyr, imon, iday, ihr, imin, isec)
call get_time(CS%Time-set_date(iyr,1,1,0,0,0), isec, iday)
call ice_line(iyr, iday+1, isec, IST%part_size(isc:iec,jsc:jec,0), OSS%SST_C(:,:), G)
endif

call mpp_clock_end(iceClock9)

if (CS%verbose) call ice_line(CS%Time, IST%part_size(isc:iec,jsc:jec,0), OSS%SST_C(:,:), G)
if (CS%debug) call IST_chksum("End SIS_dynamics_trans", IST, G, IG)

if (CS%bounds_check) call IST_bounds_check(IST, G, IG, "End of SIS_dynamics_trans", OSS=OSS)

if (CS%Time + real_to_time(0.5*dt_slow) > CS%write_ice_stats_time) then
call write_ice_statistics(IST, CS%Time, CS%n_calls, G, IG, CS%sum_output_CSp, &
tracer_CSp = tracer_CSp)
tracer_CSp=tracer_CSp)
CS%write_ice_stats_time = CS%write_ice_stats_time + CS%ice_stats_interval
elseif (CS%column_check) then
call write_ice_statistics(IST, CS%Time, CS%n_calls, G, IG, CS%sum_output_CSp)
endif

call mpp_clock_end(iceClock9)

end subroutine SIS_dynamics_trans

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
Expand Down
14 changes: 10 additions & 4 deletions src/SIS_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module SIS_utils
use MOM_domains, only : SCALAR_PAIR, CGRID_NE, BGRID_NE, To_All
use MOM_error_handler, only : SIS_error=>MOM_error, FATAL, WARNING, SIS_mesg=>MOM_mesg
use MOM_error_handler, only : is_root_pe
use MOM_time_manager, only : time_type, get_date, get_time, set_date, operator(-)
use SIS_diag_mediator, only : post_SIS_data, SIS_diag_ctrl
use SIS_debugging, only : hchksum, Bchksum, uvchksum, hchksum_pair, Bchksum_pair
use SIS_debugging, only : check_redundant_B
Expand Down Expand Up @@ -77,10 +78,8 @@ end subroutine get_avg
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
!> ice_line writes out a line with the northern and southern hemisphere ice
!! extents and global mean sea surface temperature.
subroutine ice_line(year, day, second, cn_ocn, sst, G)
integer, intent(in) :: year !< The current model year
integer, intent(in) :: day !< The current model year-day
integer, intent(in) :: second !< The second of the day
subroutine ice_line(Time, cn_ocn, sst, G)
type(time_type), intent(in) :: Time !< The ending time of these diagnostics
type(SIS_hor_grid_type), intent(in) :: G !< The horizontal grid type
real, dimension(G%isc:G%iec,G%jsc:G%jec), &
intent(in) :: cn_ocn !< The concentration of ocean in each cell [nondim], 0-1.
Expand All @@ -89,9 +88,16 @@ subroutine ice_line(year, day, second, cn_ocn, sst, G)

real, dimension(G%isc:G%iec,G%jsc:G%jec) :: x
real :: gx(3)
integer :: year !< The current model year
integer :: day !< The current model year-day
integer :: second !< The second of the day
integer :: mon, hr, min
integer :: n, i, j, isc, iec, jsc, jec
isc = G%isc ; iec = G%iec ; jsc = G%jsc ; jec = G%jec

call get_date(Time, year, mon, day, hr, min, second)
call get_time(Time-set_date(year,1,1,0,0,0), second, day)

if (.not.(second==0 .and. mod(day,5)==0) ) return

do n=-1,1,2
Expand Down

0 comments on commit 8c7dd19

Please sign in to comment.