mstvd Derived Type

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

Multi-step TVD ODE solver class.


Inherits

type~~mstvd~~InheritsGraph type~mstvd mstvd type~tvdode tvdode type~mstvd->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 mstvd

  • private function mstvd_init(fu, neq) result(self)

    Initialize mstvd object.

    Arguments

    Type IntentOptional Attributes Name
    procedure(integrand) :: fu

    subroutine with the derivative

    integer, intent(in) :: neq

    number of equations

    Return Value type(mstvd)


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 => mstvd_integrate

  • private subroutine mstvd_integrate(self, u, t, tout, dt)

    This subroutine implements a 5-step, 3rd order TVD multi-step method described in ICASE 97-65 (Shu, 1997). In theory, this method should have an efficiency 1.5 times higher than the RK method of the same order. However, in practice they appear to be almost identical. The routine was built to work similarly to LSODE.

    Note

    There is a 2nd order multi-step method, but the corresponding CFL value is half that of the 2nd order RK method. Thus, there is no reason to implement it.

    Arguments

    Type IntentOptional Attributes Name
    class(mstvd), 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

Source Code

   type, extends(tvdode) :: mstvd
   !! Multi-step TVD ODE solver class.
      real(rk), allocatable, private :: uold(:, :)
      real(rk), allocatable, private :: udotold(:, :)
   contains
      procedure, pass(self) :: integrate => mstvd_integrate
   end type mstvd