Physics-Informed Neural Network for Solving the Navier-Stokes Equation

Model Overview

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).

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.

Dataset

  • Source: Computational fluid dynamics simulations of laminar flows.
  • Split: 80% training, 20% validation.
  • Description: Includes velocity (u, v) and pressure (p) fields over a 2D domain with temporal evolution.

Evaluation Metrics

Metric Type Metric Value Description
Machine Learning Final Training Loss 25.0 Combined data and physics loss
Final Validation Loss 4.9 Generalization to unseen data
Problem-Specific Predicted u Range [-0.4, 0.8] Velocity component $u$ prediction range
True u Range [-0.4, 1.2] True velocity $u$ range
Predicted v Range [-0.4, 0.2] Velocity component $v$ prediction range
True v Range [-0.4, 0.4] True velocity $v$ range
Predicted p Range [-3.5, 0] Pressure prediction range
True p Range [-7, 0] True pressure range

Results

  • 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.
  • 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.
  • 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.

Installation

  1. Clone the repository:
    git clone https://github.com/your-repo/pinn-navier-stokes.git
    cd pinn-navier-stokes
    

Install dependencies: pip install -r requirements.txt

Required packages (example requirements.txt): torch numpy pandas matplotlib

Prepare the dataset:

Obtain a CFD dataset for laminar flows (e.g., simulated velocity/pressure fields). Place the data in a data/ directory or update the dataset path in the code.

Usage

Prepare the Data:

Ensure the CFD dataset is formatted as numpy arrays of time ($t$), spatial coordinates ($x$, $y$), and fields ($u$, $v$, $p$).

Train the Model: python main.py --data-path /path/to/data --mode train

Options: --mode: train (train the PINN), predict (generate predictions). --data-path: Path to the dataset.

Example To train the PINN and predict fluid fields: python main.py --data-path data/cfd_laminar --mode train

This will:

Train the PINN for 50 epochs with early stopping. Predict velocity ($u$, $v$) and pressure ($p$) fields. Save results (loss curves, field comparisons) to the results/ directory.

Limitations

Fine-Scale Dynamics: The feedforward architecture smooths fine-scale variations, limiting accuracy for complex flows. Pressure Prediction: Underestimates the dynamic range of pressure, affecting Navier-Stokes compliance. Turbulent Flows: Current model is limited to laminar flows; turbulent regimes require more expressive architectures.

Future Enhancements

Develop hybrid models with recurrent (RNN), convolutional (CNN), and attention-based architectures for turbulent flows. Implement a meta-learner to aggregate model predictions based on physical fidelity. Automate hyperparameter tuning using Optuna for efficient convergence. Visualize the optimization landscape to understand training dynamics.

For issues or contributions, contact the maintainers.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train Allanatrix/NexaCFD

Collection including Allanatrix/NexaCFD