phoitack / physics-nn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Physics-Informed Neural Networks (PINNs)

This repository contains Python scripts, pinn's.py, and navier-stokes.py, demonstrating the use of Physics-Informed Neural Networks (PINNs) to solve diffusion and fluid dynamics problems, respectively. These scripts utilize PyTorch and TensorFlow to train neural networks to approximate solutions for diffusion and Navier-Stokes equations.

Table of Contents

  • Introduction
  • Diffusion Problem
  • Fluid Dynamics Problem
  • Physics-Informed Neural Networks (PINNs)
  • Usage
  • Files
  • Results
  • Applications
  • License

Introduction

Physics-Informed Neural Networks (PINNs) represent an innovative approach that combines neural networks with the principles of physics to solve partial differential equations (PDEs) and other physical systems. These networks are particularly valuable when analytical solutions are challenging to obtain or unavailable.

In this repository, we showcase the application of PINNs to both diffusion and fluid dynamics problems. We demonstrate how neural networks can be trained to approximate solutions to these problems accurately. By leveraging deep learning, we highlight the potential of PINNs in real-world applications across diverse domains.

Diffusion Problem

The diffusion problem is a classic physical phenomenon that describes how a quantity (such as temperature, concentration, or energy) spreads through space over time. It is governed by the diffusion equation, which is a partial differential equation. The exact solution of the diffusion problem is calculated and compared to the predictions made by the PINN.

Fluid Dynamics Problem

The fluid dynamics problem focuses on solving the incompressible Navier-Stokes equations using the navier-stokes.py script. This script demonstrates the application of PINNs in simulating fluid flow and showcases their potential for complex fluid dynamics problems.

Physics-Informed Neural Networks (PINNs)

Physics-Informed Neural Networks (PINNs) combine neural networks with the principles of physics to approximate the solutions of complex physical systems. They leverage the power of deep learning to learn the underlying physics from data, making them versatile tools for solving problems in various domains, including fluid dynamics, heat transfer, and materials science.

In this repository, we employ a neural network architecture to approximate the solution to the diffusion problem while satisfying the governing partial differential equation (PDE). The neural network is trained to minimize the error in both the PDE and the data, resulting in an accurate solution to the problem.

Usage

Diffusion

To run the "pinn's.py" script, you need to install the required Python libraries. You can do this using pip and the provided "requirements.txt" file. Follow the steps below:

Clone this repository to your local machine.

Navigate to the repository's directory.

Create a virtual environment (optional but recommended):

bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

Install the required Python libraries using pip:

pip install -r requirements.txt

Run the script:

python pinn's.py

Fluid Dynamics Problem

For the fluid dynamics problem (navier-stokes.py): Ensure you have TensorFlow and the required libraries installed. Run the script: ''' bash python navier-stokes.py '''

Files

"pinn's.py": The main Python script that trains a PINN to approximate the diffusion problem's solution and also includes an additional test using a reinitialized neural network. "navier-stokes.py": The main Python script for solving fluid dynamics problems using the Navier-Stokes equations. "requirements.txt": A file containing the required Python libraries and their versions.

Results

Both scripts will generate plots comparing the exact solution with the PINN's approximated solution, providing insights into the accuracy of the neural network in solving the respective problems.

Applications

Physics-Informed Neural Networks (PINNs) have a wide range of real-world applications, including:

Fluid Dynamics: Predicting fluid flow patterns and solving Navier-Stokes equations. Heat Transfer: Modeling heat conduction and radiation in materials. Materials Science: Understanding material properties and behavior. Geophysics: Studying seismic wave propagation and subsurface imaging. Environmental Science: Analyzing pollution dispersion and climate modeling. Biomedical Engineering: Simulating biological processes and medical imaging. By combining deep learning with physical principles, PINNs offer promising solutions to complex problems across various domains.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

License:MIT License


Languages

Language:Python 100.0%