Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

real, intent(in) :: dt

integer :: i
real :: phis, k, ti
interface
real function func(x,y)
real, intent(in) :: x,y
end function func
end interface

do i = 1,Nt-1
ti = t(i)
! 1st RK
phis = phi(i)
k = func(ti,phis)

! 2nd RK
phis = phis + (1.0/3.0)*dt*k
ti = t(i) + (1.0/3.0)*dt
k = -(5.0/9.0)*k + func(ti,phis)

! 3rd RK
phis = phis + (15.0/16.0)*dt*k
ti = t(i) + (3.0/4.0)*dt
k = -(153.0/128.0)*k + func(ti,phis)

phi(i+1) = phis + (8.0/15.0)*dt*k


end do

end subroutine LS_RK3_1

You might also like