subroutine nudge use modglobal, only : kb,ke,lmoist,ltempeq,lnudge,lnudgevel,tnudge,nnudge,numol,nsv use modfields, only : thlp,qtp,svp,sv0av,thl0av,qt0av,up,vp,u0av,v0av,uprof,vprof,thlprof,qtprof,svprof use modmpi, only : myid implicit none integer :: k, n if (lnudge .eqv. .false.) return if (lnudgevel) then do k=kb+nnudge,ke up(:,:,k) = up(:,:,k) - (u0av(k) - uprof(k)) / tnudge vp(:,:,k) = vp(:,:,k) - (v0av(k) - vprof(k)) / tnudge end do end if do n=1,nsv do k=kb+nnudge,ke svp(:,:,k,n) = svp(:,:,k,n) - (sv0av(k,n) - svprof(k,n)) / tnudge end do end do if (ltempeq) then do k=kb+nnudge,ke thlp(:,:,k) = thlp(:,:,k) - (thl0av(k) - thlprof(k)) / tnudge end do end if !ltempeq if (lmoist) then do k=kb+nnudge,ke qtp(:,:,k) = qtp(:,:,k) - (qt0av(k) - qtprof(k)) / tnudge end do end if !lmoist end subroutine nudge