Create the actual LMM-SSP integrator: initialize the a,b coefficients.
If the integrator is initialized with a bad (unsupported) number of required time steps the initialization fails and the integrator error status is updated consistently for external-provided errors handling.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_lmm_ssp), | intent(inout) | :: | self | Integrator. |
||
character(len=*), | intent(in) | :: | scheme | Selected scheme. |
||
logical, | intent(in), | optional | :: | autoupdate | Enable cyclic autoupdate of previous time steps. |
|
class(integrand_object), | intent(in), | optional | :: | U | Integrand molding prototype. |
|
logical, | intent(in), | optional | :: | stop_on_fail | Stop execution if initialization fail. |
subroutine initialize(self, scheme, autoupdate, U, stop_on_fail)
!< Create the actual LMM-SSP integrator: initialize the *a,b* coefficients.
!<
!< @note If the integrator is initialized with a bad (unsupported) number of required time steps the initialization fails and
!< the integrator error status is updated consistently for external-provided errors handling.
class(integrator_lmm_ssp), intent(inout) :: self !< Integrator.
character(*), intent(in) :: scheme !< Selected scheme.
logical, intent(in), optional :: autoupdate !< Enable cyclic autoupdate of previous time steps.
class(integrand_object), intent(in), optional :: U !< Integrand molding prototype.
logical, intent(in), optional :: stop_on_fail !< Stop execution if initialization fail.
if (self%is_supported(scheme=scheme)) then
call self%destroy
self%description_ = trim(adjustl(scheme))
select case(trim(adjustl(scheme)))
case('lmm_ssp_steps_3_order_2')
self%steps = 3
allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
allocate(self%b(1:self%steps)) ; self%b = 0.0_R_P
self%a(1) = 1._R_P/4._R_P
self%a(2) = 0._R_P
self%a(3) = 3._R_P/4._R_P
self%b(1) = 0._R_P
self%b(2) = 0._R_P
self%b(3) = 3._R_P/2._R_P
case('lmm_ssp_steps_4_order_3')
self%steps = 4
allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
allocate(self%b(1:self%steps)) ; self%b = 0.0_R_P
self%a(1) = 11._R_P/27._R_P
self%a(2) = 0._R_P
self%a(3) = 0._R_P
self%a(4) = 16._R_P/27._R_P
self%b(1) = 12._R_P/27._R_P
self%b(2) = 0._R_P
self%b(3) = 0._R_P
self%b(4) = 16._R_P/9._R_P
case('lmm_ssp_steps_5_order_3')
self%steps = 5
allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
allocate(self%b(1:self%steps)) ; self%b = 0.0_R_P
self%a(1) = 7._R_P/32._R_P
self%a(2) = 0._R_P
self%a(3) = 0._R_P
self%a(4) = 0._R_P
self%a(5) = 25._R_P/32._R_P
self%b(1) = 5._R_P/16._R_P
self%b(2) = 0._R_P
self%b(3) = 0._R_P
self%b(4) = 0._R_P
self%b(5) = 25._R_P/16._R_P
endselect
self%autoupdate = .true. ; if (present(autoupdate)) self%autoupdate = autoupdate
self%registers = self%steps
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