# SplitFVM
[![Downloads](https://pepy.tech/badge/splitfvm)](https://pepy.tech/project/splitfvm)
![img](https://github.com/gpavanb1/SplitFVM/blob/main/assets/logo.jpg)
1D [Finite-Volume](https://en.wikipedia.org/wiki/Finite_volume_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 splitfvm
```
There is an [examples](https://github.com/gpavanb1/SplitFVM/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 cell count
d = Domain.from_size(20, 2, ["u", "v", "w"]) # nx, ng, variables
# Set IC and BC
ics = {"u": "gaussian", "v": "rarefaction"}
bcs = {
"u": {
"left": "periodic",
"right": "periodic"
},
"v": {
"left": {"dirichlet": 3},
"right": {"dirichlet": 4}
},
"w": {
"left": {"dirichlet": 2},
"right": "periodic"
}
}
s = Simulation(d, m, ics, bcs)
# Advance in time or to steady state
s.evolve(dt=0.1)
bounds = [[-1., -2., 0.], [5., 4., 3.]]
iter = s.steady_state(split=True, split_loc=1, bounds=bounds)
# Visualize
draw(d, "label")
```
## Whom to contact?
Please direct your queries to [gpavanb1](http://github.com/gpavanb1)
for any questions.
## Acknowledgements
Do visit its [Finite-Difference](https://github.com/gpavanb1/SplitFDM) 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/SplitFVM",
"name": "SplitFVM",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "amr newton python finite-volume armijo optimization pseudotransient splitting",
"author": "gpavanb1",
"author_email": "gpavanb@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b6/15/5f464f730ab84c26ec53e834a3f184ffea0adff249d8b3fa0b67e7ebe7bd/SplitFVM-0.2.tar.gz",
"platform": null,
"description": "# SplitFVM\n\n[![Downloads](https://pepy.tech/badge/splitfvm)](https://pepy.tech/project/splitfvm)\n\n![img](https://github.com/gpavanb1/SplitFVM/blob/main/assets/logo.jpg)\n\n1D [Finite-Volume](https://en.wikipedia.org/wiki/Finite_volume_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 splitfvm\n```\n\nThere is an [examples](https://github.com/gpavanb1/SplitFVM/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 cell count\nd = Domain.from_size(20, 2, [\"u\", \"v\", \"w\"]) # nx, ng, variables\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 \"w\": {\n \"left\": {\"dirichlet\": 2},\n \"right\": \"periodic\"\n }\n}\ns = Simulation(d, m, ics, bcs)\n\n# Advance in time or to steady state\ns.evolve(dt=0.1)\nbounds = [[-1., -2., 0.], [5., 4., 3.]]\niter = s.steady_state(split=True, split_loc=1, bounds=bounds)\n\n# Visualize\ndraw(d, \"label\")\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-Difference](https://github.com/gpavanb1/SplitFDM) 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",
"bugtrack_url": null,
"license": "MIT",
"summary": "1D Finite-Volume Split Newton Solver",
"version": "0.2",
"project_urls": {
"Bug Reports": "https://github.com/gpavanb1/SplitFVM/issues",
"Homepage": "https://github.com/gpavanb1/SplitFVM",
"Source": "https://github.com/gpavanb1/SplitFVM/"
},
"split_keywords": [
"amr",
"newton",
"python",
"finite-volume",
"armijo",
"optimization",
"pseudotransient",
"splitting"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b6155f464f730ab84c26ec53e834a3f184ffea0adff249d8b3fa0b67e7ebe7bd",
"md5": "4fc11cb4621e0e9f4055513eba90d447",
"sha256": "cae5ced5a9743db10153ead46c500a3b3bd611b7bbd1d32dd8b9f72519341fce"
},
"downloads": -1,
"filename": "SplitFVM-0.2.tar.gz",
"has_sig": false,
"md5_digest": "4fc11cb4621e0e9f4055513eba90d447",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13974,
"upload_time": "2024-08-07T17:39:26",
"upload_time_iso_8601": "2024-08-07T17:39:26.261212Z",
"url": "https://files.pythonhosted.org/packages/b6/15/5f464f730ab84c26ec53e834a3f184ffea0adff249d8b3fa0b67e7ebe7bd/SplitFVM-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-07 17:39:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gpavanb1",
"github_project": "SplitFVM",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "black",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "numdifftools",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "SplitNewton",
"specs": []
}
],
"lcname": "splitfvm"
}