{"id":20196266,"url":"https://github.com/gpavanb1/splitfxm","last_synced_at":"2026-03-12T18:55:45.310Z","repository":{"id":255406283,"uuid":"849516486","full_name":"gpavanb1/SplitFXM","owner":"gpavanb1","description":"1D Finite-Difference/Volume with AMR and steady-state solver using Newton and Split-Newton with sparse Jacobian","archived":false,"fork":false,"pushed_at":"2025-05-12T13:29:44.000Z","size":3281,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T14:49:22.429Z","etag":null,"topics":["adaptive-mesh-refinement","finite-difference","finite-volume","newton","python","scientific-computing","splitting"],"latest_commit_sha":null,"homepage":"https://splitfxm.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gpavanb1.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2024-08-29T18:19:36.000Z","updated_at":"2025-04-30T19:23:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef46f18d-8060-493e-8b2d-a0548aae4b25","html_url":"https://github.com/gpavanb1/SplitFXM","commit_stats":null,"previous_names":["gpavanb1/splitfxm"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/gpavanb1/SplitFXM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitFXM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitFXM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitFXM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitFXM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gpavanb1","download_url":"https://codeload.github.com/gpavanb1/SplitFXM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitFXM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30438363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"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-mesh-refinement","finite-difference","finite-volume","newton","python","scientific-computing","splitting"],"created_at":"2024-11-14T04:22:58.972Z","updated_at":"2026-03-12T18:55:45.295Z","avatar_url":"https://github.com/gpavanb1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SplitFXM\n\n[![Downloads](https://pepy.tech/badge/splitfxm)](https://pepy.tech/project/splitfxm)\n![Coverage](https://img.shields.io/badge/coverage-99%25-brightgreen.svg)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14827049.svg)](https://doi.org/10.5281/zenodo.14827049)\n\n![img](https://github.com/gpavanb1/SplitFXM/blob/main/assets/logo.jpg)\n\n1D [Finite-Difference](https://en.wikipedia.org/wiki/Finite_difference_method) or [Finite-Volume](https://en.wikipedia.org/wiki/Finite_volume_method) using asymmetric stencils with [adaptive mesh refinement](https://en.wikipedia.org/wiki/Adaptive_mesh_refinement) and steady-state solver using Newton and [Split-Newton](https://github.com/gpavanb1/SplitNewton) approach\n\n## What does 'split' mean?\n\nThe system is divided into multiple segments, and for ease of communication, let’s refer to the first segment of variables as \"outer\" and the remaining as \"inner\".\n\n* Holding the outer variables fixed, Newton iteration is performed recursively for the inner variables, using the sub-Jacobian associated with them, until convergence is reached.\n\n* One Newton step is then performed for the outer variables, while the inner variables are kept fixed, using the sub-Jacobian for the outer subsystem.\n\n* This process is repeated, alternating between solving the inner and outer subsystems, until the convergence criterion for the entire system (similar to standard Newton) is met.\n\n### Example:\n\nConsider a system of 5 variables, with the split locations at indices [1, 4]. This results in the following segments:\n\n  * `a1` (variables from 0 to 1)\n  * `a2 a3 a4` (variables from 1 to 4)\n  * `a5` (variable at index 4)\n\n1. First, the innermost segment `a5` is solved recursively using Newton's method while holding the variables `a1` and `a2 a3 a4`) fixed. This step is repeated until the convergence criterion for `a5` is met.\n\n2. Next, one Newton step is taken for the segment `a2 a3 a4`, with `a5` held fixed. This step is followed by solving `a5` again till convergence.\n\n3. This alternating process repeats: solving for `a5` until convergence, then one step for `a2 a3 a4`, and so on, until all subsystems converge.\n\nFinally, one Newton step is performed for `a1`, with the other segments fixed. This completes one cycle of the split Newton process.\n\n## How to install and execute?\n\nJust run \n```\npip install splitfxm\n```\n\nThere is an [examples](https://github.com/gpavanb1/SplitFXM/tree/main/splitfxm/models) folder that contains a test model - [Advection-Diffusion](https://en.wikipedia.org/wiki/Convection%E2%80%93diffusion_equation)\n\nYou can define your own equations by simply creating a derived class from `Model` and adding to the `_equations` using existing or custom equations!\n\nA basic driver program is as follows\n```\nfrom splitfxm.domain import Domain\nfrom splitfxm.simulation import Simulation\nfrom splitfxm.models.advection_diffusion import AdvectionDiffusion\nfrom splitfxm.schemes import default_scheme\nfrom splitfxm.visualize import draw\nimport matplotlib.pyplot as plt\n\n# Define the problem\nmethod = 'FVM'\nm = AdvectionDiffusion(c=0.2, nu=0.001, method=method)\n# nx, nb_left, nb_right, variables\nd = Domain.from_size(20, 1, 1, [\"u\", \"v\", \"w\"])\nics = {\"u\": \"gaussian\", \"v\": \"rarefaction\", \"w\": \"tophat\"}\nbcs = {\n    \"u\": {\n        \"left\": \"periodic\",\n        \"right\": \"periodic\"\n    },\n    \"v\": {\n        \"left\": {\"dirichlet\": 3},\n        \"right\": {\"dirichlet\": 4}\n    },\n    \"w\": {\n        \"left\": {\"dirichlet\": 2},\n        \"right\": \"periodic\"\n    }\n}\ns = Simulation(d, m, ics, bcs, default_scheme(method))\n\n\n# Advance in time or to steady state\ns.evolve(t_diff=0.1)\nbounds = [[-1., -2., -2.], [5., 4., 3.]]\niter = s.steady_state(split=True, split_locs=[1, 2], bounds=bounds)\n\n# Visualize\ndraw(d, \"label\")\nplt.show()\n```\n\n## How to build from source?\n\nSince v0.4.0, SplitFXM utilizes Cython for accelerated computation. To build from source, you will need to install Cython and run the following command:\n```\npython setup.py build_ext --inplace\n```\n\n## Run benchmark\nThere is a benchmark that is included, which compares the time it takes to generate both a sparse and dense Jacobian. The results are as follows:\n\nFor N=250, \n\n| Method    | Time       | \n|-----------|------------|\n| Dense   |    45 seconds |\n| Sparse |  ~0.6 seconds  |\n\nThe benchmark can be executed from the parent folder using the command\n\n`python -m pytest -s benchmark`\n\n## How to run tests?\n\nTo run the tests, execute the following command from the parent folder:\n```\npython -m pytest tests\n```\n\nYou can use the `-s` flag to show `print` outputs of the tests\n\n## How to get coverage?\n\nTo get coverage, execute the following command from the parent folder:\n```\npython -m pytest --cov=splitfxm --cov-report \u003coption\u003e tests\n```\n\nThe `option` can be related to showing covered/missed lines or specifying the output format of the report. For example, to get a line-by-line report, use the following command:\n```\npython -m pytest --cov=splitfxm --cov-report term-missing tests\n```\n\n## Whom to contact?\n\nPlease direct your queries to [gpavanb1](http://github.com/gpavanb1)\nfor any questions.\n\nYou can also reach out to us on the [SplitFXM Google Group](https://groups.google.com/g/splitfxm)\n\n## Acknowledgements\n\nSpecial thanks to [Cantera](https://github.com/Cantera/cantera) and [WENO-Scalar](https://github.com/comp-physics/WENO-scalar) for serving as an inspiration for code architecture.\n\n\n## Citing\n\nIf you are using `SplitFXM` in any scientific work, please make sure to cite as follows\n```\n@software{pavan_b_govindaraju_2025_14827049,\n  author       = {Pavan B Govindaraju},\n  title        = {gpavanb1/SplitFXM: v0.5.0},\n  month        = feb,\n  year         = 2025,\n  publisher    = {Zenodo},\n  version      = {v0.5.0},\n  doi          = {10.5281/zenodo.14827049},\n  url          = {https://doi.org/10.5281/zenodo.14827049},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpavanb1%2Fsplitfxm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgpavanb1%2Fsplitfxm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpavanb1%2Fsplitfxm/lists"}