MRKISS 2025-09-10
A tiny library with zero dependencies that aims to make it easy to use & experiment with explicit Runge-Kutta methods.
Loading...
Searching...
No Matches
mrkiss_eerk_cash_karp_5_4.f90
Go to the documentation of this file.
1! -*- Mode:F90; Coding:us-ascii-unix; fill-column:129 -*-
2!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.H.S.!!
3!>
4!! @file mrkiss_eerk_cash_karp_5_4.f90
5!! @author Mitch Richling http://www.mitchr.me/
6!! @brief Butcher tableau for Cash & Karp's 4 step, order (5,4) Runge-Kutta method.@EOL
7!! @keywords ode ivp differential equation initial value problem rk
8!! @std F2023
9!! @see https://github.com/richmit/MRKISS
10!! @copyright
11!! @parblock
12!! Copyright (c) 2025, Mitchell Jay Richling <http://www.mitchr.me/> All rights reserved.
13!!
14!! Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
15!! conditions are met:
16!!
17!! 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following
18!! disclaimer.
19!!
20!! 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following
21!! disclaimer in the documentation and/or other materials provided with the distribution.
22!!
23!! 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
24!! derived from this software without specific prior written permission.
25!!
26!! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
27!! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28!! DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30!! USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31!! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
32!! OF THE POSSIBILITY OF SUCH DAMAGE.
33!! @endparblock
34!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!.H.E.!!
35
36!----------------------------------------------------------------------------------------------------------------------------------
37!> Butcher tableau for Cash & Karp's 4 step, order (5,4) Runge-Kutta method
38!!
39!! @image html eerk_cash_karp_5_4-stab.png
40!!
41!! @par IMO
42!! I don't recommend this method as a 2 step embedded method for general use. It was designed with five embedded methods for use
43!! with stiff applications. It's an interesting method from both a historical and research perspective. Note this module has
44!! all five embedded methods defined (b1/p1-b5/p5).
45!!
46!! @par Known Aliases
47!! 'ARKODE_CASH_KARP_6_4_5' (SUNDIALS)
48!!
49!! @par Stability Image Links
50!! <a href="eerk_cash_karp_5_4-stab.png"> <img src="eerk_cash_karp_5_4-stab.png" width="256px"> </a>
51!! <a href="eerk_cash_karp_5_4-astab.png"> <img src="eerk_cash_karp_5_4-astab.png" width="256px"> </a><br>
52!! <a href="eerk_cash_karp_5_4-star1.png"> <img src="eerk_cash_karp_5_4-star1.png" width="256px"> </a>
53!! <a href="eerk_cash_karp_5_4-star2.png"> <img src="eerk_cash_karp_5_4-star2.png" width="256px"> </a>
54!! <a href="eerk_cash_karp_5_4-star3.png"> <img src="eerk_cash_karp_5_4-star3.png" width="256px"> </a>
55!! <a href="eerk_cash_karp_5_4-star4.png"> <img src="eerk_cash_karp_5_4-star4.png" width="256px"> </a>
56!! <a href="eerk_cash_karp_5_4-star5.png"> <img src="eerk_cash_karp_5_4-star5.png" width="256px"> </a>
57!!
58!! @par References:
59!! - Cash & Karp(1990); A variable order Runge-Kutta method for initial value problems with rapidly varying
60!! right-hand sides; TOMS 16; zotero://select/items/0_2YSGGWSD
61!!
63 use mrkiss_config, only: rk
64 implicit none
65 public
66 !> The order of the overall method
67 integer, parameter :: s = 6
68 !> Number of methods
69 integer, parameter :: m = 5
70 !> The @f$\mathbf{a}@f$ matrix for the Butcher Tableau. @hideinitializer @showinlinesource
71 real(kind=rk), parameter :: a(s,s) = reshape([ 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, &
72 110592.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, &
73 41472.0_rk, 124416.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, &
74 165888.0_rk, -497664.0_rk, 663552.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, &
75 -112640.0_rk, 1382400.0_rk, -1433600.0_rk, 716800.0_rk, 0.0_rk, 0.0_rk, &
76 16310.0_rk, 189000.0_rk, 23000.0_rk, 221375.0_rk, 34155.0_rk, 0.0_rk], [s, s]) / 552960.0_rk
77 !> The @f$\mathbf{b}@f$ matrix for the Butcher Tableau. @hideinitializer @hideinlinesource
78 real(kind=rk), parameter :: b(s,m) = reshape([ 9585664.0_rk, 0.0_rk, 39424000.0_rk, 20608000.0_rk, 0.0_rk, 28311552.0_rk, &
79 & 10006150.0_rk, 0.0_rk, 37595800.0_rk, 23952775.0_rk, 1892187.0_rk, 24482304.0_rk, &
80 & 34456576.0_rk, 0.0_rk, -36270080.0_rk, 99742720.0_rk, 0.0_rk, 0.0_rk, &
81 & -146893824.0_rk, 244823040.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, &
82 & 97929216.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk, 0.0_rk], [s, m]) / 97929216.0_rk
83 !> The @f$\mathbf{c}@f$ matrix for the Butcher Tableau. @hideinitializer @showinlinesource
84 real(kind=rk), parameter :: c(s) = [ 0.0_rk, 8.0_rk, 12.0_rk, 24.0_rk, 40.0_rk, 35.0_rk] / 40.0_rk
85 !> The method orders
86 integer, parameter :: p(m) = [5, 4, 3, 2, 1]
87 !> Number of stages for each method
88 integer, parameter :: se(m) = [6, 6, 4, 2, 1]
Configuration for MRKISS == MR RK KISS == Mitch Richling's Runge-Kutta Keep It Simple Stupid.
integer, parameter, public rk
Real kind used across the library.
Butcher tableau for Cash & Karp's 4 step, order (5,4) Runge-Kutta method.
integer, parameter m
Number of methods.
real(kind=rk), dimension(s), parameter c
The matrix for the Butcher Tableau.
integer, parameter s
The order of the overall method.
integer, dimension(m), parameter p
The method orders.
real(kind=rk), dimension(s, s), parameter a
The matrix for the Butcher Tableau.
real(kind=rk), dimension(s, m), parameter b
The matrix for the Butcher Tableau.
integer, dimension(m), parameter se
Number of stages for each method.