Modular, interactive framework for Physics-Informed Neural Networks (PINNs)
Project description
PINNo — Physics-Informed Neural Network (PINN) Interactive Trainer
Status: v1.0 - Initial Release Authors: Angie Lorena Pineda Morales, Juan Sebastian Acuña Tellez, Pablo Patiño Bonilla.
This document explains how to install, run and use the PINNo application, the sample models and problems included, and serves as a step-by-step tutorial for new users.
Table of contents
- Project overview
- Requirements
- Installation
- Project layout (quick)
- Running the GUI (Tutorial)
- Running training from the command line / scripts
- Configuration & problems (formats and examples)
- Sample models provided
- What the GUI displays / how to interpret results
- Running tests
- Extending PINNo (adding models or physics)
- Troubleshooting & common errors
- License & contact
Project overview
PINNo is a modular PINN framework designed for rapid experimentation with physics problems expressed as ODEs/PDEs. This version (v1.0) introduces a complete interactive environment for learning, training, and exporting scientific models.
Key features:
- Interactive GUI: 4 tabs covering theory, data loading, training, and reporting.
- Dynamic Configuration: Modify neural network architecture (layers, neurons, activation) without touching code.
- Advanced Visualization: Real-time 1D slices and 2D Heatmaps for the Heat Equation.
- Export Capabilities: Save your trained models (.keras), data (.csv), and plots (.png).
Requirements
Tested with Python 3.10+. Required packages (see requirements.txt):
tensorflow>=2.12.0 numpy>=1.24 matplotlib>=3.7 pandas>=1.5.0 openpyxl>=3.1.0 scipy>=1.10.0 pytest>=7.0
Use a virtual environment (venv or conda) and install via pip.
Installation
- Create and activate a virtual environment:
Linux / macOS
python -m venv .venv source .venv/bin/activate
Windows (PowerShell)
.venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Project layout
Important files and modules you will use:
. ├─ main.py # Top-level CLI runner ├─ gui.py # Main GUI entry point ├─ requirements.txt ├─ src/ │ ├─ config.py # Central configuration (SHO, DHO, HEAT) │ ├─ models.py # Model factory (PINN_MLP) │ ├─ physics.py # Physics definitions & Residuals │ ├─ training.py # PINNTrainer logic │ ├─ data_manage.py # Data sampling & CSV loading │ ├─ losses.py # Loss calculation strategies │ └─ gui_modules/ # Modular GUI components │ ├─ info_tab.py # Educational content │ ├─ training_tab.py # Training loop & Visualization │ └─ report_tab.py # Metrics & Exporting └─ tests/ # Pytest suite
Running the GUI (Tutorial)
This section serves as a quick tutorial to get started with PINNo using the graphical interface.
-
Launch the Application: Run the following command in your terminal:
python gui.py
-
Step 1: Learn the Basics (Tab: Learn PINNs)
- Navigate to the first tab to understand the difference between standard Neural Networks and PINNs.
- Review the "Hyperparameters Guide" to understand what Learning Rate and Epochs do.
-
Step 2: Load Experimental Data (Tab: Data Exploration) [Optional]
- If you have a
.csvfile (e.g., columnst,x), click "Load Data". - The app will plot your data. This activates "Hybrid Training", where the network learns from both your data AND the physics equation.
- If you have a
-
Step 3: Configure and Train (Tab: Train & Config)
- Select Problem: Choose
SHO(Oscillator),DHO(Damped), orHEAT(2D Heat Eq). - Customize Architecture:
- Try changing
Activationto "tanh" (best for physics). - For
HEAT, increaseHidden Layersto 6.
- Try changing
- Modify Physics: You can change parameters like Frequency (Omega) directly in the inputs.
- Action: Click Start Training.
- Observe: Watch the "Loss" graph decrease. For
HEAT, watch the bottom heatmaps evolve in real-time to match the analytical solution.
- Select Problem: Choose
-
Step 4: Analyze and Export (Tab: Metrics Report)
- Click 🔄 Generar Reporte to fetch the latest statistics.
- Save Results:
- Click "💾 Guardar Gráfica" to save the convergence plot.
- Click "🧠 Guardar Modelo" to save the
.kerasfile for future use.
Running training from the command line / scripts
For long experiments on servers without a screen, use the CLI.
A — Use main.py (CLI)
This script runs the training using the default settings defined in src/config.py.
python main.py
It will create a timestamped folder in results/ containing the model checkpoints.
B — Run programmatically
You can customize the training script in Python:
from src.config import get_active_config from src.training import PINNTrainer
Load default config
cfg = get_active_config("SHO")
Modify config programmatically
cfg["EPOCHS"] = 5000 cfg["LEARNING_RATE"] = 0.001
Run
trainer = PINNTrainer(cfg, "SHO") for epoch in range(5000): trainer.perform_one_step()
Configuration & problems (formats and examples)
All problem configs are centralized in src/config.py. Use the helper:
from src.config import get_active_config cfg = get_active_config("SHO")
Important sections inside the returned config dict:
MODEL_CONFIG: dict withnum_layers,hidden_dim,activation.PHYSICS_CONFIG: physical parameters (e.g.,omega,zeta,alpha).DATA_CONFIG: numbers of collocation points, initial points, and boundary points.LOSS_WEIGHTS: weightings for the components of the loss (ODE/PDE, Initial, Data).
Note: The GUI overrides these values at runtime based on the input fields in the "Train & Config" tab.
Sample models provided
- PINN_MLP (in
src/models.py): a dense feed-forward network.
Model input shapes:
- For SHO/DHO:
input_dim = 1(timet). - For HEAT:
input_dim = 3(space and timex, y, t).
All tensors should be float32.
What the GUI displays / how to interpret results
-
Loss plot (Top):
- Shows the Log-Scale Loss vs. Epochs.
- A downward slope indicates the network is learning. Spikes usually mean the "Learning Rate" is too high.
-
Solution plot (Bottom):
- SHO/DHO: Shows position
xover timet.- Dotted Line: Analytical (Real) solution.
- Solid Line: Neural Network prediction.
- HEAT:
- Middle: 1D slice of temperature at the center of the domain.
- Bottom: Real-time 2D Heatmaps (Left: Predicted, Right: Analytical).
- SHO/DHO: Shows position
Running tests
A robust test suite using pytest verifies physics residuals, data loading, and architecture gradients.
From the project root:
pytest
To see code coverage:
pytest --cov=src tests/
Extending PINNo (adding models or physics)
Add a new model
- Implement a new
tf.keras.Modelinsrc/models.py. - Register it in the
MODELSdict.
Add a new physics problem
- Create a new class inheriting from
PhysicsProbleminsrc/physics.py. - Implement
pde_residual(usingGradientTape) andanalytical_solution. - Add the new class to the
PROBLEMSmapping. - Add a matching config to
src/config.py.
Troubleshooting & common errors
x_tt is None or derivative errors
Symptoms: ValueError: The calculation of the derivative failed.
Fix: Ensure you are using a differentiable activation function like tanh or swish. relu has zero second derivatives in many regions.
High Loss in HEAT equation
Symptoms: The model does not converge or shows a flat heatmap. Fix: The 2D Heat equation is complex. Increase epochs to 20,000+ and network depth to 6+ layers in the GUI configuration.
GUI Freezes
Fix: The training runs in a separate thread, but plotting heavy heatmaps every epoch can slow things down. The GUI updates graphs every 10 epochs to prevent this.
License & contact
This repository contains research code developed at Universidad Distrital Francisco José de Caldas.
Authors:
- Angie Lorena Pineda Morales (alpinedam@udistrital.edu.co)
- Juan Sebastian Acuña Tellez (jsacunat@udistrital.edu.co)
- Pablo Patiño Bonilla (jppatinob@udistrital.edu.co)
Good luck experimenting with PINNo v1.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pinno_solver-0.1.1.tar.gz.
File metadata
- Download URL: pinno_solver-0.1.1.tar.gz
- Upload date:
- Size: 41.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cea9d10be1fb2a5b21db19941d793d2c8fa30a70cffca5c2ed64b7e4d41f4af
|
|
| MD5 |
9b7ef565077a96e51868a3db97bdb6ae
|
|
| BLAKE2b-256 |
a2e23bf56f359cde8cffa05029ad61514cacd03eaf33f7543053682b198900e6
|
File details
Details for the file pinno_solver-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pinno_solver-0.1.1-py3-none-any.whl
- Upload date:
- Size: 40.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a76364d83fce2a2ac1915c3eb6a5d527a428ecad5d8f4d7f57b968eea27e0c76
|
|
| MD5 |
6b0c05623cfd439d955ff02d21359741
|
|
| BLAKE2b-256 |
d84acaf1816a82170849916926b2a3001936f5f7b165df541091a4fdea2f7247
|