subroutine imk_residual(this, lev, dt, flags)
class(pf_imk_t), intent(inout) :: this
class(pf_level_t), intent(inout) :: lev
real(pfdp), intent(in ) :: dt
integer, optional, intent(in) :: flags
integer :: m
call lev%ulevel%sweeper%integrate(lev, lev%Q, lev%F, dt, lev%I)
! add tau (which is 'node to node')
if (allocated(lev%tauQ)) then
do m = 1, lev%nnodes-1
call lev%I(m)%axpy(1.0_pfdp, lev%tauQ(m))
end do
end if
! subtract out Q (not initial condition is zero
do m = 1, lev%nnodes-1
call lev%R(m)%copy(lev%I(m))
call lev%R(m)%axpy(-1.0_pfdp, lev%Q(m+1))
end do
end subroutine imk_residual