defines the finite difference method used to compute the Jacobian.
See: get_finite_difference_method for the different methods.
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 |
||
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 |
constructor
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).
Type | Intent | Optional | 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 a string with the finite difference formula.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(finite_diff_method), | intent(in) | :: | me | |||
character(len=:), | intent(out), | allocatable | :: | formula |
Print the contents of a finite_diff_method. Used for debugging.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(finite_diff_method), | intent(in) | :: | me | |||
integer, | intent(in) | :: | iunit |
file unit for printing (assumed to be opened) |
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