Skip to main content

A toolkit for Physics-Informed Neural Networks

Project description

PINN-kit

A toolkit for Physics-Informed Neural Networks (PINNs). This package provides tools and utilities for implementing and training physics-informed neural networks for solving differential equations.

Features

  • Easy-to-use interface for defining physics-informed neural networks
  • Support for various types of differential equations
  • Flexible domain handling utilities for arbitrary input variables
  • Advanced meshgrid functionality for multi-dimensional problems
  • Training and evaluation tools

Installation

PINN-kit supports macOS, Linux, and Windows. You can install it using pip, which will also automatically install all required dependencies, including torch.

Create a Virtual Environment (Recommended)

It is recommended to use a virtual environment with Python 3.12 to avoid dependency conflicts.

macOS & Linux

python3.12 -m venv venv
source venv/bin/activate

Windows

Open Command Prompt or PowerShell and run:

python3.12 -m venv venv
venv\Scripts\activate

Install PINN-kit

macOS & Linux

pip install pinn-kit

Windows

Open Command Prompt or PowerShell and run:

pip install pinn-kit

Note: There is no need to install torch separately; it will be installed automatically with pinn-kit.

PINN-kit is easy to use

from pinn_kit import PINN, Domain, convert_to_meshgrid
import numpy as np

# Create a domain with flexible variable definition
domain = Domain([
    ('x', -1, 1),  # x-coordinate bounds
    ('y', -1, 1),  # y-coordinate bounds
    ('t', 0, 1)    # time bounds
])

# Sample points using various strategies
x_arr, y_arr, t_arr = domain.sample_points(
    num_samples=1000,
    sampler="lhs_classic"  # Latin Hypercube Sampling
)

# Create meshgrid from 1D arrays (new flexible interface)
x_1d = np.linspace(-1, 1, 50)
y_1d = np.linspace(-1, 1, 50)
t_1d = np.linspace(0, 1, 10)
xx, yy, tt = convert_to_meshgrid([x_1d, y_1d, t_1d])

# Initialize a PINN
pinn = PINN([3, 20, 20, 1])  # 3 inputs, 2 hidden layers, 1 output

# Define the loss terms
def loss():
    return loss_function

# Train the network
pinn.train_model([x_arr, y_arr, t_arr], loss_list, num_epochs=1000)

Documentation

For detailed documentation, please visit our documentation page.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinn_kit-0.1.5.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinn_kit-0.1.5-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file pinn_kit-0.1.5.tar.gz.

File metadata

  • Download URL: pinn_kit-0.1.5.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for pinn_kit-0.1.5.tar.gz
Algorithm Hash digest
SHA256 255cf4eebf6298198da68a3d623951b18b5e6c0fb379abbf20463c6e87556cba
MD5 0dffec1760ba72a1d88be0289deb00a5
BLAKE2b-256 8b128f99d69e8351f6ee46120b509acd5c1827e68e6c63cc77861551d7e62b22

See more details on using hashes here.

File details

Details for the file pinn_kit-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pinn_kit-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for pinn_kit-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b7c060a1495fcf9e4ed10df19fb8860aa83e59004d614d811baaf497503d68f0
MD5 4850f664af6a42691004e7bbc9f3a6e0
BLAKE2b-256 ef1581f2e5c65e1e2fdc386211a73c8d58ebd97d5f2bbf059faa6a1a3bdf66dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page