Create the actual RK integrator: initialize the Butcher' table coefficients.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(tvd_runge_kutta_integrator), | intent(inout) | :: | self | RK integrator. |
||
integer(kind=I_P), | intent(in) | :: | stages | Number of stages used. |
elemental subroutine init_rk(self, stages)
!---------------------------------------------------------------------------------------------------------------------------------
!< Create the actual RK integrator: initialize the Butcher' table coefficients.
!---------------------------------------------------------------------------------------------------------------------------------
class(tvd_runge_kutta_integrator), intent(INOUT) :: self !< RK integrator.
integer(I_P), intent(IN) :: stages !< Number of stages used.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
if (stages<1) return ! error print should be added
self%stages = stages
if (allocated(self%beta)) deallocate(self%beta) ; allocate(self%beta(1:stages )) ; self%beta = 0._R_P
if (allocated(self%alph)) deallocate(self%alph) ; allocate(self%alph(1:stages, 1:stages)) ; self%alph = 0._R_P
if (allocated(self%gamm)) deallocate(self%gamm) ; allocate(self%gamm( 1:stages)) ; self%gamm = 0._R_P
select case(stages)
case(1)
! RK(1,1) Forward-Euler
self%beta(1) = 1._R_P
case(2)
! SSPRK(2,2)
self%beta(1) = 0.5_R_P
self%beta(2) = 0.5_R_P
self%alph(2, 1) = 1._R_P
self%gamm(2) = 1._R_P
case(3)
! SSPRK(3,3)
self%beta(1) = 1._R_P/6._R_P
self%beta(2) = 1._R_P/6._R_P
self%beta(3) = 2._R_P/3._R_P
self%alph(2, 1) = 1._R_P
self%alph(3, 1) = 0.25_R_P ; self%alph(3, 2) = 0.25_R_P
self%gamm(2) = 1._R_P
self%gamm(3) = 0.5_R_P
case(5)
! SSPRK(5,4)
self%beta(1) = 0.14681187618661_R_P
self%beta(2) = 0.24848290924556_R_P
self%beta(3) = 0.10425883036650_R_P
self%beta(4) = 0.27443890091960_R_P
self%beta(5) = 0.22600748319395_R_P
self%alph(2, 1)=0.39175222700392_R_P
self%alph(3, 1)=0.21766909633821_R_P;self%alph(3, 2)=0.36841059262959_R_P
self%alph(4, 1)=0.08269208670950_R_P;self%alph(4, 2)=0.13995850206999_R_P;self%alph(4, 3)=0.25189177424738_R_P
self%alph(5, 1)=0.06796628370320_R_P;self%alph(5, 2)=0.11503469844438_R_P;self%alph(5, 3)=0.20703489864929_R_P
self%alph(5, 4)=0.54497475021237_R_P
self%gamm(2) = 0.39175222700392_R_P
self%gamm(3) = 0.58607968896780_R_P
self%gamm(4) = 0.47454236302687_R_P
self%gamm(5) = 0.93501063100924_R_P
endselect
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine init_rk