# SplitFDM
[![Downloads](https://pepy.tech/badge/splitfdm)](https://pepy.tech/project/splitfdm)
![img](https://github.com/gpavanb1/SplitFDM/blob/main/assets/logo.jpg)
1D [Finite-Difference](https://en.wikipedia.org/wiki/Finite_difference_method) 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
## What does 'split' mean?
The system is divided into two and for ease of communication, let's refer to first set of variables as "outer" and the second as "inner".
* Holding the outer variables fixed, Newton iteration is performed till convergence using the sub-Jacobian
* One Newton step is performed for the outer variables with inner held fixed (using its sub-Jacobian)
* This process is repeated till convergence criterion is met for the full system (same as in Newton)
## How to install and execute?
Just run
```
pip install splitfdm
```
There is an [examples](https://github.com/gpavanb1/SplitFDM/examples) folder that contains a test model - [Advection-Diffusion](https://en.wikipedia.org/wiki/Convection%E2%80%93diffusion_equation)
You can define your own equations by simply creating a derived class from `Model` and adding to the `_equations` using existing or custom equations!
A basic driver program is as follows
```
# Define the problem
m = AdvectionDiffusion(c=0.2, nu=0.001)
# Define the domain and variables
# ng stands for ghost point count
d = Domain.from_size(nx=20, ng=2, ["u", "v"])
# Set IC and BC
ics = {"u": "gaussian", "v": "rarefaction"}
bcs = {
"u": {
"left": "periodic",
"right": "periodic"
},
"v": {
"left": {"dirichlet": 3},
"right": {"dirichlet": 4}
}
}
s = Simulation(d, m, ics, bcs)
# Advance in time or to steady state
s.evolve(dt=0.1)
iter = s.steady_state()
# Visualize
draw(d)
```
## Whom to contact?
Please direct your queries to [gpavanb1](http://github.com/gpavanb1)
for any questions.
## Acknowledgements
Do visit its [Finite-Volume](https://github.com/gpavanb1/SplitFVM) cousin
Special 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/gpavanb1/SplitFDM",
"name": "SplitFDM",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "amr newton python finite-difference armijo optimization pseudotransient splitting",
"author": "gpavanb1",
"author_email": "gpavanb@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/43/d8/b696f4c5ca557f55266963f3b110c63d81b937a038a3e8b97010ae359d9a/SplitFDM-0.1.2.tar.gz",
"platform": null,
"description": "# SplitFDM\n\n[![Downloads](https://pepy.tech/badge/splitfdm)](https://pepy.tech/project/splitfdm)\n\n![img](https://github.com/gpavanb1/SplitFDM/blob/main/assets/logo.jpg)\n\n1D [Finite-Difference](https://en.wikipedia.org/wiki/Finite_difference_method) 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 two and for ease of communication, let's refer to first set of variables as \"outer\" and the second as \"inner\".\n\n* Holding the outer variables fixed, Newton iteration is performed till convergence using the sub-Jacobian\n\n* One Newton step is performed for the outer variables with inner held fixed (using its sub-Jacobian)\n\n* This process is repeated till convergence criterion is met for the full system (same as in Newton)\n\n## How to install and execute?\n\nJust run \n```\npip install splitfdm\n```\n\nThere is an [examples](https://github.com/gpavanb1/SplitFDM/examples) 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```\n# Define the problem\nm = AdvectionDiffusion(c=0.2, nu=0.001)\n\n# Define the domain and variables\n# ng stands for ghost point count\nd = Domain.from_size(nx=20, ng=2, [\"u\", \"v\"])\n\n# Set IC and BC\nics = {\"u\": \"gaussian\", \"v\": \"rarefaction\"}\nbcs = {\n \"u\": {\n \"left\": \"periodic\",\n \"right\": \"periodic\"\n },\n \"v\": {\n \"left\": {\"dirichlet\": 3},\n \"right\": {\"dirichlet\": 4}\n }\n}\ns = Simulation(d, m, ics, bcs)\n\n# Advance in time or to steady state\ns.evolve(dt=0.1)\niter = s.steady_state()\n\n# Visualize\ndraw(d)\n```\n\n## Whom to contact?\n\nPlease direct your queries to [gpavanb1](http://github.com/gpavanb1)\nfor any questions.\n\n## Acknowledgements\n\nDo visit its [Finite-Volume](https://github.com/gpavanb1/SplitFVM) cousin\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",
"bugtrack_url": null,
"license": "MIT",
"summary": "1D Finite-Difference Split Newton Solver",
"version": "0.1.2",
"project_urls": {
"Bug Reports": "https://github.com/gpavanb1/SplitFDM/issues",
"Homepage": "https://github.com/gpavanb1/SplitFDM",
"Source": "https://github.com/gpavanb1/SplitFDM/"
},
"split_keywords": [
"amr",
"newton",
"python",
"finite-difference",
"armijo",
"optimization",
"pseudotransient",
"splitting"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "34056d8b10ca07b9231a958a3dab2231e3bbdf1ea6821c70cbdfd70e541528a4",
"md5": "9a6f6067c29d1d0b81513e57c799a272",
"sha256": "d87c6f2590f7250d541d05d5deb1544f7e47ce1fb2ef78a507a02c80ea21c842"
},
"downloads": -1,
"filename": "SplitFDM-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9a6f6067c29d1d0b81513e57c799a272",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 17273,
"upload_time": "2024-04-28T05:52:40",
"upload_time_iso_8601": "2024-04-28T05:52:40.285844Z",
"url": "https://files.pythonhosted.org/packages/34/05/6d8b10ca07b9231a958a3dab2231e3bbdf1ea6821c70cbdfd70e541528a4/SplitFDM-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "43d8b696f4c5ca557f55266963f3b110c63d81b937a038a3e8b97010ae359d9a",
"md5": "3a79e7ad668e290fa9a8f8f1f152c59c",
"sha256": "5063d25ae59a3618b62288962690bfe2da4105246d8ddad5d41807a357c93098"
},
"downloads": -1,
"filename": "SplitFDM-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "3a79e7ad668e290fa9a8f8f1f152c59c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12812,
"upload_time": "2024-04-28T05:52:41",
"upload_time_iso_8601": "2024-04-28T05:52:41.622397Z",
"url": "https://files.pythonhosted.org/packages/43/d8/b696f4c5ca557f55266963f3b110c63d81b937a038a3e8b97010ae359d9a/SplitFDM-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-28 05:52:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gpavanb1",
"github_project": "SplitFDM",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "splitfdm"
}