{"id":18847808,"url":"https://github.com/jacobwilliams/rklib","last_synced_at":"2026-01-31T22:03:50.137Z","repository":{"id":146678936,"uuid":"541304749","full_name":"jacobwilliams/rklib","owner":"jacobwilliams","description":"Fixed and variable-step Runge-Kutta solvers in Modern Fortran","archived":false,"fork":false,"pushed_at":"2025-04-27T22:46:05.000Z","size":3641,"stargazers_count":84,"open_issues_count":10,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-15T12:58:32.000Z","etag":null,"topics":["differential-equations","fortran","fortran-package-manager","ode","ode-solver","root-finding","runge-kutta","runge-kutta-adaptive-step-size","runge-kutta-fehlberg"],"latest_commit_sha":null,"homepage":"https://jacobwilliams.github.io/rklib/","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacobwilliams.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-25T20:45:26.000Z","updated_at":"2025-06-09T14:04:30.000Z","dependencies_parsed_at":"2023-07-22T20:48:45.142Z","dependency_job_id":"8bc5071d-785b-4d1d-be23-1a0c76cb48f1","html_url":"https://github.com/jacobwilliams/rklib","commit_stats":null,"previous_names":["jacobwilliams/rklib"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/jacobwilliams/rklib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Frklib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Frklib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Frklib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Frklib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacobwilliams","download_url":"https://codeload.github.com/jacobwilliams/rklib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Frklib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28956938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["differential-equations","fortran","fortran-package-manager","ode","ode-solver","root-finding","runge-kutta","runge-kutta-adaptive-step-size","runge-kutta-fehlberg"],"created_at":"2024-11-08T03:09:43.960Z","updated_at":"2026-01-31T22:03:50.105Z","avatar_url":"https://github.com/jacobwilliams.png","language":"Fortran","readme":"\n![rklib](media/rklib.png)\n============\n\n**rklib**: A modern Fortran library of fixed and variable-step Runge-Kutta solvers.\n\n[![Language](https://img.shields.io/badge/-Fortran-734f96?logo=fortran\u0026logoColor=white)](https://github.com/topics/fortran)\n[![GitHub release](https://img.shields.io/github/release/jacobwilliams/rklib.svg)](https://github.com/jacobwilliams/rklib/releases/latest)\n[![CI Status](https://github.com/jacobwilliams/rklib/actions/workflows/CI.yml/badge.svg)](https://github.com/jacobwilliams/rklib/actions)\n[![codecov](https://codecov.io/gh/jacobwilliams/rklib/branch/master/graph/badge.svg)](https://codecov.io/gh/jacobwilliams/rklib)\n[![last-commit](https://img.shields.io/github/last-commit/jacobwilliams/rklib)](https://github.com/jacobwilliams/rklib/commits/master)\n\n### Description\n\nThe focus of this library is single-step, explicit Runge-Kutta solvers for 1st order differential equations.\n\n### Novel features:\n\n  * The library includes a wide range of both fixed and variable-step Runge-Kutta methods, from very low to very high order.\n  * It is object-oriented and written in modern Fortran.\n  * It allows for defining a variable-step size integrator with a custom-tuned step size selection method. See `stepsize_class` in the code.\n  * The `real` kind is selectable via a compiler directive (`REAL32`, `REAL64`, or `REAL128`).\n  * Integration to an event is also supported. The root-finding method is also selectable (via the [roots-fortran](https://github.com/jacobwilliams/roots-fortran) library).\n\n### Available Runge-Kutta methods:\n\n  * Number of fixed-step methods:    28\n  * Number of variable-step methods: 48\n  * Total number of methods:         76\n\n### Fixed-step methods:\n\nName       | Description| Properties | Order | Stages   | Registers | CFL  | Reference\n---        | ---        | ---        | ---   | ---      | ---       | ---  | ---\n`euler` | Euler |  | 1 | 1 | 1 | 1.0 | [Euler (1768)](https://archive.org/details/institutionescal020326mbp)\n`midpoint` | Midpoint |  | 2 | 2 | 2 |  | ?\n`heun` | Heun |  | 2 | 2 | 2 |  | ?\n`rkssp22` | 2-stage, 2nd order TVD Runge-Kutta Shu-Osher | SSP | 2 | 2 | 1 | 1.0 | [Shu \u0026 Oscher (1988)](https://ntrs.nasa.gov/api/citations/19880014833/downloads/19880014833.pdf)\n`rk3` | 3th order Runge-Kutta |  | 3 | 3 | 3 |  | ?\n`rkssp33` | 3-stage, 3rd order TVD Runge-Kutta Shu-Osher | SSP | 3 | 3 | 1 | 1.0 | [Shu \u0026 Oscher (1988)](https://ntrs.nasa.gov/api/citations/19880014833/downloads/19880014833.pdf)\n`rkssp53` | 5-stage, 3rd order SSP Runge-Kutta Spiteri-Ruuth | SSP | 3 | 5 | 2 | 2.65 | [Ruuth (2006)](https://www.ams.org/journals/mcom/2006-75-253/S0025-5718-05-01772-2/S0025-5718-05-01772-2.pdf)\n`rk4` | Classic 4th order Runge-Kutta |  | 4 | 4 | 4 |  | [Kutta (1901)](https://archive.org/stream/zeitschriftfrma12runggoog#page/n449/mode/2up)\n`rks4` | 4th order Runge-Kutta Shanks |  | 4 | 4 | 4 |  | [Shanks (1965)](http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19650022581.pdf)\n`rkr4` | 4th order Runge-Kutta Ralston |  | 4 | 4 | 4 |  | [Ralston (1962)](https://doi.org/10.1090%2FS0025-5718-1962-0150954-0)\n`rkls44` | 4-stage, 4th order low storage non-TVD Runge-Kutta Jiang-Shu | LS | 4 | 4 | 2 |  | [Jiang and Shu (1988)](https://ntrs.nasa.gov/api/citations/19960007052/downloads/19960007052.pdf)\n`rkls54` | 5-stage, 4th order low storage Runge-Kutta Carpenter-Kennedy | LS | 4 | 5 | 2 | 0.32 | [Carpenter \u0026 Kennedy (1994)](https://ntrs.nasa.gov/api/citations/19940028444/downloads/19940028444.pdf)\n`rkssp54` | 5-stage, 4th order SSP Runge-Kutta Spiteri-Ruuth | SSP | 4 | 5 | 4 | 1.51 | [Ruuth (2006)](https://www.ams.org/journals/mcom/2006-75-253/S0025-5718-05-01772-2/S0025-5718-05-01772-2.pdf)\n`rks5` | 5th order Runge-Kutta Shanks |  | 5 | 5 | 5 |  | [Shanks (1965)](http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19650022581.pdf)\n`rk5` | 5th order Runge-Kutta |  | 5 | 6 | 6 |  | ?\n`rkc5` | 5th order Runge-Kutta Cassity |  | 5 | 6 | 6 |  | [Cassity (1966)](https://epubs.siam.org/doi/10.1137/0703052)\n`rkl5` | 5th order Runge-Kutta Lawson |  | 5 | 6 | 6 |  | [Lawson (1966)](https://epubs.siam.org/doi/abs/10.1137/0703051)\n`rklk5a` | 5th order Runge-Kutta Luther-Konen 1 |  | 5 | 6 | 6 |  | [Luther \u0026 Konen (1965)](https://epubs.siam.org/doi/abs/10.1137/1007112)\n`rklk5b` | 5th order Runge-Kutta Luther-Konen 2 |  | 5 | 6 | 6 |  | [Luther \u0026 Konen (1965)](https://epubs.siam.org/doi/abs/10.1137/1007112)\n`rkb6` | 6th order Runge-Kutta Butcher |  | 6 | 7 | 7 |  | [Butcher (1963)](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/40DFE501CAB781C9AAE1439B6B8F481A/S1446788700023387a.pdf/div-class-title-on-runge-kutta-processes-of-high-order-div.pdf)\n`rk7` | 7th order Runge-Kutta Shanks |  | 7 | 9 | 9 |  | [Shanks (1965)](http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19650022581.pdf)\n`rk8_10` | 10-stage, 8th order Runge-Kutta Shanks |  | 8 | 10 | 10 |  | [Shanks (1965)](http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19650022581.pdf)\n`rkcv8` | 11-stage, 8th order Runge-Kutta Cooper-Verner |  | 8 | 11 | 11 |  | [Cooper \u0026 Verner (1972)](https://epubs.siam.org/doi/abs/10.1137/0709037)\n`rk8_12` | 12-stage, 8th order Runge-Kutta Shanks |  | 8 | 12 | 12 |  | [Shanks (1965)](http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19650022581.pdf)\n`rks10` | 10th order Runge-Kutta Stepanov |  | 10 | 15 | 15 |  | [Stepanov (2025)](https://arxiv.org/abs/2504.17329)\n`rkz10` | 10th order Runge-Kutta Zhang |  | 10 | 16 | 16 |  | [Zhang (2019)](https://arxiv.org/abs/1911.00318)\n`rko10` | 10th order Runge-Kutta Ono |  | 10 | 17 | 17 |  | [Ono (2003)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK10/RKcoeff10f_1.pdf)\n`rkh10` | 10th order Runge-Kutta Hairer |  | 10 | 17 | 17 |  | [Hairer (1978)](https://www.researchgate.net/publication/31221486_A_Runge-Kutta_Method_of_Order_10)\n\n\n\n### Variable-step methods:\n\nName       | Description| Properties | Order | Stages   | Registers | CFL  | Reference\n---        | ---        | ---        | ---   | ---      | ---       | ---  | ---\n`rkbs32` | Bogacki \u0026 Shampine 3(2) | FSAL | 3 | 4 | 4 |  | [Bogacki \u0026 Shampine (1989)](https://www.sciencedirect.com/science/article/pii/0893965989900797)\n`rkssp43` | 4-stage, 3rd order SSP | SSP, LS | 3 | 4 | 2 | 2.0 | [Kraaijevanger (1991)](https://doi.org/10.1007/BF01933264), [Conde et al. (2018)](https://doi.org/10.48550/arXiv.1806.08693)\n`rkf45` | Fehlberg 4(5) |  | 4 | 6 | 6 |  | [Fehlberg (1969)](https://ntrs.nasa.gov/api/citations/19690021375/downloads/19690021375.pdf)\n`rkck54` | Cash \u0026 Karp 5(4) |  | 5 | 6 | 6 |  | [Cash \u0026 Karp (1990)](http://www.elegio.it/mc2/rk/doc/p201-cash-karp.pdf)\n`rkdp54` | Dormand-Prince 5(4) | FSAL | 5 | 7 | 7 |  | [Dormand \u0026 Prince (1980)](https://www.sciencedirect.com/science/article/pii/0771050X80900133?via%3Dihub)\n`rkt54` | Tsitouras 5(4) | FSAL | 5 | 7 | 7 |  | [Tsitouras (2011)](https://www.sciencedirect.com/science/article/pii/S0898122111004706/pdf)\n`rks54` | Stepanov 5(4) | FSAL | 5 | 7 | 7 |  | [Stepanov (2022)](https://arxiv.org/pdf/2108.12590.pdf)\n`rkpp54` | Papakostas-PapaGeorgiou 5(4) | FSAL | 5 | 7 | 7 |  | [Papakostas \u0026 Papageorgiou (1996)](https://www.jstor.org/stable/2153797)\n`rkpp54b` | Papakostas-PapaGeorgiou 5(4) b | FSAL | 5 | 7 | 7 |  | [Papakostas \u0026 Papageorgiou (1996)](https://www.jstor.org/stable/2153797)\n`rkbs54` | Bogacki \u0026 Shampine 5(4) |  | 5 | 8 | 8 |  | [Bogacki \u0026 Shampine (1996)](https://www.sciencedirect.com/science/article/pii/0898122196001411)\n`rkss54` | Sharp \u0026 Smart 5(4) |  | 5 | 7 | 7 |  | [Sharp \u0026 Smart (1993)](https://epubs.siam.org/doi/10.1137/0914021)\n`rkdp65` | Dormand-Prince 6(5) |  | 6 | 8 | 8 |  | [Dormand \u0026 Prince (1981)](https://www.sciencedirect.com/science/article/pii/0771050X81900103)\n`rkc65` | Calvo 6(5) |  | 6 | 9 | 9 |  | [Calvo (1990)](https://www.sciencedirect.com/science/article/pii/089812219090064Q)\n`rktp64` | Tsitouras \u0026 Papakostas NEW6(4) |  | 6 | 7 | 7 |  | [Tsitouras \u0026 Papakostas (1999)](https://epubs.siam.org/doi/abs/10.1137/S1064827596302230?journalCode=sjoce3)\n`rkv65e` | Verner efficient (9,6(5)) | FSAL | 6 | 9 | 9 |  | [Verner (1994)](https://www.sfu.ca/~jverner/RKV65.IIIXb.Efficient.00000144617.081204.CoeffsOnlyFLOAT)\n`rkv65r` | Verner robust (9,6(5)) | FSAL | 6 | 9 | 9 |  | [Verner (1994)](https://www.sfu.ca/~jverner/RKV65.IIIXb.Robust.00010102836.081204.RATOnWeb)\n`rkv65` | Verner 6(5) |  | 6 | 8 | 8 |  | [Verner (2006)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK6/RKcoeff6e_3.pdf)\n`dverk65` | Verner 6(5) \"DVERK\" |  | 6 | 8 | 8 |  | Verner (?)\n`rktf65` | Tsitouras \u0026 Famelis 6(5) | FSAL | 6 | 9 | 9 |  | [Tsitouras \u0026 Famelis (2006)](http://users.uoa.gr/~tsitourasc/ModifiedRK-ICNAAM2006.pdf)\n`rktp75` | Tsitouras \u0026 Papakostas NEW7(5) |  | 7 | 9 | 9 |  | [Tsitouras \u0026 Papakostas (1999)](https://epubs.siam.org/doi/abs/10.1137/S1064827596302230?journalCode=sjoce3)\n`rktmy7` | 7th order Tanaka-Muramatsu-Yamashita |  | 7 | 10 | 10 |  | [Tanaka, Muramatsu \u0026 Yamashita (1992)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK7/RKcoeff7d_4.pdf)\n`rktmy7s` | 7th order Stable Tanaka-Muramatsu-Yamashita |  | 7 | 10 | 10 |  | [Tanaka, Muramatsu \u0026 Yamashita (1992)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK7/RKcoeff7d_3.pdf)\n`rkv76e` | Verner efficient (10:7(6)) |  | 7 | 10 | 10 |  | [Verner (1978)](https://epubs.siam.org/doi/10.1137/0715051)\n`rkv76r` | Verner robust (10:7(6)) |  | 7 | 10 | 10 |  | [Verner (1978)](https://epubs.siam.org/doi/10.1137/0715051)\n`rkss76` | Sharp \u0026 Smart 7(6) |  | 7 | 11 | 11 |  | [Sharp \u0026 Smart (1993)](https://epubs.siam.org/doi/10.1137/0914021)\n`rkf78` | Fehlberg 7(8) |  | 7 | 13 | 13 |  | [Fehlberg (1968)](https://ntrs.nasa.gov/citations/19680027281)\n`rkv78` | Verner 7(8) |  | 7 | 13 | 13 |  | [Verner (1978)](https://www.jstor.org/stable/2156853)\n`dverk78` | Verner \"Maple\" 7(8) |  | 7 | 13 | 13 |  | [Verner (?)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK8/RKcoeff8c_2.pdf)\n`rkdp85` | Dormand-Prince 8(5) |  | 8 | 12 | 12 |  | [Hairer (1993)](https://github.com/jacobwilliams/dop853)\n`rktp86` | Tsitouras \u0026 Papakostas NEW8(6) |  | 8 | 12 | 12 |  | [Tsitouras \u0026 Papakostas (1999)](https://epubs.siam.org/doi/abs/10.1137/S1064827596302230?journalCode=sjoce3)\n`rkdp87` | Dormand \u0026 Prince RK8(7)13M |  | 8 | 13 | 13 |  | [Prince \u0026 Dormand (1981)](https://www.sciencedirect.com/science/article/pii/0771050X81900103)\n`rkv87e` | Verner efficient (8)7 |  | 8 | 13 | 13 |  | [Verner (1978)](https://epubs.siam.org/doi/10.1137/0715051)\n`rkv87r` | Verner robust (8)7 |  | 8 | 13 | 13 |  | [Verner (1978)](https://epubs.siam.org/doi/10.1137/0715051)\n`rkev87` | Enright-Verner (8)7 |  | 8 | 13 | 13 |  | [Enright (1993)](https://epubs.siam.org/doi/10.1137/0730074)\n`rkk87` | Kovalnogov-Fedorov-Karpukhina-Simos-Tsitouras 8(7) |  | 8 | 13 | 13 |  | [Kovalnogov, Fedorov, Karpukhina, Simos, Tsitouras (2022)](https://www.researchgate.net/publication/363396601_Runge-Kutta_Embedded_Methods_of_Orders_87_for_Use_in_Quadruple_Precision_Computations)\n`rkf89` | Fehlberg 8(9) |  | 8 | 17 | 17 |  | [Fehlberg (1968)](https://ntrs.nasa.gov/citations/19680027281)\n`rkv89` | Verner 8(9) |  | 8 | 16 | 16 |  | [Verner (1978)](https://www.jstor.org/stable/2156853)\n`rkt98a` | Tsitouras 9(8) A |  | 9 | 16 | 16 |  | [Tsitouras (2001)](https://www.sciencedirect.com/science/article/abs/pii/S0168927401000253)\n`rkv98e` | Verner efficient (16:9(8)) |  | 9 | 16 | 16 |  | [Verner (1978)](https://www.jstor.org/stable/2156853)\n`rkv98r` | Verner robust (16:9(8)) |  | 9 | 16 | 16 |  | [Verner (1978)](https://www.jstor.org/stable/2156853)\n`rks98` | Sharp 9(8) |  | 9 | 16 | 16 |  | [Sharp (2000)](https://www.hindawi.com/journals/ads/2000/853972/)\n`rkf108` | Feagin 8(10) |  | 10 | 17 | 17 |  | [Feagin (2006)](https://sce.uhcl.edu/rungekutta/rk108.txt)\n`rkc108` | Curtis 10(8) |  | 10 | 21 | 21 |  | [Curtis (1975)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK10/RKcoeff10a(8)_2.pdf)\n`rkb109` | Baker 10(9) |  | 10 | 21 | 21 |  | [Baker (?)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK10/RKcoeff10c_1.pdf)\n`rks1110a` | Stone 11(10) |  | 11 | 26 | 26 |  | [Stone (2015)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK11/RKcoeff11_a.pdf)\n`rkf1210` | Feagin 12(10) |  | 12 | 25 | 25 |  | [Feagin (2006)](https://sce.uhcl.edu/rungekutta/rk1210.txt)\n`rko129` | Ono 12(9) |  | 12 | 29 | 29 |  | [Ono (2006)](http://www.peterstone.name/Maplepgs/Maple/nmthds/RKcoeff/Runge_Kutta_schemes/RK12/RKcoeff12h(9)_1.pdf)\n`rkf1412` | Feagin 14(12) |  | 14 | 35 | 35 |  | [Feagin (2006)](https://sce.uhcl.edu/rungekutta/rk1412.txt)\n\n\n\n#### Properties key:\n  * LS = Low storage\n  * SSP = Strong stability preserving\n  * FSAL = First same as last\n  * CFL = Courant-Friedrichs-Lewy\n\n### Example use case\n\nBasic use of the library is shown here (this uses the `rktp86` method):\n\n```fortran\nprogram rklib_example\n\n  use rklib_module, wp =\u003e rk_module_rk\n  use iso_fortran_env, only: output_unit\n\n  implicit none\n\n  integer,parameter :: n = 2 !! dimension of the system\n  real(wp),parameter :: tol = 1.0e-12_wp !! integration tolerance\n  real(wp),parameter :: t0 = 0.0_wp !! initial t value\n  real(wp),parameter :: dt = 1.0_wp !! initial step size\n  real(wp),parameter :: tf = 100.0_wp !! endpoint of integration\n  real(wp),dimension(n),parameter :: x0 = [0.0_wp,0.1_wp] !! initial x value\n\n  real(wp),dimension(n) :: xf !! final x value\n  type(rktp86_class) :: prop\n  character(len=:),allocatable :: message\n\n  call prop%initialize(n=n,f=fvpol,rtol=[tol],atol=[tol])\n  call prop%integrate(t0,x0,dt,tf,xf)\n  call prop%status(message=message)\n\n  write (output_unit,'(A)') message\n  write (output_unit,'(A,F7.2/,A,2E18.10)') \u0026\n              'tf =',tf ,'xf =',xf(1),xf(2)\n\ncontains\n\n  subroutine fvpol(me,t,x,f)\n    !! Right-hand side of van der Pol equation\n\n    class(rk_class),intent(inout)     :: me\n    real(wp),intent(in)               :: t\n    real(wp),dimension(:),intent(in)  :: x\n    real(wp),dimension(:),intent(out) :: f\n\n    f(1) = x(2)\n    f(2) = 0.2_wp*(1.0_wp-x(1)**2)*x(2) - x(1)\n\n  end subroutine fvpol\n\nend program rklib_example\n```\n\nThe result is:\n\n```\nSuccess\ntf = 100.00\nxf = -0.1360372426E+01  0.1325538438E+01\n```\n\n### Example performance comparison\n\nRunning the unit tests will generate some performance plots. The following is for the variable-step methods compiled with quadruple precision (e.g, `fpm test rk_test_variable_step --compiler ifort --flag \"-DREAL128\"`):\n\n![rk_test_variable_step_R16](media/rk_test_variable_step_R16.pdf)\n\n### Compiling\n\nA [Fortran Package Manager](https://github.com/fortran-lang/fpm) manifest file is included, so that the library and test cases can be compiled with FPM. For example:\n\n```\nfpm build --profile release\nfpm test --profile release\n```\n\nTo use `rklib` within your FPM project, add the following to your `fpm.toml` file:\n```toml\n[dependencies]\nrklib = { git=\"https://github.com/jacobwilliams/rklib.git\" }\n```\n\nBy default, the library is built with double precision (`real64`) real values. Explicitly specifying the real kind can be done using the following processor flags:\n\nPreprocessor flag | Kind  | Number of bytes\n----------------- | ----- | ---------------\n`REAL32`  | `real(kind=real32)`  | 4\n`REAL64`  | `real(kind=real64)`  | 8\n`REAL128` | `real(kind=real128)` | 16\n\nFor example, to build a single precision version of the library, use:\n\n```\nfpm build --profile release --flag \"-DREAL32\"\n```\n\nTo generate the documentation using [FORD](https://github.com/Fortran-FOSS-Programmers/ford), run:\n\n```\nford ford.md\n```\n\n### 3rd Party Dependencies\n\n  * The library requires [roots-fortran](https://github.com/jacobwilliams/roots-fortran).\n  * The unit tests require [pyplot-fortran](https://github.com/jacobwilliams/pyplot-fortran), to generate the performance plots.\n  * The `coefficients` app (not required to use the library, but used to generate some of the code) requires the [mpfun2020-var1](https://github.com/jacobwilliams/mpfun2020-var1.git) arbitrary precision library.\n\nAll of these will be automatically downloaded by FPM.\n\n### Documentation\n\nThe latest API documentation for the `master` branch can be found [here](https://jacobwilliams.github.io/rklib/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford).\n\n### Notes\n\nThe original version of this code was split off from the [Fortran Astrodynamics Toolkit](https://github.com/jacobwilliams/Fortran-Astrodynamics-Toolkit) in September 2022.\n\n### For developers\n\nTo add a new method to this library:\n\n  * Update the tables (either the fixed or variable one in `scripts/generate_files.py`)\n  * Run `python scripts/generate_files.py` to update all the include files. This script will generate all the boilerplate code for all the methods. It will also this `README` file.\n  * Add a step function (either in `rklib_fixed_steps.f90` or `rklib_variable_steps.f90`). Note that you can generate a template of an RK step function using the `scripts/generate_rk_code.py` script. The two command line arguments are the number of function evaluations required and the method name (e.g., `'rk4'`). Edit the template accordingly (note at the FSAL ones have a slightly different format).\n  * Update the unit tests.\n\n### License\n\nThe `rklib` source code and related files and documentation are distributed under a permissive free software [license](https://github.com/jacobwilliams/rklib/blob/master/LICENSE.md) (BSD-3).\n\n### References\n\n  * E. B. Shanks, \"[Higher Order Approximations of Runge-Kutta Type](http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19650022581.pdf)\", NASA Technical Note, NASA TN D-2920, Sept. 1965.\n  * E. B. Shanks, \"[Solutions of Differential Equations by Evaluations of Functions](https://www.ams.org/journals/mcom/1966-20-093/S0025-5718-1966-0187406-1/S0025-5718-1966-0187406-1.pdf)\" Math. Comp. 20 (1966).\n  * E. Fehlberg, \"Classical Fifth-, Sixth-, Seventh-, and Eighth-Order Runge-Kutta Formulas with Stepsize Control\", [NASA TR R-2870](https://ntrs.nasa.gov/citations/19680027281), 1968.\n  * E. Fehlberg, \"[Low-order classical Runge-Kutta formulas with stepsize control and their application to some heat transfer problems](https://ntrs.nasa.gov/api/citations/19690021375/downloads/19690021375.pdf)\", NASA Technical Report R-315, July 1, 1969.\n  * J. H. Verner, \"Explicit Runge-Kutta Methods with Estimates of the Local Truncation Error\", SIAM Journal on Numerical Analysis, 15(4), 772-790, 1978.\n  * T. Feagin, \"[High-Order Explicit Runge-Kutta Methods](https://sce.uhcl.edu/rungekutta/)\"\n  * J. C. Butcher, \"[A history of Runge-Kutta methods](https://www.sciencedirect.com/science/article/abs/pii/0168927495001085)\", Applied Numerical Mathematics, Volume 20, Issue 3, March 1996, Pages 247-260\n  * J. C. Butcher, \"[On Runge-Kutta Processes of High Order](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/40DFE501CAB781C9AAE1439B6B8F481A/S1446788700023387a.pdf)\", Oct. 28, 1963.\n  * G. E. Müllges \u0026 F. Uhlig, \"Numerical Algorithms with Fortran\", Springer, 1996.\n  * K. Fox, \"[Numerical Integration of the Equations of Motion of Celestial Mechanics](https://adsabs.harvard.edu/full/1984CeMec..33..127F)\", Celestial Mechanics 33, p 127-142, 1984.\n  * [Mathematics Source Library](http://www.mymathlib.com/diffeq/)\n  * [Maple worksheets on the derivation of Runge-Kutta schemes](http://www.peterstone.name/Maplepgs/RKcoeff.html)\n  * [Index of numerical integrators](http://ketch.github.io/numipedia/index.html)\n  * J. Williams, [Fehlberg's Runge-Kutta Methods](https://degenerateconic.com/fehlbergs-runge-kutta-methods.html), Feb. 10, 2018.\n  * C.-W. Shu, S. Osher, \"[Efficient implementation of essentially non-oscillatory shock-capturing schemes](https://doi.org/10.1016/0021-9991(88)90177-5)\", Journal of Computational Physics, 77(2), 439-471, 1988.\n  * S. Ruuth, \"[Global optimization of explicit strong-stability-preserving Runge-Kutta methods.](https://doi.org/10.1090/S0025-5718-05-01772-2)\" Mathematics of Computation 75.253 (2006): 183-207.\n  * Jiang, Guang-Shan, and Chi-Wang Shu. \"[Efficient implementation of weighted ENO schemes.](https://doi.org/10.1006/jcph.1996.0130)\" Journal of computational physics 126.1 (1996): 202-228.\n\n### See also\n\n  * [FOODIE](https://github.com/Fortran-FOSS-Programmers/FOODIE) Fortran Object-Oriented Differential-equations Integration Environment\n  * [FLINT](https://github.com/princemahajan/FLINT) Fortran Library for numerical INTegration of differential equations\n  * [DDEABM](https://github.com/jacobwilliams/ddeabm) Modern Fortran implementation of the DDEABM Adams-Bashforth algorithm\n  * [DOP853](https://github.com/jacobwilliams/dop853) Modern Fortran Edition of Hairer's DOP853 ODE Solver. An explicit Runge-Kutta method of order 8(5,3) for problems y'=f(x,y); with dense output of order 7\n  * [DVODE](https://github.com/jacobwilliams/dvode) Modern Fortran Edition of the DVODE ODE Solver\n  * [ODEPACK](https://github.com/jacobwilliams/odepack) Work in Progress to refactor and modernize the ODEPACK Library\n  * [libode](https://github.com/markmbaum/libode) Easy-to-compile, high-order ODE solvers as C++ classes\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobwilliams%2Frklib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobwilliams%2Frklib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobwilliams%2Frklib/lists"}