module runge_kutta_m !! Runge-Kutta time stepping scheme !! - Only fully explicit !! - Right hand side via call to external subroutine !! - More generic than KArniadakis, i.e. not relying on variables or meshes use MPI use precision_grillix_m, only : GP use error_handling_grillix_m, only : handle_error, error_info_t use status_codes_grillix_m, only : GRILLIX_ERR_OTHER use parallelisation_setup_m, only : is_rank_info_writer ! from PARALLAX use screen_io_m, only : get_stdout implicit none type, public :: runge_kutta_t !! Datatype for Runge-Kutta integrator integer, private :: ncount !! Counter of integration steps integer, private :: ndim !! Dimension of problem integer, private :: order !! Order of time-stepping scheme real(GP), private :: dtau !! Time step size contains procedure, public :: init => init_runge_kutta procedure, public :: get_ncount procedure, public :: get_ndim procedure, public :: get_order procedure, public :: advance procedure, public :: display => display_runge_kutta final :: destructor end type interface pure integer module function get_ncount(self) !! Returns ncount class(runge_kutta_t), intent(in) :: self !! Instance of the type end function pure integer module function get_ndim(self) !! Returns ndim class(runge_kutta_t), intent(in) :: self !! Instance of the type end function pure integer module function get_order(self) !! Returns order class(runge_kutta_t), intent(in) :: self !! Instance of the type end function module subroutine init_runge_kutta(self, ndim, order) !! Initialises a Runge Kutta integrator class(runge_kutta_t), intent(inout) :: self !! Instance of the type integer, intent(in) :: ndim !! Dimension of problem integer, intent(in) :: order !! Order of time-stepping scheme end subroutine module subroutine advance(self, dtau, tau, y, rhs) class(runge_kutta_t), intent(inout) :: self !! Instance of the type real(GP), intent(in) :: dtau !! Size of timestep real(GP), intent(in) :: tau !! Time at input real(GP), dimension(self%ndim), intent(inout) :: y !! On input: variable values at tau, at output at tau+dtau interface subroutine rhs(ndim, tau, y, dy) use precision_grillix_m, only : GP integer, intent(in) :: ndim real(GP), intent(in) :: tau real(GP), dimension(ndim), intent(in) :: y real(GP), dimension(ndim), intent(out) :: dy end subroutine end interface !! Right hand side of differential equation end subroutine module subroutine display_runge_kutta(self) !! Displays basic information of runge_kutta class(runge_kutta_t), intent(in) :: self !! Instance of the type end subroutine module subroutine destructor(self) !! Frees memory associated with runge_kutta type(runge_kutta_t), intent(inout) :: self !! Instance of the type end subroutine end interface end module