Skip to content

Commit 65be540

Browse files
committed
Bug fixes for multiple snow layers, from snow branch.
1 parent 6f5f797 commit 65be540

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

source/ice_itd.F90

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,7 @@ subroutine zap_small_areas (nx_block, ny_block, &
18801880
indxi , & ! compressed indices for i/j directions
18811881
indxj
18821882

1883-
real (kind=dbl_kind) :: xtmp, zspace ! temporary variable
1883+
real (kind=dbl_kind) :: xtmp ! temporary variable
18841884

18851885
!-----------------------------------------------------------------
18861886
! Initialize
@@ -1890,8 +1890,6 @@ subroutine zap_small_areas (nx_block, ny_block, &
18901890
istop = 0
18911891
jstop = 0
18921892

1893-
zspace = c1/max(c1,(real(nblyr,kind=dbl_kind)))
1894-
18951893
!-----------------------------------------------------------------
18961894
! I. Zap categories with very small areas.
18971895
!-----------------------------------------------------------------
@@ -2377,13 +2375,13 @@ subroutine zap_snow_temperature(nx_block, ny_block, &
23772375

23782376
l_zap = .false.
23792377

2380-
! check each snow layer - zap all if one is bad
2381-
do k = 1, nslyr
2378+
if (aicen(i,j,n) > puny) then
23822379

2383-
if (aicen(i,j,n) > puny) then
2380+
! snow thickness
2381+
hsn = vsnon(i,j,n) / aicen(i,j,n)
23842382

2385-
! snow thickness
2386-
hsn = vsnon(i,j,n) / aicen(i,j,n)
2383+
! check each snow layer - zap all if one is bad
2384+
do k = 1, nslyr
23872385

23882386
! snow enthalpy and max temperature
23892387
if (hsn > hs_min .and. heat_capacity) then
@@ -2410,10 +2408,10 @@ subroutine zap_snow_temperature(nx_block, ny_block, &
24102408
write(nu_diag,*) "zqsn:", zqsn
24112409
endif
24122410

2413-
endif ! aicen > puny
2414-
24152411
enddo ! k
24162412

2413+
endif ! aicen > puny
2414+
24172415
! add cell to zap list
24182416
if (l_zap) then
24192417
icells = icells + 1

source/ice_mechred.F90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,8 @@ subroutine ridge_shift (nx_block, ny_block, &
17391739
i = indxii(ij)
17401740
j = indxjj(ij)
17411741
m = indxij(ij)
1742-
esrdgn = vsrdgn(ij) * trcrn(i,j,nt_qsno+k-1,n)
1742+
esrdgn = vsrdgn(ij) * trcrn(i,j,nt_qsno+k-1,n) &
1743+
/ real(nslyr,kind=dbl_kind)
17431744
esnow_mlt(m) = esnow_mlt(m) + esrdgn*(c1-fsnowrdg)
17441745
enddo
17451746
enddo

source/ice_therm_mushy.F90

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3294,8 +3294,8 @@ subroutine flood_ice(hsn, hin, &
32943294
Sbr ! ice layer brine salinity (ppt)
32953295

32963296
real(kind=dbl_kind), intent(inout) :: &
3297-
hslyr , & ! ice layer thickness (m)
3298-
hilyr ! snow layer thickness (m)
3297+
hslyr , & ! snow layer thickness (m)
3298+
hilyr ! ice layer thickness (m)
32993299

33003300
real(kind=dbl_kind), intent(out) :: &
33013301
snoice ! snow ice formation
@@ -3350,7 +3350,7 @@ subroutine flood_ice(hsn, hin, &
33503350
! sea ice fraction of newly formed snow ice
33513351
phi_snowice = (c1 - rhos / rhoi)
33523352

3353-
! desnity of newly formed snowice
3353+
! density of newly formed snowice
33543354
rho_snowice = phi_snowice * rho_ocn + (c1 - phi_snowice) * rhoi
33553355

33563356
! calculate thickness of new ice added
@@ -3429,23 +3429,17 @@ subroutine enthalpy_snow_snowice(dh, hsn, zqsn, zqsn_snowice)
34293429
! snow depth and snow layers affected by snowice formation
34303430
if (hsn > puny) then
34313431
rnlyr = (dh / hsn) * nslyr
3432-
nlyr = min(floor(rnlyr),nslyr-1)
3433-
3434-
zqsn_snowice = c0
3435-
3432+
nlyr = min(floor(rnlyr),nslyr-1) ! nlyr=0 if nslyr=1
3433+
34363434
! loop over full snow layers affected
3435+
! not executed if nlyr=0
34373436
do k = nslyr, nslyr-nlyr+1, -1
3438-
34393437
zqsn_snowice = zqsn_snowice + zqsn(k) / rnlyr
3440-
34413438
enddo ! k
3442-
3439+
34433440
! partially converted snow layer
34443441
zqsn_snowice = zqsn_snowice + &
3445-
((rnlyr - real(nlyr,dbl_kind)) / rnlyr) * zqsn(nslyr)
3446-
3447-
zqsn_snowice = zqsn_snowice
3448-
3442+
((rnlyr - real(nlyr,dbl_kind)) / rnlyr) * zqsn(nslyr-nlyr)
34493443
endif
34503444

34513445
end subroutine enthalpy_snow_snowice

0 commit comments

Comments
 (0)