fortplot_streamline_integrator Module

DOPRI5 (Dormand-Prince 5(4)) integrator for streamline computation Provides adaptive step size control and high-order accuracy

Following SOLID principles: - Single responsibility: Only handles numerical integration - Open/closed: Extensible to other integration methods - Interface segregation: Clean, focused interface - Dependency inversion: Depends on abstract velocity field interface Integration parameters for DOPRI5 method DOPRI5 Butcher tableau coefficients



Derived Types

type, public ::  integration_params_t

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: rtol = 1.0e-6_wp

Relative tolerance

real(kind=wp), public :: atol = 1.0e-9_wp

Absolute tolerance

real(kind=wp), public :: h_initial = 0.01_wp

Initial step size

real(kind=wp), public :: h_min = 1.0e-12_wp

Minimum step size

real(kind=wp), public :: h_max = 1.0_wp

Maximum step size

integer, public :: max_steps = 10000

Maximum integration steps

real(kind=wp), public :: safety_factor = 0.9_wp

Step size safety factor

real(kind=wp), public :: max_factor = 5.0_wp

Maximum step increase factor

real(kind=wp), public :: min_factor = 0.2_wp

Minimum step decrease factor


Subroutines

public subroutine dopri5_integrate(x0, y0, t0, t_final, u_func, v_func, params, path_x, path_y, times, n_points, n_accepted, n_rejected, success)

Integrate streamline using DOPRI5 method with adaptive step size

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x0
real(kind=wp), intent(in) :: y0
real(kind=wp), intent(in) :: t0
real(kind=wp), intent(in) :: t_final
private function u_func(x, y)
Arguments
Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: y
Return Value real(kind=wp)
private function v_func(x, y)
Arguments
Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: y
Return Value real(kind=wp)
type(integration_params_t), intent(in) :: params
real(kind=wp), intent(out), allocatable :: path_x(:)
real(kind=wp), intent(out), allocatable :: path_y(:)
real(kind=wp), intent(out), allocatable :: times(:)
integer, intent(out) :: n_points
integer, intent(out) :: n_accepted
integer, intent(out) :: n_rejected
logical, intent(out) :: success