Skip to content

MattiaBarbiere/PINNs_for_harmonic_maps

Repository files navigation

PINNs_for_harmonic_maps

Physics-Informed Neural Networks for solving non-divergence form PDE and harmonic map equations
Semester project, Spring 2025, EPFL


Table of Contents

  1. Motivation
  2. Installation
  3. Usage
  4. Report
  5. Folder structure
  6. License
  7. Author

Motivation

Harmonic maps are fundamental tools in geometry, physics, and PDE-constrained optimization, used to construct smooth mappings between domains. However, solving harmonic map equations is challenging due to their nonlinearity and the complexity of enforcing boundary conditions.

This project explores the use of Physics-Informed Neural Networks (PINNs) as a flexible, mesh-free alternative to traditional solvers. By embedding the PDE and boundary conditions directly into the loss function, PINNs offer a powerful framework for approximating solutions to harmonic map problems, even in cases where analytical solutions are unavailable or classical methods are difficult to apply.


Installation

Ensure you have Python 3.10+ and a virtual environment activated. Next clone the repository onto your local machine:

>>> git clone https://github.com/MattiaBarbiere/PINNs_for_harmonic_maps.git

Once cloned, move to the folder containing setup.py and run the following command

>>> pip install -e .

You can remove the -e flag if you do not want to edit the hmpinn module.

The scirpt above should install all the requirements, if this is not the case run

>>> pip install -r requirements.txt

Usage

Running experiments

The code and results of the experiments are avaliable in the subdirectory inside simulation_studies/. Each experiment folder has an ouputs/ subfolder with all the experimental data (i.e. trained model, loss and error values etc.) and a config/ subfolder contains the configuration files for each experiment. Please read simulation_studies/README.md before running the scripts.

Plotting results

The hmpinn/plotting/ files are very useful for plotting the results directly from the path of the data. A lot of results (both good and bad) are avaliable as notebooks in the scripts/ subfolder.


Report

For the full report of the project, including theoretical background and experimental analysis, visit Mattia_Barbiere_report.pdf.

Example

Below you find the solution given by a trained PINN when solving the quarter annulus harmonic map problem. The left image is the analytical boundary given by the boundary condition of the problem. The centre figure is the output of the trained PINN when evaluated at the boundary of the $[0,1]^2$ square. This represents the boundary that the PINN has learned from training. The right image is the trained PINN evaluated at the mesh of the $[0,1]^2$ square. Report image


Folder Structure

Below is a summarised folder structure for the hmpinn package:

hmpinn/
│
├── __init__.py                # Package initialization
├── constants.py               # Global constants and default configs
├── loss_function.py           # PINN loss function class
├── embedding.py               # Embedding layer class
│
├── models/                    # PINN model architectures
│
├── PDEs/                      # PDE classes
│   ├── __init__.py
│   ├── PDE_factory.py         # PDE class construction
│   ├── harmonic_maps/         # Harmonic map classes
│   ├── div_form_PDEs/         # Divergence form PDE classes
│   ├── non_div_form_PDEs/     # Non-divergence form PDE classes
│   └── parent classes ...     # Parent classes to construct PDE classes
|
├── samplers/                  # Domain/boundary point samplers
│
├── utils/                     # General utilities and helpers
│   ├── __init__.py
│   ├── utils.py               # Core utility functions
│   ├── yaml_utils.py          # YAML config loading/parsing
│   └── ml_utils.py            # ML training helpers
│
└── plotting/                  # Plotting and visualization

License

This project is licensed under the MIT License. See the LICENSE file for more details.


Author

Developed by Mattia Barbiere as part of the spring 2025 semester project at EPFL.
GitHub: @MattiaBarbiere


About

Physics-Informed Neural Networks for solving non-divergence form PDE and harmonic map equations

Topics

Resources

License

Stars

Watchers

Forks