Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension(kbin:kein) | :: | input | ||
real, | intent(inout), | dimension(kb:ke) | :: | output |
subroutine zinterpolatet1d(input,output)
use modglobal, only : jb,je,kb,ke,zf,nstore
use modsurfdata, only : thls
implicit none
real, dimension(kbin:kein), intent(in) :: input
real, dimension(kb:ke), intent(inout) :: output
integer k
do k=kb,ke
if (linuf(k) == kein+1) then ! indicator for extrapolation!
output(k) = input(kein)
elseif (linlf(k) == kbin-1) then ! interprets this as extrapolation to bottom (use u=0 at z+=0)
output(k) = (input(kb)-thls)/zfin(kbin)*zf(k)
! output(:,k,:) = input(:,kbin,:)/zfin(kbin) * zf(k)
! output(:,k,:) = input(:,kbin,:) ! temeperature is not zero at the wall, so line above is wrong
else ! normal interpolation
output(k) = input(linlf(k)) + (input(linuf(k)) - input(linlf(k))) / (zfin(linuf(k)) - zfin(linlf(k))) * (zf(k) - zf(linlf(k)))
if ((zf(k) .gt. zfin(linuf(k))) .or. (zf(k) .lt. zfin(linlf(k)))) then
write(6,*) '!!!Mistake in zinterpolatet1d !!!!'
end if
end if
end do
end subroutine zinterpolatet1d