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.4.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.4-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pinn_kit-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 946ef6709b9c455b27285713b0d893c650f2c11a7bf7c1ebbf15c6b1e1f529c4
MD5 8ea4ba4c36a03cf81c92051b3517e197
BLAKE2b-256 3538dc49fa86d1bca8b4fbe4114c3b2f5d11f00bf67ad21fd9c5323127812014

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pinn_kit-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f31300e8de6c44ebca4dac6f5098b94381289baf33598848bd7022bd3e5f13dc
MD5 cdf50826ed1d162fe5817eccd5063322
BLAKE2b-256 e7823549b0657bf1dc755c6e10e1bf770d7f8550517899aefacb7c1fe5094560

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