Create the actual BDF integrator: initialize the alpha and beta coefficients.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_back_df), | intent(inout) | :: | self | Integrator. |
||
character(len=*), | intent(in) | :: | scheme | Selected scheme. |
||
integer(kind=I_P), | intent(in), | optional | :: | iterations | Implicit iterations. |
|
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, iterations, autoupdate, U, stop_on_fail)
!< Create the actual BDF integrator: initialize the *alpha* and *beta* coefficients.
class(integrator_back_df), intent(inout) :: self !< Integrator.
character(*), intent(in) :: scheme !< Selected scheme.
integer(I_P), intent(in), optional :: iterations !< Implicit iterations.
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('back_df_1')
self%steps = 1 ; allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
self%a(1) = -1.0_R_P
self%b = 1.0_R_P
case('back_df_2')
self%steps = 2 ; allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
self%a(1) = 1.0_R_P/3.0_R_P
self%a(2) = -4.0_R_P/3.0_R_P
self%b = 2.0_R_P/3.0_R_P
case('back_df_3')
self%steps = 3 ; allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
self%a(1) = -2.0_R_P/11.0_R_P
self%a(2) = 9.0_R_P/11.0_R_P
self%a(3) = -18.0_R_P/11.0_R_P
self%b = 6.0_R_P/11.0_R_P
case('back_df_4')
self%steps = 4 ; allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
self%a(1) = 3.0_R_P/25.0_R_P
self%a(2) = -16.0_R_P/25.0_R_P
self%a(3) = 36.0_R_P/25.0_R_P
self%a(4) = -48.0_R_P/25.0_R_P
self%b = 12.0_R_P/25.0_R_P
case('back_df_5')
self%steps = 5 ; allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
self%a(1) = -12.0_R_P/137.0_R_P
self%a(2) = 75.0_R_P/137.0_R_P
self%a(3) = -200.0_R_P/137.0_R_P
self%a(4) = 300.0_R_P/137.0_R_P
self%a(5) = -300.0_R_P/137.0_R_P
self%b = 60.0_R_P/137.0_R_P
case('back_df_6')
self%steps = 6 ; allocate(self%a(1:self%steps)) ; self%a = 0.0_R_P
self%a(1) = 10.0_R_P/147.0_R_P
self%a(2) = -72.0_R_P/147.0_R_P
self%a(3) = 225.0_R_P/147.0_R_P
self%a(4) = -400.0_R_P/147.0_R_P
self%a(5) = 450.0_R_P/147.0_R_P
self%a(6) = -360.0_R_P/147.0_R_P
self%b = 60.0_R_P/147.0_R_P
case default
endselect
self%autoupdate = .true. ; if (present(autoupdate)) self%autoupdate = autoupdate
self%iterations = 1 ; if (present(iterations)) self%iterations = iterations
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