Skip to content

Commit 8624b1d

Browse files
committed
Merge branch 'vanroekel:vanroekel/eam/oro-drag-fixes' (PR #7299)
Fixes bugs in new orographic wave drag scheme This PR addresses two bugs found when coupling and running a F20TR case on a LANL institutional machine at ne120 resolution with DEBUG enabled. Addresses #7298 [BFB]
2 parents d74d93f + 384a7ce commit 8624b1d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

components/eam/src/physics/cam/od_common.F90

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ subroutine oro_drag_interface(state, cam_in, sgh, pbuf, dtime, nm,
335335
!get the layer index of pblh in layer for input in drag scheme
336336
pblh_idx = pbuf_get_index('pblh')
337337
call pbuf_get_field(pbuf, pblh_idx, pblh)
338-
do i=1,pcols
338+
do i=1,ncol
339339
kpbl2d_in(i)=pblh_get_level_idx(zbot(i,:)-(state%phis(i)/gravit),pblh(i))
340340
kpbl2d_reverse_in(i)=pverp-kpbl2d_in(i)!pverp-k
341341
end do
@@ -392,14 +392,16 @@ function pblh_get_level_idx(height_array,pblheight)
392392
pblh_get_level_idx = -1
393393
found=.false.
394394
!get the pblh level index and return
395-
do k = 1, pver
396-
if((pblheight >= height_array(k+1).and.pblheight <height_array(k)))then
397-
pblh_get_level_idx = k+1
395+
do k = 2, pver
396+
if((pblheight >= height_array(k).and.pblheight <height_array(k-1)))then
397+
pblh_get_level_idx = k
398398
found=.true.
399399
return
400400
endif
401401
enddo
402402

403+
if (.not.found) call endrun('ERROR - pblh_get_level_idx: pbl top index not found')
404+
403405
end function
404406

405407
!==========================================================================
@@ -967,8 +969,8 @@ subroutine od2d(dudt,dvdt,dthdt,ncleff,ncd,sncleff, &
967969
!
968970
!--- calculate length of grid for flow-blocking drag
969971
!
970-
delx=dxmeter
971-
dely=dymeter
972+
delx(its:ite)=dxmeter(its:ite)
973+
dely(its:ite)=dymeter(its:ite)
972974
!
973975
!
974976
!-----initialize arrays

0 commit comments

Comments
 (0)