rktvd Derived Type

type, public, extends(../../tvdode) :: rktvd

Runge-Kutta TVD ODE solver class.


Inherits

type~~rktvd~~InheritsGraph type~rktvd rktvd type~tvdode tvdode type~rktvd->type~tvdode

Components

Type Visibility Attributes Name Initial
integer, public :: neq

number of equations

integer, public :: order

order of the method

integer, public :: fevals = 0

number of function evaluations

integer, public :: istate = 0

flag indicating the state of the integration: 1 first call for a problem, 2 subsequent call for a problem.

character(len=:), public, allocatable :: msg

error message


Constructor

public interface rktvd

  • private function rktvd_init(fu, neq, order) result(self)

    Initialize rktvd object.

    Arguments

    Type IntentOptional Attributes Name
    procedure(integrand) :: fu

    subroutine with the derivative

    integer, intent(in) :: neq

    number of equations

    integer, intent(in) :: order

    order of the method (1, 2 or 3)

    Return Value type(rktvd)


Type-Bound Procedures

procedure, public, pass(self) :: error_msg

  • private pure subroutine error_msg(self, msg)

    Error method.

    Arguments

    Type IntentOptional Attributes Name
    class(tvdode), intent(inout) :: self

    object

    character(len=*), intent(in) :: msg

    message

procedure, public, pass(self) :: integrate => rktvd_integrate

  • private subroutine rktvd_integrate(self, u, t, tout, dt, itask)

    This subroutine implements the optimal 1st, 2nd and 3rd order TVD RK methods described in ICASE 97-65 (Shu, 1997). The routine was built to work similarly to LSODE.

    Note

    There are also 4th and 5th order methods, but they have lower CFL coefficients and are more difficult to implement. See Equation 4.15, page 44.

    Todo

    • Adjust dt in final step to avoid overshoting tout by some fraction of dt.

    Arguments

    Type IntentOptional Attributes Name
    class(rktvd), intent(inout) :: self

    object

    real(kind=rk), intent(inout) :: u(:)

    vector(neq) with the variables to integrate

    real(kind=rk), intent(inout) :: t

    time; on return it will be the current value of (close to tout)

    real(kind=rk), intent(in) :: tout

    time where next output is desired

    real(kind=rk), intent(in) :: dt

    time step

    integer, intent(in), optional :: itask

    flag indicating the task to be performed: 1 normal integration until tout; 2 single dt step.

Source Code

   type, extends(tvdode) :: rktvd
   !! Runge-Kutta TVD ODE solver class.
   contains
      procedure, pass(self) :: integrate => rktvd_integrate
   end type rktvd