Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,112 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
-
-
|
| 5 |
-
- physics
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: PINN for Navier-Stokes Equation
|
| 3 |
+
emoji: 🌊
|
| 4 |
+
pinned: false
|
| 5 |
+
license: mit
|
| 6 |
tags:
|
| 7 |
+
- computational-fluid-dynamics
|
| 8 |
+
- physics-informed-neural-networks
|
| 9 |
+
- navier-stokes
|
| 10 |
+
- machine-learning
|
| 11 |
+
- fluid-flow
|
| 12 |
+
datasets:
|
| 13 |
+
- Allanatrix/CFD
|
| 14 |
+
pipeline_tag: tabular-regression
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Physics-Informed Neural Network for Solving the Navier-Stokes Equation
|
| 18 |
+
|
| 19 |
+
## Model Overview
|
| 20 |
+
|
| 21 |
+
This repository contains a **Physics-Informed Neural Network (PINN)** designed to solve the **Navier-Stokes equation** for incompressible fluid flows, focusing initially on laminar flow regimes. The PINN embeds the governing partial differential equations (PDEs) into its loss function, enabling data-efficient solutions for velocity and pressure fields. The model takes time and spatial coordinates as inputs and predicts velocity components ($u$, $v$) and pressure ($p$). It was trained on a computational fluid dynamics (CFD) dataset and evaluated using machine learning metrics (training/validation loss) and problem-specific metrics (velocity/pressure field accuracy).
|
| 22 |
+
|
| 23 |
+
Developed for researchers and CFD professionals, this model offers a promising alternative to traditional numerical solvers like direct numerical simulation (DNS), with potential for extension to turbulent flows through hybrid architectures and automated optimization.
|
| 24 |
+
|
| 25 |
+
## Dataset
|
| 26 |
+
|
| 27 |
+
- **Source**: Computational fluid dynamics simulations of laminar flows.
|
| 28 |
+
- **Split**: 80% training, 20% validation.
|
| 29 |
+
- **Description**: Includes velocity (u, v) and pressure (p) fields over a 2D domain with temporal evolution.
|
| 30 |
+
|
| 31 |
+
## Evaluation Metrics
|
| 32 |
+
|
| 33 |
+
| Metric Type | Metric | Value | Description |
|
| 34 |
+
|---------------------|----------------------------|--------|------------------------------------------|
|
| 35 |
+
| Machine Learning | Final Training Loss | 25.0 | Combined data and physics loss |
|
| 36 |
+
| | Final Validation Loss | 4.9 | Generalization to unseen data |
|
| 37 |
+
| Problem-Specific | Predicted u Range | [-0.4, 0.8] | Velocity component $u$ prediction range |
|
| 38 |
+
| | True u Range | [-0.4, 1.2] | True velocity $u$ range |
|
| 39 |
+
| | Predicted v Range | [-0.4, 0.2] | Velocity component $v$ prediction range |
|
| 40 |
+
| | True v Range | [-0.4, 0.4] | True velocity $v$ range |
|
| 41 |
+
| | Predicted p Range | [-3.5, 0] | Pressure prediction range |
|
| 42 |
+
| | True p Range | [-7, 0] | True pressure range |
|
| 43 |
+
|
| 44 |
+
## Results
|
| 45 |
+
|
| 46 |
+
- **Machine Learning**: Achieved a final training loss of 25.0 and validation loss of 4.9, indicating effective learning of physics constraints and good generalization.
|
| 47 |
+
- **Problem-Specific**: Captured general trends in velocity (u, v) and pressure (p) fields, but smoothed fine-scale variations and underestimated the dynamic range, especially for pressure.
|
| 48 |
+
- **Visualizations**: Scatter plots of true vs. predicted u, v, and p at a specific time step, and loss curves over 30 epochs, highlight the model’s strengths and limitations.
|
| 49 |
+
|
| 50 |
+
## Installation
|
| 51 |
+
|
| 52 |
+
1. Clone the repository:
|
| 53 |
+
```bash
|
| 54 |
+
git clone https://github.com/your-repo/pinn-navier-stokes.git
|
| 55 |
+
cd pinn-navier-stokes
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
Install dependencies:
|
| 59 |
+
pip install -r requirements.txt
|
| 60 |
+
|
| 61 |
+
Required packages (example requirements.txt):
|
| 62 |
+
torch
|
| 63 |
+
numpy
|
| 64 |
+
pandas
|
| 65 |
+
matplotlib
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
Prepare the dataset:
|
| 69 |
+
|
| 70 |
+
Obtain a CFD dataset for laminar flows (e.g., simulated velocity/pressure fields).
|
| 71 |
+
Place the data in a data/ directory or update the dataset path in the code.
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
# Usage
|
| 75 |
+
|
| 76 |
+
Prepare the Data:
|
| 77 |
+
|
| 78 |
+
Ensure the CFD dataset is formatted as numpy arrays of time ($t$), spatial coordinates ($x$, $y$), and fields ($u$, $v$, $p$).
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
Train the Model:
|
| 82 |
+
python main.py --data-path /path/to/data --mode train
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
Options:
|
| 86 |
+
--mode: train (train the PINN), predict (generate predictions).
|
| 87 |
+
--data-path: Path to the dataset.
|
| 88 |
+
|
| 89 |
+
Example
|
| 90 |
+
To train the PINN and predict fluid fields:
|
| 91 |
+
python main.py --data-path data/cfd_laminar --mode train
|
| 92 |
+
|
| 93 |
+
This will:
|
| 94 |
+
|
| 95 |
+
Train the PINN for 50 epochs with early stopping.
|
| 96 |
+
Predict velocity ($u$, $v$) and pressure ($p$) fields.
|
| 97 |
+
Save results (loss curves, field comparisons) to the results/ directory.
|
| 98 |
+
|
| 99 |
+
# Limitations
|
| 100 |
+
|
| 101 |
+
Fine-Scale Dynamics: The feedforward architecture smooths fine-scale variations, limiting accuracy for complex flows.
|
| 102 |
+
Pressure Prediction: Underestimates the dynamic range of pressure, affecting Navier-Stokes compliance.
|
| 103 |
+
Turbulent Flows: Current model is limited to laminar flows; turbulent regimes require more expressive architectures.
|
| 104 |
+
|
| 105 |
+
Future Enhancements
|
| 106 |
+
|
| 107 |
+
Develop hybrid models with recurrent (RNN), convolutional (CNN), and attention-based architectures for turbulent flows.
|
| 108 |
+
Implement a meta-learner to aggregate model predictions based on physical fidelity.
|
| 109 |
+
Automate hyperparameter tuning using Optuna for efficient convergence.
|
| 110 |
+
Visualize the optimization landscape to understand training dynamics.
|
| 111 |
+
|
| 112 |
+
For issues or contributions, contact the maintainers.
|