{"id":32175458,"url":"https://github.com/whalenpt/rkstiff","last_synced_at":"2026-02-22T14:43:43.126Z","repository":{"id":57462164,"uuid":"342700271","full_name":"whalenpt/rkstiff","owner":"whalenpt","description":"Runge-Kutta adaptive-step solvers for nonlinear PDEs. Solvers include both exponential time differencing and integrating factor methods.","archived":false,"fork":false,"pushed_at":"2025-11-12T06:15:02.000Z","size":4142,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-12T08:15:00.993Z","etag":null,"topics":["adaptive-stepsize","burgers-equation","exponential-time-differencing","hankel-tranform","integrating-factor","kdv","kuramoto-sivashinsky","nls","nonlinear-pde","partial-differential-equations","runge-kutta","sine-gordon","spectral-methods"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whalenpt.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-02-26T21:02:12.000Z","updated_at":"2025-11-03T06:02:23.000Z","dependencies_parsed_at":"2025-09-29T05:27:39.826Z","dependency_job_id":"314d7917-4b09-4c71-add0-7a275e9017e1","html_url":"https://github.com/whalenpt/rkstiff","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/whalenpt/rkstiff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whalenpt%2Frkstiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whalenpt%2Frkstiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whalenpt%2Frkstiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whalenpt%2Frkstiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whalenpt","download_url":"https://codeload.github.com/whalenpt/rkstiff/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whalenpt%2Frkstiff/sbom","scorecard":{"id":1238280,"data":{"date":"2025-08-25","repo":{"name":"github.com/whalenpt/rkstiff","commit":"d4547278fcb13cc2ef84cc03df1748f5904157b1"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":4.8,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/build.yml:9","Info: topLevel 'contents' permission set to 'read': .github/workflows/python-publish.yml:16","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/whalenpt/rkstiff/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/whalenpt/rkstiff/build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/whalenpt/rkstiff/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/whalenpt/rkstiff/python-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/whalenpt/rkstiff/python-publish.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:33","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:35","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:37","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:53","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:31","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:32","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   6 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}}]},"last_synced_at":"2025-09-29T05:34:15.512Z","repository_id":57462164,"created_at":"2025-09-29T05:34:15.524Z","updated_at":"2025-09-29T05:34:15.524Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29716358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T13:30:57.152Z","status":"ssl_error","status_checked_at":"2026-02-22T13:30:28.561Z","response_time":110,"last_error":"SSL_read: 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":["adaptive-stepsize","burgers-equation","exponential-time-differencing","hankel-tranform","integrating-factor","kdv","kuramoto-sivashinsky","nls","nonlinear-pde","partial-differential-equations","runge-kutta","sine-gordon","spectral-methods"],"created_at":"2025-10-21T19:38:55.946Z","updated_at":"2026-02-22T14:43:43.117Z","avatar_url":"https://github.com/whalenpt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI Version][pypi-image]][pypi-url]\n[![Build Status][build-image]][build-url]\n[![Code Coverage][coverage-image]][coverage-url]\n[![Docs Status][docs-image]][docs-url]\n\n\u003c!-- Badges --\u003e\n[pypi-image]: https://img.shields.io/pypi/v/rkstiff\n[pypi-url]: https://pypi.org/project/rkstiff/\n[build-image]: https://github.com/whalenpt/rkstiff/actions/workflows/build.yml/badge.svg\n[build-url]: https://github.com/whalenpt/rkstiff/actions/workflows/build.yml\n[coverage-image]: https://codecov.io/gh/whalenpt/rkstiff/branch/master/graph/badge.svg\n[coverage-url]: https://codecov.io/gh/whalenpt/rkstiff\n[docs-image]: https://readthedocs.org/projects/rkstiff/badge/?version=latest\n[docs-url]: https://rkstiff.readthedocs.io/en/latest\n\n# rkstiff\n\n\u003e **Exponential time–differencing (ETD)** and **integrating factor (IF)** Runge–Kutta solvers for stiff semi-linear PDEs:\n\u003e\n\u003e $u_t = L u + \\mathrm{NL}(u)$\n\u003e\n\u003e - Fast, adaptive, and pure Python (NumPy/SciPy only)\n\u003e - Embedded error control, logging, and flexible operator support\n\u003e - Designed for spectral methods and diagonalizable systems\n\u003e\n\u003e **Tested:** Python 3.9–3.13 | **Dependencies:** NumPy, SciPy | **Optional:** matplotlib, jupyter, pytest\n\u003e\n\u003e **Docs:** [rkstiff.readthedocs.io][docs-url]\n\n---\n\n## Features\n\n- **Adaptive ETD/IF Runge–Kutta solvers**: ETD35, ETD34, IF34, IF45DP (embedded error control)\n- **Fixed-step solvers**: ETD4, ETD5, IF4\n- **Operator flexibility**: Diagonal or full matrix (spectral/finite-difference)\n- **Spectral methods**: Fourier/Chebyshev support\n- **Configurable error control**: `SolverConfig` for tolerances, safety factors\n- **Logging**: Per-solver logging, adjustable verbosity\n- **Lightweight API**: Pass a linear operator array and a callable nonlinear function\n- **Utility modules**: Grids, spectral derivatives, transforms, models, logging helpers\n\nSupported equations: Nonlinear Schrödinger, Kuramoto–Sivashinsky, Korteweg–de Vries, Burgers, Allen–Cahn, Sine–Gordon\n\n---\n\n## Installation\n\n**pip (recommended):**\n```bash\npython -m pip install rkstiff\n````\n\n**conda-forge:**\n\n```bash\nconda create -n rkstiff-env -c conda-forge rkstiff\nconda activate rkstiff-env\n```\n\n**From source:**\n\n```bash\ngit clone https://github.com/whalenpt/rkstiff.git\ncd rkstiff\npython -m pip install .\n```\n\n**Extras:**\n\n```bash\n# demos: matplotlib + jupyter; tests: pytest\npython -m pip install \"rkstiff[demo]\"\npython -m pip install \"rkstiff[test]\"\n```\n\n---\n\n## Quickstart Example (Kuramoto–Sivashinsky)\n\n```python\nimport numpy as np\nfrom rkstiff import grids, if34\n\n# Real-valued grid for rfft\nn = 1024\na, b = 0.0, 32.0 * np.pi\nx, kx = grids.construct_x_kx_rfft(n, a, b)\n\n# Linear operator in Fourier space\nlin_op = kx**2 * (1 - kx**2)\n\n# Nonlinear term: -F{ u * u_x }\ndef nl_func(u_fft):\n    u = np.fft.irfft(u_fft)\n    ux = np.fft.irfft(1j * kx * u_fft)\n    return -np.fft.rfft(u * ux)\n\n# Initial condition in real space → Fourier space\nu0 = np.cos(x / 16) * (1.0 + np.sin(x / 16))\nu0_fft = np.fft.rfft(u0)\n\nsolver = if34.IF34(lin_op=lin_op, nl_func=nl_func)\nuf_fft = solver.evolve(u0_fft, t0=0.0, tf=50.0, store_freq=20)\n\n# Convert stored Fourier snapshots back to real space\nU = np.array([np.fft.irfft(s) for s in solver.u])  # shape: (num_snaps, n)\nt = np.array(solver.t)\n```\n\n\u003e `solver.u` and `solver.t` store snapshots every `store_freq` internal steps; `evolve` returns the final state.\n\n\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/whalenpt/rkstiff/master/images/KSfig.png\"\n       alt=\"Kuramoto–Sivashinsky chaotic propagation\"\n       width=\"400\"\u003e\n  \u003cbr\u003e\n  \u003cem\u003e Kuramoto–Sivashinsky chaotic field propagation using IF34.\u003c/em\u003e\n\u003c/p\u003e\n\n\u003e 💡 **More examples:**  \n\u003e Several fully runnable **Jupyter notebooks** are included in the `demos/` folder.  \n\u003e Each notebook illustrates solver usage, adaptive-step control, and visualization for different PDEs  \n\u003e (e.g., Kuramoto–Sivashinsky, NLS, and Allen–Cahn).  \n\u003e To try them:\n\u003e ```bash\n\u003e python -m pip install \"rkstiff[demo]\"\n\u003e jupyter notebook demos/\n\u003e ```\n\n---\n\n## API Overview\n\n### Solver Classes\n\n| Solver   | Module   | Order (embedded) | Adaptive | Notes                         |\n| -------- | -------- | ---------------- | -------- | ----------------------------- |\n| `ETD35`  | `etd35`  | 5 (3)            | ✅        | Best for diagonalized systems |\n| `ETD34`  | `etd34`  | 4 (3)            | ✅        | Krogstad 4th order            |\n| `IF34`   | `if34`   | 4 (3)            | ✅        | Integrating factor            |\n| `IF45DP` | `if45dp` | 5 (4)            | ✅        | Dormand–Prince IF             |\n| `ETD4`   | `etd4`   | 4 (–)            | ❌        | Krogstad fixed-step           |\n| `ETD5`   | `etd5`   | 5 (–)            | ❌        | Same base as ETD35            |\n| `IF4`    | `if4`    | 4 (–)            | ❌        | Fixed-step IF                 |\n\n### Constructor Signature (Adaptive Classes)\n\n```python\nSolver(lin_op: np.ndarray, nl_func: Callable[[np.ndarray], np.ndarray], config: SolverConfig = ..., loglevel: str = ...)\n```\n\n* `lin_op`: array shaped like `u`, typically diagonal entries in the working basis\n* `nl_func(u)`: returns nonlinear term in same basis\n* `config`: error control and adaptivity (optional; defaults to SolverConfig())\n* `loglevel`: logging verbosity (optional; defaults to \"INFO\")\n\n---\n\n## Configuration \u0026 Logging\n\n### Adaptive Error Control\n\nConfigure embedded error estimation and adaptive step control via `SolverConfig`:\n\n```python\nfrom rkstiff.if34 import IF34\nfrom rkstiff.solveras import SolverConfig\n\nconfig = SolverConfig(epsilon=1e-5, incr_f=1.2, decr_f=0.8, safety_f=0.9)\nsolver = IF34(lin_op, nl_func, config=config, loglevel=\"INFO\")\n```\n\n**Parameter notes (typical meanings):**\n\n* `epsilon`: target local error tolerance for the embedded pair.\n* `safety_f`: safety factor applied to proposed step-size updates.\n* `incr_f` / `decr_f`: bounds on how much `dt` may grow/shrink on accept/reject.\n* (Implementation-specific fields may exist; see docs for full list and defaults.)\n\n### Logging\n\nSet logging level per solver:\n\n```python\nsolver = IF34(lin_op, nl_func, loglevel=\"DEBUG\")\n```\n\n---\n\n## Utility Modules\n\n* `grids`: Grid and wavenumber construction for FFT/RFFT/Chebyshev\n* `derivatives`: Spectral differentiation (FFT, RFFT, Chebyshev)\n* `transforms`: Basis transforms\n* `models`: Example PDEs\n* `util.loghelper`: Logging setup and control\n\n---\n\n## Usage Tips\n\n* For **spectral methods**, pass `lin_op` in Fourier space and implement `nl_func` in that same space\n* For **diagonalizable systems**, pre-diagonalize once and reuse that basis\n* ETD methods may **precompute φ-functions**; reuse the solver instance for speed\n* Storage: `solver.u` and `solver.t` hold snapshots; control frequency with `store_freq`\n\n---\n\n## Testing \u0026 Coverage\n\nRun tests and view coverage:\n\n```bash\npython -m pip install \"rkstiff[test]\"\npytest\n```\n\n---\n\n## Citation\n\nIf you use `rkstiff` in academic work, please cite:\n\n\u003e P. Whalen, M. Brio, J.V. Moloney,\n\u003e *Exponential time-differencing with embedded Runge–Kutta adaptive step control*,\n\u003e *Journal of Computational Physics* 280 (2015) 579–601.\n\u003e DOI: [10.1016/j.jcp.2014.09.038](https://doi.org/10.1016/j.jcp.2014.09.038)\n\n```bibtex\n@article{WhalenBrioMoloney2015,\n  title   = {Exponential time-differencing with embedded Runge--Kutta adaptive step control},\n  author  = {Whalen, P. and Brio, M. and Moloney, J. V.},\n  journal = {Journal of Computational Physics},\n  volume  = {280},\n  pages   = {579--601},\n  year    = {2015},\n  doi     = {10.1016/j.jcp.2014.09.038}\n}\n```\n\n---\n\n## License\n\nMIT — see [LICENSE](https://github.com/whalenpt/rkstiff/blob/develop/LICENSE) for details.\n\n## Contact\n\nPatrick Whalen — [whalenpt@gmail.com](mailto:whalenpt@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhalenpt%2Frkstiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhalenpt%2Frkstiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhalenpt%2Frkstiff/lists"}