Create the actual RK integrator: initialize the Butcher' table coefficients.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_runge_kutta_lssp), | intent(inout) | :: | self | Integrator. |
||
character(len=*), | intent(in) | :: | scheme | Selected scheme. |
||
class(integrand_object), | intent(in), | optional | :: | U | Integrand molding prototype. |
|
integer(kind=I_P), | intent(in), | optional | :: | stages | Stages number. |
|
logical, | intent(in), | optional | :: | stop_on_fail | Stop execution if initialization fail. |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
subroutine initialize(self, scheme, U, stages, stop_on_fail)
!< Create the actual RK integrator: initialize the Butcher' table coefficients.
class(integrator_runge_kutta_lssp), intent(inout) :: self !< Integrator.
character(*), intent(in) :: scheme !< Selected scheme.
class(integrand_object), intent(in), optional :: U !< Integrand molding prototype.
integer(I_P), intent(in), optional :: stages !< Stages number.
logical, intent(in), optional :: stop_on_fail !< Stop execution if initialization fail.
if (self%is_supported(scheme=scheme)) then
call self%destroy
select case(trim(adjustl(scheme)))
case('runge_kutta_lssp_stages_s_order_s_1')
self%integrate_ => integrate_order_s_1
self%integrate_fast_ => integrate_order_s_1_fast
self%stages = 2 ; if (present(stages)) self%stages = stages
if (self%stages < 2) then
error stop 'error: the number of stages of "runge_kutta_lssp_stages_s_order_s_1" must be >=2'
endif
allocate(self%alpha(1:self%stages)) ; self%alpha = 0._R_P
call self%initialize_order_s_1
case('runge_kutta_lssp_stages_s_order_s')
self%integrate_ => integrate_order_s
self%integrate_fast_ => integrate_order_s_fast
self%stages = 1 ; if (present(stages)) self%stages = stages
if (self%stages < 1) then
error stop 'error: the number of stages of "runge_kutta_lssp_stages_s_order_s" must be >=1'
endif
allocate(self%alpha(1:self%stages)) ; self%alpha = 0._R_P
call self%initialize_order_s
endselect
self%description_ = trim(adjustl(scheme))//'_stages_'//trim(str(self%stages, no_sign=.true.))
self%registers = self%stages
if (present(U)) call self%allocate_integrand_members(U=U)
else
call self%trigger_error(error=ERROR_UNSUPPORTED_SCHEME, &
error_message='"'//trim(adjustl(scheme))//'" unsupported scheme', &
is_severe=stop_on_fail)
endif
endsubroutine initialize