finite_diff_method Derived Type

type, public :: finite_diff_method

defines the finite difference method used to compute the Jacobian.

See: get_finite_difference_method for the different methods.


Inherited by

type~~finite_diff_method~~InheritedByGraph type~finite_diff_method finite_diff_method type~meth_array meth_array type~meth_array->type~finite_diff_method meth type~numdiff_type numdiff_type type~numdiff_type->type~finite_diff_method meth type~numdiff_type->type~meth_array class_meths

Components

Type Visibility Attributes Name Initial
integer, private :: id = 0

unique ID for the method

character(len=:), private, allocatable :: name

the name of the method

integer, private :: class = 0

2=backward diffs, 3=central diffs, etc...

real(kind=wp), private, dimension(:), allocatable :: dx_factors

multiplicative factors for dx perturbation

real(kind=wp), private, dimension(:), allocatable :: df_factors

multiplicative factors for accumulating function evaluations

real(kind=wp), private :: df_den_factor = zero

denominator factor for finite difference equation (times dx)


Constructor

public interface finite_diff_method

constructor

  • private function initialize_finite_difference_method(id, name, class, dx_factors, df_factors, df_den_factor) result(me)

    Constructor for a finite_diff_method.

    Note

    factors are input as integers for convenience, but are converted to reals for the actual computations. (note: this means we can't currently define methods that have non-integer factors).

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: id

    unique ID for the method

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

    the name of the method

    integer, intent(in) :: class

    2=backward diffs, 3=central diffs, etc...

    integer, intent(in), dimension(:) :: dx_factors

    multiplicative factors for dx perturbation

    integer, intent(in), dimension(:) :: df_factors

    multiplicative factors for accumulating function evaluations

    integer, intent(in) :: df_den_factor

    denominator factor for finite difference equation (times dx)

    Return Value type(finite_diff_method)


Type-Bound Procedures

procedure, public :: get_formula

  • private subroutine get_formula(me, formula)

    Return a string with the finite difference formula.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(finite_diff_method), intent(in) :: me
    character(len=:), intent(out), allocatable :: formula

procedure, public :: print => print_finite_difference_method

Source Code

    type,public :: finite_diff_method

        !! defines the finite difference method
        !! used to compute the Jacobian.
        !!
        !! See: [[get_finite_difference_method]]
        !! for the different methods.

        private

        integer :: id = 0 !! unique ID for the method
        character(len=:),allocatable :: name  !! the name of the method
        integer :: class = 0 !! 2=backward diffs, 3=central diffs, etc...
        real(wp),dimension(:),allocatable :: dx_factors  !! multiplicative factors for `dx` perturbation
        real(wp),dimension(:),allocatable :: df_factors  !! multiplicative factors for accumulating function evaluations
        real(wp)                          :: df_den_factor = zero  !! denominator factor for finite difference equation (times `dx`)
    contains
        private
        procedure,public :: get_formula
        procedure,public :: print => print_finite_difference_method
    end type finite_diff_method