{"id":17360734,"url":"https://github.com/ivan-pi/stiff3","last_synced_at":"2026-01-06T21:52:11.212Z","repository":{"id":47774629,"uuid":"367682976","full_name":"ivan-pi/stiff3","owner":"ivan-pi","description":"Adaptive solver for stiff systems of ODEs using semi-implicit Runge-Kutta method of third order","archived":false,"fork":false,"pushed_at":"2025-01-15T23:48:43.000Z","size":46,"stargazers_count":23,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T20:13:34.498Z","etag":null,"topics":["adaptive","differential","equation","fortran","ode","solver","stiff"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivan-pi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-05-15T16:44:08.000Z","updated_at":"2024-08-02T20:17:40.000Z","dependencies_parsed_at":"2022-09-08T19:50:15.463Z","dependency_job_id":null,"html_url":"https://github.com/ivan-pi/stiff3","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.04761904761904767,"last_synced_commit":"057a6995fc550cc501370116a54bc5d63b0c8b7f"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Fstiff3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Fstiff3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Fstiff3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan-pi%2Fstiff3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivan-pi","download_url":"https://codeload.github.com/ivan-pi/stiff3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245881657,"owners_count":20687759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["adaptive","differential","equation","fortran","ode","solver","stiff"],"created_at":"2024-10-15T19:27:48.400Z","updated_at":"2026-01-06T21:52:11.129Z","avatar_url":"https://github.com/ivan-pi.png","language":"Fortran","readme":"# stiff3\n\n`stiff3` is a Fortran subprogram for solving stiff autonomous systems of ordinary differential equations (ODE's) using a semi-implicit Runge-Kutta method with three steps (SIRK3). The `stiff3` source code was originally published in the work:\n\n\u003e Villadsen, J., \u0026 Michelsen, M. L. (1978). *Solution of differential equation models by polynomial approximation*. Prentice-Hall, Inc.\n\nThis repository provides a refactored version with a simplified procedural interface.\n\n## Installation\n\nTo use this project you need to have\n\n* a recent Fortran compiler\n* BLAS and LAPACK libraries\n* [Fortran package manager (fpm)](https://github.com/fortran-lang/fpm)\n\nTo use `stiff3` include it as a dependency in your fpm package manifest\n\n```toml\n[dependencies]\nstiff3.git = \"https://github.com/ivan-pi/stiff3\"\n```\n\nTo build the library (as the main project) invoke fpm in the project root with\n\n```\nfpm build\n```\nTwo examples called `robertson` and `vanpol` are provided. They can be run with the the command\n\n```\nfpm run --example \u003cname\u003e\n```\n\n## Usage\n\nBasic use of the solver is demonstrated using the [Van der Pol oscillator](https://en.wikipedia.org/wiki/Van_der_Pol_oscillator):\n\n```fortran\nprogram vanpol\n\n  use stiff3_solver, only: wp =\u003e stiff3_wp, stiff3\n  implicit none\n\n  integer, parameter :: n = 2, nout = 1\n  real(wp), parameter :: mu = 10.0_wp\n  real(wp) :: y(n), w(n), x0, x1, h0, eps\n\n! initial value\n  y = [1.0_wp, 1.0_wp]\n! initial step size\n  h0 = 0.001_wp\n! tolerance\n  eps = 1.0e-4_wp\n  w = 1\n! time interval\n  x0 = 0.0_wp\n  x1 = 100.0_wp\n! output initial condition\n  call out(x0,y,0,0.0_wp)\n! integrate system of ODEs\n  call stiff3(n,fun,jac,out,nout,x0,x1,h0,eps,w,y)\n\ncontains\n\n  subroutine fun(n,y,f)\n    integer, intent(in) :: n\n    real(wp), intent(in) :: y(n)\n    real(wp), intent(inout) :: f(n)\n    f(1) = y(2)\n    f(2) = mu*(1.0_wp - y(1)**2)*y(2) - y(1)\n  end subroutine\n\n  subroutine jac(n,y,df)\n    integer, intent(in) :: n\n    real(wp), intent(in) :: y(n)\n    real(wp), intent(inout) :: df(n,n)\n    df(1,1) = 0.0_wp\n    df(1,2) = 1.0_wp\n    df(2,1) = mu*y(2)*(-2*y(1)) - 1.0_wp\n    df(2,2) = mu*(1.0_wp - y(1)**2)\n  end subroutine\n\n  subroutine out(t,y,ih,qa)\n    real(wp), intent(in) :: t\n    real(wp), intent(in) :: y(:)\n    integer, intent(in) :: ih\n    real(wp), intent(in) :: qa\n    write(*,'(3(E18.12,2X),I4,2X,G0)') t, y(1), y(2), ih, qa\n  end subroutine\n\nend program\n```\n\n## Method\n\nThe semi-implicit Runge-Kutta method used by `stiff3` was first published in\n\n\u003e Caillaud, J. B., \u0026 Padmanabhan, L. (1971). An improved semi-implicit Runge-Kutta method for stiff systems. The Chemical Engineering Journal, 2(4), 227-232. https://doi.org/10.1016/0300-9467(71)85001-3\n\nThe adaptive stepsize selection strategy is described in Villadsen \u0026 Michelsen (1978), Section 8.2.3, pages 314 - 317.\n\nThe error tolerance values `eps` (scalar) and `w` (vector) are used to keep the local error estimate of component `i` smaller than `(1 + abs(y(i)))*eps/w(i)`.\n\n\n## Contributing\n\nWe look forward to all types of contributions. If you would like to propose additional features or submit a bug report please open a new issue.\n\nFor students interested in CSE, here are some contribution ideas:\n- Support for banded or sparse Jacobian matrices\n- Use BLAS kernels for vector operations\n- Continuous (dense) output of variables\n- Extend `stiff3` to non-autonomous systems of ODE's\n- Advanced stepsize control settings\n- Write a tutorial on how to use `stiff3`","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan-pi%2Fstiff3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivan-pi%2Fstiff3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan-pi%2Fstiff3/lists"}