Skip to content

Commit

Permalink
Merge pull request ESCOMP#1 from jedwards4b/jedwards/ice_atmo_fix
Browse files Browse the repository at this point in the history
fix iterative loop
  • Loading branch information
dabail10 authored Jan 19, 2018
2 parents 2387abe + d11918b commit 600587a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
9 changes: 9 additions & 0 deletions docs/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
===============================================================
cice5_20180118
Originator: jedwards
Date: 18 Jan 2018
Version: 5.0
One-line: Correction to flux convergence to atmice flux

M src/source/ice_atmo.F90

===============================================================
cice5_20180116
Originator: jedwards
Expand Down
61 changes: 28 additions & 33 deletions src/source/ice_atmo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -377,49 +377,44 @@ subroutine atmo_boundary_layer (nx_block, ny_block, &
!------------------------------------------------------------
! iterate to converge on Z/L, ustar, tstar and qstar
!------------------------------------------------------------
iter = 0
ustar_prev = 2.0_SHR_KIND_R8 * ustar
do while (iter <= flux_convergence_max_iteration)
iter = iter + 1
do iter =1,flux_convergence_max_iteration
do ij = 1, icells
i = indxi(ij)
j = indxj(ij)
if ( (flux_convergence_tolerance > 0.0_SHR_KIND_R8 .and. &
if (.not. (flux_convergence_tolerance > c0 .and. &
abs((ustar(ij) - ustar_prev(ij))/ustar(ij)) <= flux_convergence_tolerance)) then
exit
endif
! compute stability & evaluate all stability functions
ustar_prev(ij) = ustar(ij)
iter = iter +1
ustar_prev = ustar(ij)
hol(ij) = vonkar * gravit * zlvl(i,j) &
* (tstar(ij)/thva(ij) &

! compute stability & evaluate all stability functions
ustar_prev(ij) = ustar(ij)
hol(ij) = vonkar * gravit * zlvl(i,j) &
* (tstar(ij)/thva(ij) &
+ qstar(ij)/(c1/zvir+Qa(i,j))) &
/ ustar(ij)**2
hol(ij) = sign( min(abs(hol(ij)),c10), hol(ij) )
stable(ij) = p5 + sign(p5 , hol(ij))
xqq = max(sqrt(abs(c1 - c16*hol(ij))) , c1)
xqq = sqrt(xqq)

! Jordan et al 1999
psimhs = -(0.7_dbl_kind*hol(ij) &
+ 0.75_dbl_kind*(hol(ij)-14.3_dbl_kind) &
* exp(-0.35_dbl_kind*hol(ij)) + 10.7_dbl_kind)
psimh = psimhs*stable(ij) &
/ ustar(ij)**2
hol(ij) = sign( min(abs(hol(ij)),c10), hol(ij) )
stable(ij) = p5 + sign(p5 , hol(ij))
xqq = max(sqrt(abs(c1 - c16*hol(ij))) , c1)
xqq = sqrt(xqq)

! Jordan et al 1999
psimhs = -(0.7_dbl_kind*hol(ij) &
+ 0.75_dbl_kind*(hol(ij)-14.3_dbl_kind) &
* exp(-0.35_dbl_kind*hol(ij)) + 10.7_dbl_kind)
psimh = psimhs*stable(ij) &
+ (c1 - stable(ij))*psimhu(xqq)
psixh(ij) = psimhs*stable(ij) &
psixh(ij) = psimhs*stable(ij) &
+ (c1 - stable(ij))*psixhu(xqq)

! shift all coeffs to measurement height and stability
rd(ij) = rdn(ij) / (c1+rdn(ij)/vonkar*(alz(ij)-psimh))
rh(ij) = rhn(ij) / (c1+rhn(ij)/vonkar*(alz(ij)-psixh(ij)))
re(ij) = ren(ij) / (c1+ren(ij)/vonkar*(alz(ij)-psixh(ij)))

! update ustar, tstar, qstar using updated, shifted coeffs
ustar(ij) = rd(ij) * vmag(ij)
tstar(ij) = rh(ij) * delt(i,j)
qstar(ij) = re(ij) * delq(i,j)
! shift all coeffs to measurement height and stability
rd(ij) = rdn(ij) / (c1+rdn(ij)/vonkar*(alz(ij)-psimh))
rh(ij) = rhn(ij) / (c1+rhn(ij)/vonkar*(alz(ij)-psixh(ij)))
re(ij) = ren(ij) / (c1+ren(ij)/vonkar*(alz(ij)-psixh(ij)))

! update ustar, tstar, qstar using updated, shifted coeffs
ustar(ij) = rd(ij) * vmag(ij)
tstar(ij) = rh(ij) * delt(i,j)
qstar(ij) = re(ij) * delq(i,j)
endif
enddo ! ij
enddo ! iter
if (iter <= 0) then
Expand Down

0 comments on commit 600587a

Please sign in to comment.