Skip to content

tsotchke/PINN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Physics-Informed Neural Network (PINN)

Transforming Physics with Neural Networks

Welcome to the Physics-Informed Neural Network (PINN) project, where the realms of deep learning and the fundamental principles of physics converge to tackle some of the most complex challenges in computational science. This repository offers an advanced framework designed not only to solve intricate physical problems but to do so in a manner that inherently respects and incorporates the laws of nature.

Why Physics-Informed Neural Networks?

Traditional numerical methods for solving differential equations can be computationally intensive and often fall short in terms of accuracy, especially in high-dimensional spaces or complex domains. PINNs leverage the power of neural networks to create models that can learn from both data and physical laws, resulting in solutions that are not only efficient but also grounded in reality. This synergy opens doors to new possibilities across various scientific fields.

Key Innovations

  • Advanced Loss Functions:
    Implementations of physics-informed loss functions that directly align with well-established physical equations, allowing for:

    • Schrödinger Equation: Modeling quantum systems.
    • Maxwell's Equations: Understanding electromagnetic fields.
    • Heat Equation: Analyzing thermal dynamics.
    • Wave Equation: Capturing wave propagation phenomena.
    • Navier-Stokes Equations: Solving fluid dynamics challenges.
  • Dynamic and Flexible Architecture:
    A customizable neural network framework supports a diverse range of activation functions:

    • Tanh: Enhanced with numerical stability techniques to mitigate overflow issues.
    • ReLU and Leaky ReLU: Optimized for sparse data and ensuring gradient flow.
    • Sigmoid: For scenarios requiring probabilistic outputs.
  • State-of-the-Art Numerical Stability:
    With advanced numerical techniques integrated, our PINN framework ensures robust performance, even under challenging conditions where traditional methods may falter.

  • Multi-Dimensional Input Capabilities:
    This project is designed to handle inputs in multiple dimensions, allowing researchers to explore intricate systems and phenomena beyond conventional boundaries.

  • Seamless Model Persistence and Experimentation:
    Easily save and load model states, enabling quick iterations and facilitating comprehensive experimentation with minimal overhead.

  • Comprehensive Data Handling and Visualization Tools:
    Efficient data preprocessing utilities paired with advanced visualization capabilities allow for in-depth analysis and intuitive understanding of model performance and convergence.

Directory Structure

The project is organized for clarity and usability:

pinn/
├── src/                    # Core source code for PINN
│   ├── main.c              # Entry point for the application
│   ├── neural_network.c    # Core neural network implementation
│   ├── loss_functions.c    # Definitions for physics-informed loss functions
│   └── utils.c             # Utilities for data handling and processing
├── include/                # Header files
│   ├── neural_network.h
│   ├── loss_functions.h
│   └── utils.h
├── tests/                  # Unit tests to ensure functionality
│   ├── test_loss_functions.c
│   └── test_neural_network.c
├── visualization.py        # Python script for visualizing training results
├── Makefile                # Build instructions for the project
└── README.md               # Project documentation

Installation

Prerequisites

  • A C compiler (e.g., GCC)
  • Python 3.x (required for visualization)

Building the Project

To compile the project, simply run the following command in your terminal:

make

This command will generate the executable pinn_neural_network.

Running the Application

To execute the application, use the following command format:

./pinn --loss [loss_type] --epochs [value] --learning_rate [value] --activation [activation_function]

Example Usage

# Solving the Schrödinger equation with a potential
./pinn --loss schrodinger --potential 0.1 --epochs 1000 --learning_rate 0.01 --activation sigmoid

# Solving Maxwell's equations with charge density
./pinn --loss maxwell --charge_density 1.0 --current_density 0.5 --epochs 1000 --learning_rate 0.01 --activation relu

# Analyzing thermal diffusion using the heat equation
./pinn --loss heat --thermal_conductivity 0.5 --epochs 1000 --learning_rate 0.01 --activation tanh

# Capturing wave propagation dynamics
./pinn --loss wave --wave_speed 343.0 --epochs 1000 --learning_rate 0.01 --activation leaky_relu

# Solving fluid dynamics challenges with Navier-Stokes
./pinn --loss navier_stokes --viscosity 0.001 --epochs 1000 --learning_rate 0.01 --activation sigmoid

Testing the Implementation

To validate the functionality of the loss functions and neural network components, run:

./test_loss_functions
./test_neural_network

Visualization

Use the provided Python script to visualize training progress:

python visualization.py

This script generates plots showcasing the evolution of loss during training, providing insights into the model's learning dynamics.

Future Directions

We envision this project as a continually evolving repository, paving the way for groundbreaking advancements in physics-informed machine learning. Future enhancements may include:

  • Integration of Complex Physical Models: Explore new physical phenomena and challenges.
  • Support for High-Dimensional and Time-Dependent Problems: Extend capabilities to model dynamic systems.
  • Advanced Optimization Techniques: Implement cutting-edge methods to improve convergence rates and efficiency.
  • Enhanced User Documentation and Tutorials: Develop comprehensive guides to empower users in leveraging the power of PINNs.

Citation

If you use this project in your research, please cite as follows:

@software{PhysicsInformedNeuralNetwork,
  author = {tsotchke},
  title = {Physics-Informed Neural Network (PINN)},
  year = {2024},
  url = {https://github.com/tsotchke/PINN}
}

License

This project is licensed under the MIT License.

Acknowledgements

We wish to extend our gratitude to the open-source community and the pioneering researchers whose work has inspired the development of this project. Their contributions have laid the groundwork for the ongoing exploration of the intersection between machine learning and physics.

About

Physics-Informed Neural Network written in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published