Skip to content

Commit

Permalink
update to protect a divide by zero in ST4 (#519)
Browse files Browse the repository at this point in the history
Protect a possible divide by zero ustar in w3src4
  • Loading branch information
JessicaMeixner-NOAA committed Nov 17, 2021
1 parent 2be0d63 commit 6267515
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions model/src/w3src4md.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1647,13 +1647,19 @@ SUBROUTINE CALC_USTAR(WINDSPEED,TAUW,USTAR,Z0,CHARN)
!
! Determines roughness length
!
SQRTCDM1 = MIN(WINDSPEED/USTAR,100.0)
Z0 = ZZWND*EXP(-KAPPA*SQRTCDM1)
IF (USTAR.GT.0.001) THEN
SQRTCDM1 = MIN(WINDSPEED/USTAR,100.0)
Z0 = ZZWND*EXP(-KAPPA*SQRTCDM1)
CHARN = GRAV*Z0/USTAR**2
ELSE
IF (USTAR.GT.0) THEN
SQRTCDM1 = MIN(WINDSPEED/USTAR,100.0)
Z0 = ZZWND*EXP(-KAPPA*SQRTCDM1)
ELSE
Z0 = AALPHA*0.001*0.001/GRAV
END IF
CHARN = AALPHA
END IF
END IF
!
RETURN
END SUBROUTINE CALC_USTAR
Expand Down

0 comments on commit 6267515

Please sign in to comment.