Skip to content

hrshtmlng/PINN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

🧠 Physics-Informed Neural Network for Solving Damped Pendulum ODE

This project demonstrates how to solve a nonlinear second-order ODE—the classic damped pendulum—using a Physics-Informed Neural Network (PINN) in PyTorch. The network learns to approximate the solution by directly embedding the physics into its training loop—no labeled data required.

🧾 Problem Statement

To solve:

$$ \theta''(t) + b\theta'(t) + c \sin(\theta(t)) = 0 $$

Where:

  • ( \theta(t) ): Angular displacement
  • ( b ): Damping coefficient
  • ( c ): Gravitational constant

This equation models the motion of a pendulum under damping (like swinging through honey).

🚀 PINN Methodology

  1. Define a neural network ( \theta_{\text{NN}}(t) ) to approximate the solution.

  2. Use automatic differentiation to compute ( \theta' ) and ( \theta'' ).

  3. Construct a physics-informed loss function from the ODE residual:

    $$ \mathcal{L}_{\text{ODE}} = \left| \theta''(t) + b\theta'(t) + c \sin(\theta(t)) \right|^2 $$

  4. Train the model by minimizing this loss using a gradient-based optimizer.

📁 Files

  • PINN.ipynb: Jupyter Notebook with full implementation, training, and plots.
  • README.md: This file—describing the approach, methods, and requirements.

🔧 Requirements

  • Python 3.x
  • PyTorch
  • NumPy
  • Matplotlib

✨ Future Work

  • Parameter inference: Estimate b, c from data.
  • Noisy or partial data scenarios.
  • Extension to chaotic or coupled mechanical systems.

Feel free to fork or contribute to expand the library with more physical systems and optimization techniques.

About

Physics Informed Neural Network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published