Skip to content

Commit

Permalink
Add checks for optional afsdn and allocate l_afsdn
Browse files Browse the repository at this point in the history
  • Loading branch information
dabail10 committed Oct 9, 2024
1 parent d8c458d commit a8911c3
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions columnphysics/icepack_therm_vertical.F90
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ subroutine frzmlt_bottom_lateral (dt, &
real (kind=dbl_kind), intent(out), optional :: &
wlat ! lateral melt rate (m/s)

real (kind=dbl_kind), dimension(:), intent(in), optional :: &
real (kind=dbl_kind), dimension(:), intent(in) :: &
aicen ! ice concentration

real (kind=dbl_kind), dimension (:,:), intent(in), optional :: &
Expand Down Expand Up @@ -2439,6 +2439,9 @@ subroutine icepack_step_therm1(dt, &
real (kind=dbl_kind), dimension(ncat) :: &
l_meltsliqn ! mass of snow melt local (kg/m^2)

real (kind=dbl_kind), dimension(:,:), allocatable :: &
l_afsdn ! (kg/m^2)

real (kind=dbl_kind) :: &
l_fswthrun_vdr, & ! vis dir SW local n ice to ocean (W/m^2)
l_fswthrun_vdf, & ! vis dif SW local n ice to ocean (W/m^2)
Expand Down Expand Up @@ -2487,6 +2490,13 @@ subroutine icepack_step_therm1(dt, &
call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
return
endif
if (tr_fsd) then
if (.not.present(afsdn)) then
call icepack_warnings_add(subname//' error in fsd arguments, tr_fsd=T')
call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
return
endif
endif
endif

!-----------------------------------------------------------------
Expand All @@ -2500,6 +2510,14 @@ subroutine icepack_step_therm1(dt, &
l_meltsliq = c0
l_meltsliqn = c0

if (tr_fsd) then
allocate(l_afsdn(nfsd,ncat))
l_afsdn(:,:) = afsdn(:,:)
else
allocate(l_afsdn(1,1))
l_afsdn = c0
endif

! solid and liquid components of snow mass
massicen(:,:) = c0
massliqn(:,:) = c0
Expand Down Expand Up @@ -2569,7 +2587,7 @@ subroutine icepack_step_therm1(dt, &
Tbot, fbot, &
rsiden, Cdn_ocn, &
wlat, aicen, &
afsdn)
afsdn = l_afsdn)

if (icepack_warnings_aborted(subname)) return

Expand Down

0 comments on commit a8911c3

Please sign in to comment.