{ "info": { "author": "N. Cellier", "author_email": "contact@nicolas-cellier.net", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Scikit-fdiff / skfdiff (formerly Triflow)\n\nThe full documentation is available on [read the doc.](https://scikit-fdiff.readthedocs.io/en/latest/)\n\n| master | dev |\n| :------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: |\n| [![pipeline status](https://gitlab.com/celliern/scikit-fdiff/badges/master/pipeline.svg)](https://gitlab.com/celliern/scikit-fdiff/commits/master) | [![pipeline status](https://gitlab.com/celliern/scikit-fdiff/badges/dev/pipeline.svg)](https://gitlab.com/celliern/scikit-fdiff/commits/dev) |\n\n- [Scikit-fdiff / skfdiff (formerly Triflow)](#scikit-fdiff--skfdiff-formerly-triflow)\n - [Installation](#installation)\n - [External requirements](#external-requirements)\n - [via PyPI](#via-pypi)\n - [via github](#via-github)\n - [Introduction](#introduction)\n - [Rational](#rational)\n - [Model writing](#model-writing)\n - [Toy examples (more ambitious one are in the doc)](#toy-examples-more-ambitious-one-are-in-the-doc)\n - [1D advection / diffusion system, Dirichlet boundary](#1d-advection--diffusion-system-dirichlet-boundary)\n - [2D advection / diffusion system, mixed robin / periodic boundary](#2d-advection--diffusion-system-mixed-robin--periodic-boundary)\n - [Contributing](#contributing)\n - [Code of Conduct](#code-of-conduct)\n\n## Installation\n\n### External requirements\n\nThis library is written for python >= 3.6.\n\nOn v0.6.0, it is possible to choose between numpy and numba\n(which provide similar features). numpy will be slower but with\nno compilation time, which is handy for testing and prototyping.\nOn other hand, numba use a JIT compilation, and give access to\nfaster and parallized routines in the cost of an extra dependency\nand a warm-up time.\n\n### via PyPI\n\n```bash\npip install skfdiff[numba,interactive]\n```\n\nwill install the package and\n\n```bash\npip install skfdiff --upgrade\n```\n\nwill update an old version of the library.\n\n### via github\n\nYou can install the latest version of the library\nusing pip and the github repository:\n\n```bash\npip install git+git://github.com/locie/skfdiff.git\n```\n\n## Introduction\n\n### Rational\n\nThe aim of this library is to have a (relatively) easy way to write\ntransient dynamic systems finite difference discretization, with\nfast temporal solvers.\n\nThe main two parts of the library are:\n\n- symbolic tools defining the spatial discretization, with boundary\n taking into account in a separated part\n- a fast temporal solver written in order to use the sparsity of the\n finite difference method to reduce the memory and CPU usage during\n the solving\n\nMoreover, extra tools are provided and the library is written in a\nmodular way, allowing an easy extension of these different parts (see\nthe plug-in module of the library.)\n\nThe library fits well with an interactive usage (in a jupyter notebook).\nThe dependency list is actually larger, but on-going work target a\nreduction of the stack complexity.\n\n## Model writing\n\nAll the models are written as function generating the F\nvector and the Jacobian matrix of the model defined as ``dtU = F(U)``.\n\nThe symbolic model is written as a simple mathematic equation. For\nexample, a diffusion advection model can be written as:\n\n```python\nfrom skfdiff import Model\n\nequation_diff = \"k * dxxU - c * dxU\"\ndependent_var = \"U\"\nphysical_parameters = [\"k\", \"c\"]\n\nmodel = Model(equation_diff, dependent_var,\n physical_parameters)\n```\n\n### Toy examples (more ambitious one are in the doc)\n\n#### 1D advection / diffusion system, Dirichlet boundary\n\n```python\n>>> import pylab as pl\n>>> import numpy as np\n>>> from skfdiff import Model, Simulation\n\n>>> model = Model(\"k * dxxU - c * dxU\",\n... \"U(x)\", [\"k\", \"c\"],\n... boundary_conditions={(\"U\", \"x\"): (\"dirichlet\", \"dirichlet\")}\n... )\n\n>>> x, dx = np.linspace(0, 1, 200, retstep=True)\n>>> U = np.cos(2 * np.pi * x * 5)\n\n# The fields are ``xarray.Dataset`` objects, and all the\n# tools / methods available in the ``xarray`` lib can be\n# applied to the skfdiff.Fields.\n>>> fields = model.Fields(x=x, U=U, k=0.001, c=0.3)\n\n# fix the boundary values for the dirichlet condition\n>>> fields[\"U\"][0] = 1\n>>> fields[\"U\"][-1] = 0\n\n>>> t = 0\n>>> dt = 5E-1\n>>> tmax = 2.5\n\n>>> simul = Simulation(model, fields, dt, tmax=tmax)\n\n# The containers are in-memory or persistant\n# xarray Dataset with all or some time-steps available.\n>>> container = simul.attach_container()\n>>> simul.run()\n(2.5, \n Dimensions: (x: 200)\n Coordinates:\n * x (x) float64 0.0 ... 1.0\n Data variables:\n U (x) float64 ...\n k float64 0.001\n c float64 0.3)\n\n>>> for t in container.data.t:\n... fig = pl.figure()\n... plot = container.data[\"U\"].sel(t=t).plot()\n\n```\n\n#### 2D advection / diffusion system, mixed robin / periodic boundary\n\n```python\n>>> import pylab as pl\n>>> import numpy as np\n>>> from skfdiff import Model, Simulation\n\n# some specialized scheme as the upwind scheme as been implemented.\n# as the problem as a strong advective component, we can use it\n# to reduce the numerical instabilities.\n# the dirichlet condition mean that the boundary will stay fix,\n# keeping the initial value.\n>>> model = Model(\"k * (dxxU + dyyU) - (upwind(cx, U, x, 2) + upwind(cy, U, y, 2))\",\n... \"U(x, y)\", [\"k\", \"cx\", \"cy\"],\n... boundary_conditions={(\"U\", \"x\"): (\"dxU - (U - sin(y) * cos(t))\", \"dxU - 5\"),\n... (\"U\", \"y\"): \"periodic\"})\n\n>>> x = np.linspace(0, 10, 56)\n>>> y = np.linspace(-np.pi, np.pi, 32)\n\n>>> U = np.zeros((x.size, y.size))\n>>> fields = model.Fields(x=x, y=y, U=U, k=0.001, cx=0.8, cy=0.3)\n\n>>> dt = 1.\n>>> tmax = 15.\n\n>>> simul = Simulation(model, fields, dt, tmax=tmax, tol=5E-1)\n>>> container = simul.attach_container()\n\n>>> simul.run()\n(15.0, \n Dimensions: (x: 56, y: 32)\n Coordinates:\n * x (x) float64 0.0 ... 10.0\n * y (y) float64 -3.142 ... 3.142\n Data variables:\n U (x, y) float64 ...\n k float64 0.001\n cx float64 0.8\n cy float64 0.3)\n\n>>> for t in np.linspace(0, tmax, 5):\n... fig = pl.figure()\n... plot = container.data[\"U\"].sel(t=t, method=\"nearest\").plot()\n\n```\n\n### Contributing\n\nSee [the contribute section of the doc](https://scikit-fdiff.readthedocs.io/en/latest/contribute.html).\n\n### Code of Conduct\n\nSee [the dedicated page](COC.md).", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/celliern/scikit-fdiff/", "keywords": "PDE,finite-difference,physic,modelling,interactive", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "skfdiff", "package_url": "https://pypi.org/project/skfdiff/", "platform": "", "project_url": "https://pypi.org/project/skfdiff/", "project_urls": { "Homepage": "https://gitlab.com/celliern/scikit-fdiff/" }, "release_url": "https://pypi.org/project/skfdiff/0.6.0/", "requires_dist": null, "requires_python": ">= 3.6", "summary": "Automatic finite difference discretization for 1D PDE with fast temporal solvers.", "version": "0.6.0" }, "last_serial": 5323206, "releases": { "0.6.0": [ { "comment_text": "", "digests": { "md5": "fee3df1270af4f6bc24afaaf35a38ddf", "sha256": "377c4278fa675740a2e87905738ba0bfd4cba606a7bd73be946efe14022182e2" }, "downloads": -1, "filename": "skfdiff-0.6.0.tar.gz", "has_sig": false, "md5_digest": "fee3df1270af4f6bc24afaaf35a38ddf", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.6", "size": 59220, "upload_time": "2019-05-27T17:26:54", "url": "https://files.pythonhosted.org/packages/36/88/b8e87bbe581170a5e61118cd2efe76804ecef4521b386e1a6658595fa005/skfdiff-0.6.0.tar.gz" } ], "0.6.0a2": [ { "comment_text": "", "digests": { "md5": "60cebad3435751e0cab9da79f62dee2a", "sha256": "d18439dd50e27def93e4821de78e8c54dffdcfc4cb4e764871f2a49de12c0c1e" }, "downloads": -1, "filename": "skfdiff-0.6.0a2.tar.gz", "has_sig": false, "md5_digest": "60cebad3435751e0cab9da79f62dee2a", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.5", "size": 42718, "upload_time": "2019-02-07T10:58:26", "url": "https://files.pythonhosted.org/packages/0e/1e/fb8331d44e409be58d8287de421582bc77d76e991ba98f8792f0775b0cfa/skfdiff-0.6.0a2.tar.gz" } ], "0.6.0a3": [ { "comment_text": "", "digests": { "md5": "b4859becd367f3efdc78315d3f14b4e9", "sha256": "05b96ef56109885b182e449cc8a7723439deceb3012df93f806870db939d2b04" }, "downloads": -1, "filename": "skfdiff-0.6.0a3.tar.gz", "has_sig": false, "md5_digest": "b4859becd367f3efdc78315d3f14b4e9", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.5", "size": 58121, "upload_time": "2019-02-07T13:46:17", "url": "https://files.pythonhosted.org/packages/79/c7/79d510132323ea7da4e4a71e36599ba9e0905c1d84ead7d2092248288ec0/skfdiff-0.6.0a3.tar.gz" } ], "0.6.0rc1": [ { "comment_text": "", "digests": { "md5": "93ea514b65a7c37796baa21aff464787", "sha256": "6375d21294d67836cd6051c5865c560c2ef5f36be6456b5885bb9b4867db9255" }, "downloads": -1, "filename": "skfdiff-0.6.0rc1.tar.gz", "has_sig": false, "md5_digest": "93ea514b65a7c37796baa21aff464787", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.6", "size": 61170, "upload_time": "2019-03-18T22:16:55", "url": "https://files.pythonhosted.org/packages/3a/1a/082e364f0d5b0a8254b0432b0cd395d0ac34e7eb861d9f06756ed894efa5/skfdiff-0.6.0rc1.tar.gz" } ], "0.6.0rc2": [ { "comment_text": "", "digests": { "md5": "a6ff172b3a9050256a84559ea0b2f246", "sha256": "3b989fc0d6de02ce24b256cdaadb937ff48272612a24db1ba8df3ad428a15989" }, "downloads": -1, "filename": "skfdiff-0.6.0rc2.tar.gz", "has_sig": false, "md5_digest": "a6ff172b3a9050256a84559ea0b2f246", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.6", "size": 59177, "upload_time": "2019-05-09T09:49:50", "url": "https://files.pythonhosted.org/packages/be/64/69500a82dfa4b32c996cadd0174f8f6ccaee271d0f4d26579ab96c4e62f8/skfdiff-0.6.0rc2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fee3df1270af4f6bc24afaaf35a38ddf", "sha256": "377c4278fa675740a2e87905738ba0bfd4cba606a7bd73be946efe14022182e2" }, "downloads": -1, "filename": "skfdiff-0.6.0.tar.gz", "has_sig": false, "md5_digest": "fee3df1270af4f6bc24afaaf35a38ddf", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3.6", "size": 59220, "upload_time": "2019-05-27T17:26:54", "url": "https://files.pythonhosted.org/packages/36/88/b8e87bbe581170a5e61118cd2efe76804ecef4521b386e1a6658595fa005/skfdiff-0.6.0.tar.gz" } ] }