{"id":15253653,"url":"https://github.com/gerlero/fronts","last_synced_at":"2025-04-11T14:32:47.390Z","repository":{"id":46208725,"uuid":"191976492","full_name":"gerlero/fronts","owner":"gerlero","description":"Numerical library for nonlinear diffusion problems in semi-infinite domains","archived":false,"fork":false,"pushed_at":"2024-12-30T07:48:13.000Z","size":992,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-04T22:47:19.616Z","etag":null,"topics":["boltzmann-transformation","capillarity","diffusion-equation","groundwater-flow-equation","microfluidics","moisture-diffusivity","nonlinear-equations","numerical-methods","richards-equation","scipy"],"latest_commit_sha":null,"homepage":"https://fronts.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gerlero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-14T16:41:37.000Z","updated_at":"2024-12-30T07:48:15.000Z","dependencies_parsed_at":"2023-10-11T14:37:44.228Z","dependency_job_id":"63530439-8310-4d27-9f3d-878f7ffa8e72","html_url":"https://github.com/gerlero/fronts","commit_stats":{"total_commits":200,"total_committers":1,"mean_commits":200.0,"dds":0.0,"last_synced_commit":"10a00927451ee895bcf3eab3542c7a45ead7a841"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerlero%2Ffronts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerlero%2Ffronts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerlero%2Ffronts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gerlero%2Ffronts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gerlero","download_url":"https://codeload.github.com/gerlero/fronts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248419704,"owners_count":21100233,"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":["boltzmann-transformation","capillarity","diffusion-equation","groundwater-flow-equation","microfluidics","moisture-diffusivity","nonlinear-equations","numerical-methods","richards-equation","scipy"],"created_at":"2024-09-29T22:00:36.337Z","updated_at":"2025-04-11T14:32:47.369Z","avatar_url":"https://github.com/gerlero.png","language":"Python","readme":"[\u003cimg alt=\"Fronts\" src=\"https://raw.githubusercontent.com/gerlero/fronts/main/resources/logo.png\" height=\"100\"\u003e](https://github.com/gerlero/fronts)\n\nFronts is a Python numerical library for nonlinear diffusion problems based on the Boltzmann transformation.\n\n```python\nPython 3.9.6 (default, Sep 26 2022, 11:37:49)\n\u003e\u003e\u003e import fronts\n\u003e\u003e\u003e θ = fronts.solve(D=\"exp(7*θ)/2\", i=0, b=1)  # i: initial value, b: boundary value\n\u003e\u003e\u003e θ(r=10, t=3) \n0.9169685387070694\n\u003e\u003e\u003e θ.d_dr(10,3)  # ∂θ/∂r\n-0.01108790437249313\n\u003e\u003e\u003e print(\"Welcome to the Fronts project page.\")\n```\n\n[![Documentation](https://img.shields.io/readthedocs/fronts)](https://fronts.readthedocs.io/)\n[![CI](https://github.com/gerlero/fronts/actions/workflows/ci.yml/badge.svg)](https://github.com/gerlero/fronts/actions/workflows/ci.yml)\n[![Code coverage](https://img.shields.io/codecov/c/gh/gerlero/fronts)](https://codecov.io/gh/gerlero/fronts)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)\n[![Publish](https://github.com/gerlero/fronts/actions/workflows/pypi-publish.yml/badge.svg)](https://github.com/gerlero/fronts/actions/workflows/pypi-publish.yml)\n[![PyPI](https://img.shields.io/pypi/v/fronts?color=%2300b0f0)](https://pypi.org/project/fronts/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fronts)](https://pypi.org/project/fronts/)\n[![Docker](https://github.com/gerlero/fronts/actions/workflows/docker.yml/badge.svg)](https://github.com/gerlero/fronts/actions/workflows/docker.yml)\n[![Docker image](https://img.shields.io/badge/docker%20image-microfluidica%2Ffronts-0085a0)](https://hub.docker.com/r/microfluidica/fronts)\n\n\n| ⚡️ Fronts is also available [as a Julia package](https://github.com/gerlero/Fronts.jl). We recommend using the Julia version, particularly where performance is important |\n| ---- |\n\n## Overview\n\nWith Fronts, you can effortlessly find solutions to many problems of nonlinear diffusion along a semi-infinite axis **r**, i.e.:\n\n$$\\frac{\\partial\\theta}{\\partial t} = \\nabla\\cdot\\left[D(\\theta)\\frac{\\partial\\theta}{\\partial r}\\mathbf{\\hat{r}}\\right]$$\n\nwhere _D_ is a known positive function and _θ_ is an unkown function of _r_ and _t_.\n\nFronts includes functionality to solve problems with a Dirichlet boundary condition (start with [``fronts.solve()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.solve.html)), as well as some radial problems with a fixed-flowrate boundary condition (with [``fronts.solve_flowrate()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.solve_flowrate.html)). In every case, _D_ can be any function defined by the user or obtained from the [``fronts.D``](https://fronts.readthedocs.io/en/stable) module. \n\nIt works by transforming the above nonlinear partial differential equation (PDE) into a more manageable (but still nonlinear) ordinary differential equation (ODE), using a technique known as the [Boltzmann transformation](https://en.wikipedia.org/wiki/Boltzmann–Matano_analysis), which it then solves with a combination of high-order numerical ODE integration (provided by the [SciPy library](https://scipy.org/scipylib/index.html)) and specialized logic.\n\nFor this class of problems, you will find that Fronts can be easier to use, faster, and more robust than the classical numerical PDE solvers you would otherwise have to use. Moreover, the solutions found by Fronts are such that their partial derivatives and flux fields are also available in continuous form. Finally, a considerable effort has been made to have Fronts \"just work\" in practice, with no adjustment of numerical parameters required (in fact, the functions mentioned so far do not even require a starting mesh).\n\nFronts can also help you solve the inverse problem of finding _D_ when _θ_ is given. Every feature of Fronts is covered in the [documentation](https://fronts.readthedocs.io), and the project includes many [example cases](https://github.com/gerlero/fronts/tree/main/examples) (though you may start with the Usage section below).\n\nFronts is open source and works great with the tools of the [SciPy ecosystem](https://www.scipy.org/about.html).\n\n\n## Why Fronts?\n\nProblems compatible with Fronts appear in many areas of physics. For instance, if we take _θ_ as the water content or saturation and _D_ as the moisture diffusivity, the above equation translates into what is known as the moisture diffusivity equation, which is a special case of the [Richards equation](https://en.wikipedia.org/wiki/Richards_equation) that describes capillary flow in porous media. For this application, Fronts even includes implementations of the commonly used models: [``fronts.D.brooks_and_corey()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.D.brooks_and_corey.html) and [``fronts.D.van_genuchten()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.D.van_genuchten.html).\n\nOf particular interest to the creators of Fronts is the fact that it can be used to model the configuration known as \"lateral flow\" in the field of paper-based microfluidics. The name \"Fronts\" is a reference to the wetting fronts that appear under these conditions, the study of which motivated the creation of this software.\n\nOther problems of this class appear in the study of the diffusion of solutions in polymer matrices as well as diffusion problems in solids (e.g. annealing problems in metallurgy). \n\nAs mentioned before, if your problem is supported, you can expect Fronts to be easier to use, faster, and more robust than other tools. Try it out!\n\n\n## Installation\n\nFronts currently runs on Python 3.7 and later.\n\nInstall Fronts with [pip](https://pip.pypa.io/en/stable/) by running this command in a terminal:\n\n```sh\npython3 -m pip install fronts\n```\n\nThis will download and install the [most recent version of Fronts available on PyPI](https://pypi.org/project/fronts/).\n\n##### Optional: Matplotlib\n\nRunning the bundled examples requires the visualization library [Matplotlib](https://matplotlib.org). This library is not installed automatically with Fronts, so if you don't already have it, you may want to install it manually by running:\n\n```sh\npython3 -m pip install matplotlib\n```\n\nOptionally, Fronts can be installed in a [virtual environment](https://docs.python.org/3.8/tutorial/venv.html), or the ```--user```  option can be added to the previous commands to install the packages for the current user only (which does not require system administrator privileges).\n\n\n## Usage\n\nLet's say we want to solve the following initial-boundary value problem:\n\n\u003e Find _c_ such that:\n\n$$\n\\begin{cases}\n\\dfrac{\\partial c}{\\partial t} = \\dfrac{\\partial}{\\partial r}\\left(c^4\\dfrac{\\partial c}{\\partial r}\\right) \u0026 r\u003e0,t\u003e0\\\\\nc(r,0)=0.1 \u0026 r\u003e0\\\\\nc(0,t)=1 \u0026 t\u003e0\\\\\n\\end{cases}\n$$\n\nWith Fronts, all it takes is a call to [``fronts.solve()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.solve.html). The function requires the diffusivity function ``D``, which we pass as an expression so that ``solve()`` can get the derivatives it needs by itself (alternatively, in this case we could also have used [``fronts.D.power_law()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.D.power_law.html#fronts.D.power_law.) to obtain `D`). Besides ``D``, we only need to pass the initial and boundary values as ``i`` and ``b``. The Python code is:\n\n```python\nimport fronts\nc = fronts.solve(D=\"c**4\", i=0.1, b=1)\n```\n\nThe call to ``solve()`` finishes within a fraction of a second. ``c`` is assigned a [``Solution``](https://fronts.readthedocs.io/en/stable/stubs/fronts.Solution.html) object, which can be called directly but also has some interesting methods such as [``d_dr()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.Solution.html#fronts.Solution.d_dr), [``d_dt()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.Solution.html#fronts.Solution.d_dt) and [``flux()``](https://fronts.readthedocs.io/en/stable/stubs/fronts.Solution.html#fronts.Solution.flux).\n\nWe can now plot the solution for arbitrary _r_ and _t_. For example, with _r_ between 0 and 10 and _t_=60:\n\n```python\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nr = np.linspace(0, 10, 200)\nplt.plot(r, c(r, t=60))\nplt.xlabel(\"r\")\nplt.ylabel(\"c\")\nplt.show()\n```\n\nThe plot looks like this:\n\n\u003cimg alt=\"c plot\" src=\"https://raw.githubusercontent.com/gerlero/fronts/main/resources/powerlaw_c.png\" height=400\u003e\n\nFinally, let us plot the flux at _t_=60:\n\n```python\nplt.plot(r, c.flux(r, t=60))\nplt.xlabel(\"r\")\nplt.ylabel(\"flux\")\nplt.show()\n```\n\n\u003cimg alt=\"flux plot\" src=\"https://raw.githubusercontent.com/gerlero/fronts/main/resources/powerlaw_flux.png\" height=400\u003e\n\n\n## Project links\n\n* [**Documentation**](https://fronts.readthedocs.io)\n* [**Examples**](https://github.com/gerlero/fronts/tree/main/examples)\n* [**Changelog**](https://github.com/gerlero/fronts/blob/main/CHANGELOG.md)\n* [**_Capillarity_ paper**](https://dx.doi.org/10.46690/capi.2023.02.02)\n\n\n## Authors\n\n* **Gabriel S. Gerlero** [@gerlero](https://github.com/gerlero)\n* **Pablo A. Kler** [@pabloakler](https://github.com/pabloakler)\n* **Claudio L. A. Berli**\n\nFronts was conceived and is developed by members of the [Santa Fe Microfluidics Group (GSaM)](https://microfluidica.ar) at the [Research Center for Computational Methods (CIMEC, UNL-CONICET)](https://cimec.conicet.gov.ar) and the [Institute of Technological Development for the Chemical Industry (INTEC, UNL-CONICET)](https://intec.conicet.gov.ar) in Santa Fe, Argentina.\n\n[\u003cimg alt=\"CIMEC (UNL-CONICET)\" src=\"https://raw.githubusercontent.com/gerlero/fronts/main/resources/CIMEC.png\" height=70\u003e](https://cimec.conicet.gov.ar) \u0026nbsp; [\u003cimg alt=\"INTEC (UNL-CONICET)\" src=\"https://raw.githubusercontent.com/gerlero/fronts/main/resources/INTEC.png\" height=70\u003e](https://intec.conicet.gov.ar) \u0026nbsp; [\u003cimg alt=\"GSaM\" src=\"https://raw.githubusercontent.com/gerlero/fronts/main/resources/GSaMLogo.png\" height=60\u003e](https://microfluidica.ar)\n\n\n## License\n\nFronts is open-source software available under the BSD 3-clause license.\n\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerlero%2Ffronts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgerlero%2Ffronts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgerlero%2Ffronts/lists"}