初始化leapfrog算法,初始化加速度及推进速度半步长
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real | :: | func | ||||
real(kind=rk), | intent(in), | dimension(*) | :: | x0 | ||
real(kind=rk), | intent(inout), | dimension(*) | :: | v0 | ||
real(kind=rk), | intent(out), | dimension(*) | :: | a0 | ||
real(kind=rk), | intent(in) | :: | t0 | |||
real(kind=rk), | intent(in) | :: | dt | |||
integer, | intent(in) | :: | n |
subroutine leapfrog_init(func, x0, v0, a0, t0, dt, n)
external :: func
real(kind=rk), intent(in), dimension(*) :: x0
real(kind=rk), intent(inout), dimension(*) :: v0
real(kind=rk), intent(out), dimension(*) :: a0
real(kind=rk), intent(in) :: t0, dt
integer, intent(in) :: n
call func(t0, x0, v0, a0)
v0(:n) = v0(:n) + a0(:n)*dt/2
end subroutine leapfrog_init