Skip to content

Commit ea1ae85

Browse files
authored
Merge pull request NCAR#339 from ClaraDraper-NOAA/fix/stc_check
Bugfixes to SLC checks, post-LIAU
2 parents e3d5f64 + b334a18 commit ea1ae85

1 file changed

Lines changed: 25 additions & 72 deletions

File tree

physics/SFC_Models/Land/Noahmp/noahmpdrv.F90

Lines changed: 25 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,17 @@ subroutine noahmpdrv_timestep_init (itime, fhour, delt, km, ncols, &
187187

188188
integer :: lsoil_incr
189189
integer, allocatable :: mask_tile(:)
190-
integer,allocatable :: stc_updated(:), slc_updated(:)
190+
integer,allocatable :: stc_updated(:)
191191
logical :: soil_freeze, soil_ice
192-
integer :: soiltype, n_stc, n_slc
192+
integer :: soiltype
193193
real(kind=kind_phys) :: slc_new
194194

195195
integer :: i, j, ij, l, k, ib
196196
integer :: lensfc
197197

198198
real(kind=kind_phys) :: smp !< for computing supercooled water
199199
real(kind=kind_phys) :: hc_incr
200-
201-
integer :: nother, nsnowupd
202-
integer :: nstcupd, nslcupd, nfrozen, nfrozen_upd
203-
logical :: print_update_stats = .False.
200+
real(kind=kind_phys), parameter :: tfreez_noahmp=273.16 ! tfreez used in NoahMP to determine frozen ground
204201

205202
! --- Initialize CCPP error handling variables
206203
errmsg = ''
@@ -223,7 +220,7 @@ subroutine noahmpdrv_timestep_init (itime, fhour, delt, km, ncols, &
223220
endif
224221

225222
if(Land_IAU_Control%me == Land_IAU_Control%mpi_root) then
226-
print*, "adding land iau increments "
223+
print*, "adding land iau increments"
227224
endif
228225

229226
if (Land_IAU_Control%lsoil .ne. km) then
@@ -236,11 +233,9 @@ subroutine noahmpdrv_timestep_init (itime, fhour, delt, km, ncols, &
236233
allocate(stc_inc_flat(Land_IAU_Control%nx * Land_IAU_Control%ny, km)) !GFS_Control%ncols
237234
allocate(slc_inc_flat(Land_IAU_Control%nx * Land_IAU_Control%ny, km)) !GFS_Control%ncols
238235
allocate(stc_updated(Land_IAU_Control%nx * Land_IAU_Control%ny))
239-
allocate(slc_updated(Land_IAU_Control%nx * Land_IAU_Control%ny))
240236

241237
!copy background stc
242238
stc_updated = 0
243-
slc_updated = 0
244239
ib = 1
245240
do j = 1, Land_IAU_Control%ny
246241
do k = 1, km
@@ -260,53 +255,37 @@ subroutine noahmpdrv_timestep_init (itime, fhour, delt, km, ncols, &
260255
lensfc = Land_IAU_Control%nx * Land_IAU_Control%ny
261256

262257
if(Land_IAU_Control%me == Land_IAU_Control%mpi_root) print*,' adjusting first ', lsoil_incr, ' surface layers only, delt ', delt
263-
! initialize variables for counts statitics to be zeros
264-
nother = 0 ! grid cells not land
265-
nsnowupd = 0 ! grid cells with snow (temperature not yet updated)
266-
nstcupd = 0 ! grid cells that are updated stc
267-
nslcupd = 0 ! grid cells that are updated slc
268-
nfrozen = 0 ! not update as frozen soil
269-
nfrozen_upd = 0 ! not update as frozen soil
270-
271-
!TODO---if only fv3 increment files are used, this can be read from file
258+
272259
allocate(mask_tile(lensfc))
273260
call calculate_landinc_mask(weasd, vegtype, soiltyp, lensfc, isice_table, mask_tile)
274261

275-
!IAU increments are in units of 1/sec !Land_IAU_Control%dtp
276-
!* only updating soil temp for now
262+
dz(1) = -zsoil(1)
263+
do k = 2, km
264+
dz(k) = -zsoil(k) + zsoil(k-1)
265+
enddo
266+
!IAU increments are in units of 1/sec
277267
ij_loop : do ij = 1, lensfc
278268
! mask: 1 - soil, 2 - snow, 0 - land-ice, -1 - not land
279269
if (mask_tile(ij) == 1) then
280270

281271
soil_freeze=.false.
282272
soil_ice=.false.
283-
do k = 1, lsoil_incr ! k = 1, km
284-
if ( stc(ij,k) < con_t0c) soil_freeze=.true.
273+
do k = 1, lsoil_incr
274+
if ( stc(ij,k) < tfreez_noahmp ) soil_freeze=.true.
285275
if ( smc(ij,k) - slc(ij,k) > 0.001 ) soil_ice=.true.
286276

287277
if (Land_IAU_Control%upd_stc) then
288-
stc(ij,k) = stc(ij,k) + stc_inc_flat(ij,k)*delt !Land_IAU_Control%dtp
289-
if (k==1) then
290-
stc_updated(ij) = 1
291-
nstcupd = nstcupd + 1
292-
endif
278+
if (k==1) stc_updated(ij) = 1
279+
stc(ij,k) = stc(ij,k) + stc_inc_flat(ij,k)*delt
293280
endif
294281

295-
if ( (stc(ij,k) < con_t0c) .and. (.not. soil_freeze) .and. (k==1) ) nfrozen_upd = nfrozen_upd + 1
296-
297-
! do not do updates if this layer or any above is frozen
282+
! do not do SLC updates if this layer or any above is frozen
298283
if ( (.not. soil_freeze ) .and. (.not. soil_ice ) ) then
299284
if (Land_IAU_Control%upd_slc) then
300-
if (k==1) then
301-
nslcupd = nslcupd + 1
302-
slc_updated(ij) = 1
303-
endif
304-
! apply zero limit here (higher, model-specific limits are later)
305-
slc(ij,k) = max(slc(ij,k) + slc_inc_flat(ij,k)*delt, 0.0)
306-
smc(ij,k) = max(smc(ij,k) + slc_inc_flat(ij,k)*delt, 0.0)
285+
! if soil moisture is <0.1 mm in layer, prevent DA from further reducing it
286+
slc(ij,k) = max(slc(ij,k) + slc_inc_flat(ij,k)*delt, min(0.0001/dz(k), slc(ij,k)))
287+
smc(ij,k) = max(smc(ij,k) + slc_inc_flat(ij,k)*delt, min(0.0001/dz(k), smc(ij,k)))
307288
endif
308-
else
309-
if (k==1) nfrozen = nfrozen+1
310289
endif
311290
enddo
312291
endif ! if soil/snow point
@@ -318,27 +297,25 @@ subroutine noahmpdrv_timestep_init (itime, fhour, delt, km, ncols, &
318297
errmsg = 'FATAL ERROR in noahmpdrv_timestep_init: problem in set_soilveg_noahmp'
319298
return
320299
endif
321-
n_stc = 0
322-
n_slc = 0
323300
if (Land_IAU_Control%do_stcsmc_adjustment) then
324301
if (Land_IAU_Control%upd_stc) then
325302
do i=1,lensfc
326303
if (stc_updated(i) == 1 ) then ! soil-only location
327-
n_stc = n_stc+1
328304
soiltype = soiltyp(i)
329305
do l = 1, lsoil_incr
330306
if (abs(stc_inc_flat(i,l)) > Land_IAU_Control%min_T_increment) then
331307
!the following if case applies when updated stc > melting point, it handles both
332308
!case 1: frz ==> frz, recalculate slc, smc remains
333309
!case 2: unfrz ==> frz, recalculate slc, smc remains
334-
if (stc(i,l) .LT. con_t0c )then
310+
if (stc(i,l) .LE. tfreez_noahmp )then
335311
!recompute supercool liquid water,smc_anl remain unchanged
336-
smp = con_hfus*(con_t0c-stc(i,l))/(con_g*stc(i,l)) !(m)
312+
smp = con_hfus*(tfreez_noahmp-stc(i,l))/(con_g*stc(i,l)) !(m)
337313
slc_new=maxsmc(soiltype)*(smp/satpsi(soiltype))**(-1./bb(soiltype))
338314
slc(i,l) = max( min( slc_new, smc(i,l)), 0.0 )
339315
endif
340-
!case 3: frz ==> unfrz (or unfrz ==> unfrz), melt all soil ice (if any)
341-
if (stc(i,l) .GT. con_t0c )then !do not rely on stc_bck
316+
!case 3: frz ==> unfrz melt all soil ice (if any)
317+
if ( stc(i,l) .GT. tfreez_noahmp .and. &
318+
stc(i,l) - stc_inc_flat(i,l)*delt .LE. tfreez_noahmp ) then
342319
slc(i,l)=smc(i,l)
343320
endif
344321
endif
@@ -347,34 +324,10 @@ subroutine noahmpdrv_timestep_init (itime, fhour, delt, km, ncols, &
347324
enddo
348325
endif
349326

350-
if (Land_IAU_Control%upd_slc) then
351-
dz(1) = -zsoil(1)
352-
do l = 2, km
353-
dz(l) = -zsoil(l) + zsoil(l-1)
354-
enddo
355-
do i=1,lensfc
356-
if (slc_updated(i) == 1 ) then
357-
n_slc = n_slc+1
358-
! apply SM bounds (later: add upper SMC limit)
359-
do l = 1, lsoil_incr
360-
if (abs(slc_inc_flat(i, l)) > Land_IAU_Control%min_SLC_increment) then
361-
! noah-mp minimum is 1 mm per layer (in SMC)
362-
! no need to maintain frozen amount, would be v. small.
363-
slc(i,l) = max( 0.001/dz(l), slc(i,l) )
364-
smc(i,l) = max( 0.001/dz(l), smc(i,l) )
365-
endif
366-
enddo
367-
endif
368-
enddo
369-
endif
370327
endif
371-
372-
deallocate(stc_inc_flat, slc_inc_flat, stc_updated, slc_updated)
373-
deallocate(mask_tile)
328+
deallocate(stc_inc_flat, slc_inc_flat, stc_updated)
329+
deallocate(mask_tile)
374330

375-
!Remove non-warning, non-error log write
376-
!write(*,'(a,i4,a,i8)') 'noahmpdrv_timestep_init rank ', Land_IAU_Control%me, ' # of cells with stc update ', nstcupd
377-
378331

379332
end subroutine noahmpdrv_timestep_init
380333

0 commit comments

Comments
 (0)