subroutine calc_halflev use modglobal, only : ib,ie,jb,je,kb,ke,kh,dzf,dzh,iadv_thl, iadv_qt, iadv_kappa use modfields, only : thl0,thl0h,qt0,qt0h use modsurfdata,only: qts,thls implicit none integer :: i,j,k ! do k=kb+1,ke+kh do k=kb,ke+kh do j=jb,je do i=ib,ie thl0h(i,j,k) = (thl0(i,j,k)*dzf(k-1)+thl0(i,j,k-1)*dzf(k))/(2*dzh(k)) end do end do end do thl0h(ib:ie,jb:je,kb) = thls ! do k=kb+1,ke+kh do k=kb,ke+kh do j=jb,je do i=ib,ie qt0h(i,j,k) = (qt0 (i,j,k)*dzf(k-1)+qt0 (i,j,k-1)*dzf(k))/(2*dzh(k)) end do end do end do qt0h(ib:ie,jb:je,kb) = qts end subroutine calc_halflev