Skip to content

Commit 9e5eeb8

Browse files
author
helin wei
committed
create a single_loop_alternate for hr4_test3
1 parent 0ff86ac commit 9e5eeb8

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

physics/SFC_Models/Land/Noahmp/module_sf_noahmplsm.F90

+15-18
Original file line numberDiff line numberDiff line change
@@ -4052,11 +4052,6 @@ subroutine vege_flux(parameters,nsnow ,nsoil ,isnow ,vegtyp ,veg , &
40524052

40534053
end if
40544054

4055-
! prepare for longwave rad.
4056-
4057-
air = -emv*(1.+(1.-emv)*(1.-emg))*lwdn - emv*emg*sb*tg**4
4058-
cir = (2.-emv*(1.-emg))*emv*sb
4059-
!
40604055
if(opt_sfc == 4) then
40614056

40624057
gdx = sqrt(garea1)
@@ -4203,6 +4198,11 @@ subroutine vege_flux(parameters,nsnow ,nsoil ,isnow ,vegtyp ,veg , &
42034198
end if
42044199
end if
42054200

4201+
! prepare for longwave rad.
4202+
4203+
air = -emv*(1.+(1.-emv)*(1.-emg))*lwdn - emv*emg*sb*tg**4
4204+
cir = (2.-emv*(1.-emg))*emv*sb
4205+
42064206
! prepare for sensible heat flux above veg.
42074207

42084208
cah = 1./rahc
@@ -4265,7 +4265,7 @@ subroutine vege_flux(parameters,nsnow ,nsoil ,isnow ,vegtyp ,veg , &
42654265

42664266
! update vegetation surface temperature
42674267
tv = tv + dtv
4268-
! tah = ata + bta*tv ! canopy air t; update here for consistency
4268+
tah = ata + bta*tv ! canopy air t; update here for consistency
42694269

42704270
! for computing m-o length in the next iteration
42714271
h = rhoair*cpair*(tah - sfctmp) /rahc
@@ -4278,15 +4278,7 @@ subroutine vege_flux(parameters,nsnow ,nsoil ,isnow ,vegtyp ,veg , &
42784278
qfx = (qsfc-qair)*rhoair*caw
42794279
endif
42804280

4281-
4282-
if (liter == 1) then
4283-
exit loop1
4284-
endif
4285-
if (iter >= 5 .and. abs(dtv) <= 0.01 .and. liter == 0) then
4286-
liter = 1
4287-
endif
4288-
4289-
end do loop1 ! end stability iteration
4281+
! after canopy balance, do the under-canopy ground balance
42904282

42914283
! under-canopy fluxes and tg
42924284

@@ -4296,8 +4288,6 @@ subroutine vege_flux(parameters,nsnow ,nsoil ,isnow ,vegtyp ,veg , &
42964288
cev = rhoair*cpair / (gammag*(rawg+rsurf)) ! barlage: change to ground v3.6
42974289
cgh = 2.*df(isnow+1)/dzsnso(isnow+1)
42984290

4299-
loop2: do iter = 1, niterg
4300-
43014291
t = tdc(tg)
43024292
call esat(t, esatw, esati, dsatw, dsati)
43034293
if (t .gt. 0.) then
@@ -4323,7 +4313,14 @@ subroutine vege_flux(parameters,nsnow ,nsoil ,isnow ,vegtyp ,veg , &
43234313
gh = gh + cgh*dtg
43244314
tg = tg + dtg
43254315

4326-
end do loop2
4316+
if (liter == 1) then
4317+
exit loop1
4318+
endif
4319+
if (iter >= 5 .and. abs(dtv) <= 0.01 .and. abs(dtg) <= 0.01 .and. liter == 0) then
4320+
liter = 1 ! if conditions are met, then do one final loop
4321+
endif
4322+
4323+
end do loop1
43274324

43284325
! tah = (cah*sfctmp + cvh*tv + cgh*tg)/(cah + cvh + cgh)
43294326

0 commit comments

Comments
 (0)