Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(out) | :: | output | |||
real, | intent(in), | dimension(kb:ke) | :: | uinput | ||
real, | intent(in) | :: | criterion |
subroutine blthicknesst(output,uinput,criterion)
use modglobal, only : kb,ke,zh,zf
implicit none
real, dimension(kb:ke), intent(in) :: uinput !< input velocity
real, intent(in) :: criterion !< criterion for BL thickness computation (e.g. 0.95 or 0.99)
real, intent(out) :: output !< BL thickness based on input criterion
! real, dimension(kb:ke) :: mthick
real :: ucrit
! real :: umax
integer :: k
! umax = maxval(uinput)
ucrit = uinput(ke)*criterion ! Velocity at which BL-thickness is reached
! ucrit = umax*criterion ! Velocity at which BL-thickness is reached
do k=kb,ke
if (uinput(k) .GT. criterion*uinput(ke)) then
if (k==kb) then
output = zh(kb)+ (zf(k)-zh(k))/uinput(k)*ucrit ! interpolate z to BL-height
exit
else
output = zf(k-1) + (zf(k)-zf(k-1))/(uinput(k)-uinput(k-1))*(ucrit-uinput(k-1)) ! interpolate z to BL-height
exit
end if
else if (k==ke) then
output = zf(ke) ! maximum BL thickness
end if
end do
end subroutine blthicknesst