fastvpinns


Namefastvpinns JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryA fast tensor-driven variational physics-informed neural network library for solving PDEs.
upload_time2024-07-29 19:09:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords pde neural networks physics ai machine learning variational pinns vpinns pinns physics-informed neural networks
VCS
bugtrack_url
requirements numpy pandas matplotlib tensorflow pytest meshio pyDOE tqdm scipy gmsh pyyaml rich black pre-commit
Travis-CI No Travis.
coveralls test coverage
            
[![Unit tests](https://github.com/cmgcds/fastvpinns/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/cmgcds/fastvpinns/actions/workflows/unit-tests.yml)
[![Integration tests](https://github.com/cmgcds/fastvpinns/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/cmgcds/fastvpinns/actions/workflows/integration-tests.yml)
[![Compatability check](https://github.com/cmgcds/fastvpinns/actions/workflows/compatibility-tests.yml/badge.svg)](https://github.com/cmgcds/fastvpinns/actions/workflows/compatibility-tests.yml)
[![codecov](https://codecov.io/gh/cmgcds/fastvpinns/graph/badge.svg?token=NI9G37R2Q7)](https://codecov.io/gh/cmgcds/fastvpinns)
[![PyPI](https://badge.fury.io/py/fastvpinns.svg)](https://badge.fury.io/py/fastvpinns)

[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
![Python Versions](https://img.shields.io/badge/python-3.8%20|%203.9%20|%203.10%20|%203.11-blue)
[![status](https://joss.theoj.org/papers/173453d08813f66a718f583502351747/status.svg)](https://joss.theoj.org/papers/173453d08813f66a718f583502351747)


<br />
<div align="center">
  <a href="https://github.com/cmgcds/fastvpinns">
    <img alt="FastVPINNs logo" src="https://raw.githubusercontent.com/cmgcds/fastvpinns/main/Fastvpinns_logo.png" width="500">
  </a>

<h3 align="center">Tensor-driven accelerated framework for hp-variational pinns</h3>

  <p align="center">
    <br />
    <a href="https://cmgcds.github.io/fastvpinns"><strong>Link to Documentation 📚</strong></a>
    <br />

  </p>
</div>

A robust tensor-based deep learning framework for solving partial differential equations using hp-Variational Physics-Informed Neural Networks (hp-VPINNs). The framework is based on the methodology presented in the [FastVPINNs Paper](https://arxiv.org/abs/2404.12063).


*This library is a highly optimised version of the the initial implementation of hp-VPINNs by [Kharazmi et al.](https://github.com/ehsankharazmi/hp-VPINNs). Refer the [hp-VPINNs Paper](https://arxiv.org/abs/2003.05385).*

## Authors 👨‍💻
---

[Thivin Anandh](https://github.com/thivinanandh), [Divij Ghose](https://divijghose.github.io/), [Sashikumaar Ganesan](https://cds.iisc.ac.in/faculty/sashi)

STARS Lab, Department of Computational and Data Sciences, Indian Institute of Science, Bangalore, India

## Installation 🛠️
---

The build of the code is currently tested on Python versions (3.8, 3.9, 3.10, 3.11), on OS Ubuntu 20.04 and Ubuntu 22.04, MacOS-latest and Windows-latest (refer compatibility build [Compatability check](https://github.com/cmgcds/fastvpinns/actions/workflows/compatibility-tests.yml)).

You can install the package using pip as follows:

```bash
pip install fastvpinns
```

 On ubuntu systems with libGL issues caused due to matplotlib or gmsh, please run the following command to install the required dependencies:
```bash
sudo apt-get install -y libglu1-mesa 
```

For more information on the installation process, please refer to our documentation [here](https://cmgcds.github.io/fastvpinns/).

## Citing 📜
---

If you use this code in your research, please consider citing the following paper:

```bibtex
@misc{anandh2024fastvpinns,
      title={FastVPINNs: Tensor-Driven Acceleration
             of VPINNs for Complex Geometries}, 
      author={Thivin Anandh, Divij Ghose, Himanshu Jain
               and Sashikumaar Ganesan},
      year={2024},
      eprint={2404.12063},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}
```

## Usage 🚀
---

For detailed usage, please refer to our documentation [here](https://cmgcds.github.io/fastvpinns/).

The package provides a simple API to train and solve PDE using VPINNs. The following code snippet demonstrates how to train a hp-VPINN model for the 2D Poisson equation for a structured grid. We could observe that we can solve a PDE using fastvpinns using 15 lines of code.

```python
#load the geometry 
domain = Geometry_2D("quadrilateral", "internal", 100, 100, "./")
cells, boundary_points = domain.generate_quad_mesh_internal(x_limits=[0, 1],y_limits=[0, 1],n_cells_x=4, n_cells_y=4, num_boundary_points=400)

# load the FEspace
fespace = Fespace2D(domain.mesh,cells,boundary_points,domain.mesh_type,fe_order=5,fe_type="jacobi",quad_order=5,quad_type="legendre", fe_transformation_type="bilinear",bound_function_dict=bound_function_dict,bound_condition_dict=bound_condition_dict,
forcing_function=rhs,output_path=i_output_path,generate_mesh_plot=True)

# Instantiate Data handler 
datahandler = DataHandler2D(fespace, domain, dtype=tf.float32)

# Instantiate the model with the loss function for the model 
model = DenseModel(layer_dims=[2, 30, 30, 30, 1],learning_rate_dict=0.01,params_dict=params_dict,
        loss_function=pde_loss_poisson,  ## Loss function of poisson2D
        input_tensors_list=[in_tensor, dir_in, dir_out],
        orig_factor_matrices=[datahandler.shape_val_mat_list,datahandler.grad_x_mat_list, datahandler.grad_y_mat_list],
        force_function_list=datahandler.forcing_function_list, tensor_dtype=tf.float32,
        use_attention=i_use_attention, ## Archived (not in use)
        activation=i_activation,
        hessian=False)

# Train the model
for epoch in range(1000):
    model.train_step()
```

Note : Supporting functions which define the actual solution and boundary conditions have to be passed to the main code.

## Contributing 🤝
---
This code is currently maintained by the authors as mentioned in the section above. We welcome contributions from the community. Please refer to the [documentation](https://cmgcds.github.io/fastvpinns/) for guidelines on contributing to the project.

## License 📑
---

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fastvpinns",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "PDE, Neural Networks, Physics, AI, Machine Learning, variational PINNs, VPINNs, PINNs, Physics-informed neural networks",
    "author": null,
    "author_email": "Thivin Anandh <thivinanandh@gmail.com>, Divij Ghose <divijghose@gmail.com>, Sashikumaar Ganesan <sashi@iisc.ac.in>",
    "download_url": "https://files.pythonhosted.org/packages/65/43/59d8bf28cc6066dbdb3f87e628e072ec32b2740d2e0f38d1efa5812b2195/fastvpinns-1.0.2.tar.gz",
    "platform": null,
    "description": "\n[![Unit tests](https://github.com/cmgcds/fastvpinns/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/cmgcds/fastvpinns/actions/workflows/unit-tests.yml)\n[![Integration tests](https://github.com/cmgcds/fastvpinns/actions/workflows/integration-tests.yml/badge.svg)](https://github.com/cmgcds/fastvpinns/actions/workflows/integration-tests.yml)\n[![Compatability check](https://github.com/cmgcds/fastvpinns/actions/workflows/compatibility-tests.yml/badge.svg)](https://github.com/cmgcds/fastvpinns/actions/workflows/compatibility-tests.yml)\n[![codecov](https://codecov.io/gh/cmgcds/fastvpinns/graph/badge.svg?token=NI9G37R2Q7)](https://codecov.io/gh/cmgcds/fastvpinns)\n[![PyPI](https://badge.fury.io/py/fastvpinns.svg)](https://badge.fury.io/py/fastvpinns)\n\n[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n![Python Versions](https://img.shields.io/badge/python-3.8%20|%203.9%20|%203.10%20|%203.11-blue)\n[![status](https://joss.theoj.org/papers/173453d08813f66a718f583502351747/status.svg)](https://joss.theoj.org/papers/173453d08813f66a718f583502351747)\n\n\n<br />\n<div align=\"center\">\n  <a href=\"https://github.com/cmgcds/fastvpinns\">\n    <img alt=\"FastVPINNs logo\" src=\"https://raw.githubusercontent.com/cmgcds/fastvpinns/main/Fastvpinns_logo.png\" width=\"500\">\n  </a>\n\n<h3 align=\"center\">Tensor-driven accelerated framework for hp-variational pinns</h3>\n\n  <p align=\"center\">\n    <br />\n    <a href=\"https://cmgcds.github.io/fastvpinns\"><strong>Link to Documentation \ud83d\udcda</strong></a>\n    <br />\n\n  </p>\n</div>\n\nA robust tensor-based deep learning framework for solving partial differential equations using hp-Variational Physics-Informed Neural Networks (hp-VPINNs). The framework is based on the methodology presented in the [FastVPINNs Paper](https://arxiv.org/abs/2404.12063).\n\n\n*This library is a highly optimised version of the the initial implementation of hp-VPINNs by [Kharazmi et al.](https://github.com/ehsankharazmi/hp-VPINNs). Refer the [hp-VPINNs Paper](https://arxiv.org/abs/2003.05385).*\n\n## Authors \ud83d\udc68\u200d\ud83d\udcbb\n---\n\n[Thivin Anandh](https://github.com/thivinanandh), [Divij Ghose](https://divijghose.github.io/), [Sashikumaar Ganesan](https://cds.iisc.ac.in/faculty/sashi)\n\nSTARS Lab, Department of Computational and Data Sciences, Indian Institute of Science, Bangalore, India\n\n## Installation \ud83d\udee0\ufe0f\n---\n\nThe build of the code is currently tested on Python versions (3.8, 3.9, 3.10, 3.11), on OS Ubuntu 20.04 and Ubuntu 22.04, MacOS-latest and Windows-latest (refer compatibility build [Compatability check](https://github.com/cmgcds/fastvpinns/actions/workflows/compatibility-tests.yml)).\n\nYou can install the package using pip as follows:\n\n```bash\npip install fastvpinns\n```\n\n On ubuntu systems with libGL issues caused due to matplotlib or gmsh, please run the following command to install the required dependencies:\n```bash\nsudo apt-get install -y libglu1-mesa \n```\n\nFor more information on the installation process, please refer to our documentation [here](https://cmgcds.github.io/fastvpinns/).\n\n## Citing \ud83d\udcdc\n---\n\nIf you use this code in your research, please consider citing the following paper:\n\n```bibtex\n@misc{anandh2024fastvpinns,\n      title={FastVPINNs: Tensor-Driven Acceleration\n             of VPINNs for Complex Geometries}, \n      author={Thivin Anandh, Divij Ghose, Himanshu Jain\n               and Sashikumaar Ganesan},\n      year={2024},\n      eprint={2404.12063},\n      archivePrefix={arXiv},\n      primaryClass={cs.LG}\n}\n```\n\n## Usage \ud83d\ude80\n---\n\nFor detailed usage, please refer to our documentation [here](https://cmgcds.github.io/fastvpinns/).\n\nThe package provides a simple API to train and solve PDE using VPINNs. The following code snippet demonstrates how to train a hp-VPINN model for the 2D Poisson equation for a structured grid. We could observe that we can solve a PDE using fastvpinns using 15 lines of code.\n\n```python\n#load the geometry \ndomain = Geometry_2D(\"quadrilateral\", \"internal\", 100, 100, \"./\")\ncells, boundary_points = domain.generate_quad_mesh_internal(x_limits=[0, 1],y_limits=[0, 1],n_cells_x=4, n_cells_y=4, num_boundary_points=400)\n\n# load the FEspace\nfespace = Fespace2D(domain.mesh,cells,boundary_points,domain.mesh_type,fe_order=5,fe_type=\"jacobi\",quad_order=5,quad_type=\"legendre\", fe_transformation_type=\"bilinear\",bound_function_dict=bound_function_dict,bound_condition_dict=bound_condition_dict,\nforcing_function=rhs,output_path=i_output_path,generate_mesh_plot=True)\n\n# Instantiate Data handler \ndatahandler = DataHandler2D(fespace, domain, dtype=tf.float32)\n\n# Instantiate the model with the loss function for the model \nmodel = DenseModel(layer_dims=[2, 30, 30, 30, 1],learning_rate_dict=0.01,params_dict=params_dict,\n        loss_function=pde_loss_poisson,  ## Loss function of poisson2D\n        input_tensors_list=[in_tensor, dir_in, dir_out],\n        orig_factor_matrices=[datahandler.shape_val_mat_list,datahandler.grad_x_mat_list, datahandler.grad_y_mat_list],\n        force_function_list=datahandler.forcing_function_list, tensor_dtype=tf.float32,\n        use_attention=i_use_attention, ## Archived (not in use)\n        activation=i_activation,\n        hessian=False)\n\n# Train the model\nfor epoch in range(1000):\n    model.train_step()\n```\n\nNote : Supporting functions which define the actual solution and boundary conditions have to be passed to the main code.\n\n## Contributing \ud83e\udd1d\n---\nThis code is currently maintained by the authors as mentioned in the section above. We welcome contributions from the community. Please refer to the [documentation](https://cmgcds.github.io/fastvpinns/) for guidelines on contributing to the project.\n\n## License \ud83d\udcd1\n---\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A fast tensor-driven variational physics-informed neural network library for solving PDEs.",
    "version": "1.0.2",
    "project_urls": {
        "Documentation": "https://cmgcds.github.io/fastvpinns/",
        "Homepage": "https://github.com/cmgcds/fastvpinns",
        "Issues": "https://github.com/cmgcds/fastvpinns/issues",
        "logo": "https://raw.githubusercontent.com/cmgcds/fastvpinns/main/Fastvpinns_logo.png"
    },
    "split_keywords": [
        "pde",
        " neural networks",
        " physics",
        " ai",
        " machine learning",
        " variational pinns",
        " vpinns",
        " pinns",
        " physics-informed neural networks"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ff7c47b5b315e62a42e9897e42e7f93963be08f20ec93d0f73495bd240cd822",
                "md5": "ccdceccf043c92c1ca2ab2255453b682",
                "sha256": "670d0862d88348a8752c6126738fb9817c800ae4316f5e9ab9ce973fa590f3ca"
            },
            "downloads": -1,
            "filename": "fastvpinns-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ccdceccf043c92c1ca2ab2255453b682",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 67791,
            "upload_time": "2024-07-29T19:09:23",
            "upload_time_iso_8601": "2024-07-29T19:09:23.140824Z",
            "url": "https://files.pythonhosted.org/packages/7f/f7/c47b5b315e62a42e9897e42e7f93963be08f20ec93d0f73495bd240cd822/fastvpinns-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "654359d8bf28cc6066dbdb3f87e628e072ec32b2740d2e0f38d1efa5812b2195",
                "md5": "17248a0b574ac04a82951237e61b101a",
                "sha256": "a3073f18b1d9cdb67a3027e726a7a7bd058a4d10bbfa53d43aa296c4f178914d"
            },
            "downloads": -1,
            "filename": "fastvpinns-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "17248a0b574ac04a82951237e61b101a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 45554,
            "upload_time": "2024-07-29T19:09:25",
            "upload_time_iso_8601": "2024-07-29T19:09:25.044595Z",
            "url": "https://files.pythonhosted.org/packages/65/43/59d8bf28cc6066dbdb3f87e628e072ec32b2740d2e0f38d1efa5812b2195/fastvpinns-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-29 19:09:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cmgcds",
    "github_project": "fastvpinns",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    "<=",
                    "1.23.5"
                ],
                [
                    ">=",
                    "1.21"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "<",
                    "1.4.4"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "tensorflow",
            "specs": [
                [
                    ">=",
                    "2.9.1"
                ],
                [
                    "<=",
                    "2.13.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "8.0.2"
                ]
            ]
        },
        {
            "name": "meshio",
            "specs": [
                [
                    "==",
                    "5.3.4"
                ]
            ]
        },
        {
            "name": "pyDOE",
            "specs": [
                [
                    "==",
                    "0.3.8"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    "==",
                    "4.66.2"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "gmsh",
            "specs": [
                [
                    "==",
                    "4.11.0"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": []
        },
        {
            "name": "rich",
            "specs": [
                [
                    "==",
                    "12.5.1"
                ]
            ]
        },
        {
            "name": "black",
            "specs": []
        },
        {
            "name": "pre-commit",
            "specs": []
        }
    ],
    "lcname": "fastvpinns"
}
        
Elapsed time: 0.77114s