Integrate field with LMM-SSP class scheme.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_ms_runge_kutta_ssp), | intent(inout) | :: | self | Integrator. |
||
class(integrand_object), | intent(inout) | :: | U | Field to be integrated. |
||
real(kind=R_P), | intent(in) | :: | Dt | Time step. |
||
real(kind=R_P), | intent(in) | :: | t | Time. |
subroutine integrate(self, U, Dt, t)
!< Integrate field with LMM-SSP class scheme.
class(integrator_ms_runge_kutta_ssp), intent(inout) :: self !< Integrator.
class(integrand_object), intent(inout) :: U !< Field to be integrated.
real(R_P), intent(in) :: Dt !< Time step.
real(R_P), intent(in) :: t !< Time.
integer(I_P) :: k, kk !< Stages counters.
integer(I_P) :: s !< Steps counter.
! computing stages
self%stage(1) = U
do k=2, self%stages
self%stage(k) = U * 0._R_P
do s=1, self%steps
if (self%D(k, s) /= 0._R_P) self%stage(k) = self%stage(k) + (self%previous(s) * self%D(k, s))
enddo
do s=1, self%steps - 1
if (self%Ahat(k, s) /= 0._R_P) self%stage(k) = self%stage(k) + (self%previous(s)%t(t=self%t(s)) * (Dt * self%Ahat(k, s)))
enddo
do kk=1, k - 1
if (self%A(k, kk) /= 0._R_P) self%stage(k) = self%stage(k) + (self%stage(kk)%t(t=t) * (Dt * self%A(k, kk)))
enddo
enddo
! computing new time step
U = U * 0._R_P
do s=1, self%steps
if (self%Q(s) /= 0._R_P) U = U + (self%previous(s) * self%Q(s))
enddo
do s=1, self%steps - 1
if (self%Bhat(s) /= 0._R_P) U = U + (self%previous(s)%t(t=self%t(s)) * (Dt * self%Bhat(s)))
enddo
do k=1, self%stages
if (self%B(k) /= 0._R_P) U = U + (self%stage(k)%t(t=t) * (Dt * self%B(k)))
enddo
if (self%autoupdate) call self%update_previous(U=U, previous=self%previous, Dt=Dt, t=t, previous_t=self%t)
endsubroutine integrate