subroutine LowStorageRK4_timeIntegrator(this,tn)
implicit none
class(Model),intent(inout) :: this
real(prec),intent(in) :: tn
! Local
integer :: m
real(prec) :: tRemain
real(prec) :: dtLim
real(prec) :: t0
dtLim = this%dt ! Get the max time step size from the dt attribute
do while(this%t < tn)
t0 = this%t
tRemain = tn-this%t
this%dt = min(dtLim,tRemain)
do m = 1,5
call this%CalculateTendency()
call this%UpdateGRK4(m)
this%t = t0+rk4_b(m)*this%dt
enddo
this%t = t0+this%dt
enddo
this%dt = dtLim
endsubroutine LowStorageRK4_timeIntegrator