hp-VPINN

Model Overview

hp-VPINN (Variational Physics-Informed Neural Network with h- and p-Refinement) trains a neural network using the variational weak form of a partial differential equation. Test functions impose integral constraints on the equation residual, while domain decomposition (h-refinement) and higher-order polynomial test functions (p-refinement) improve the representation and solution of complex fields.

This model package provides one- and two-dimensional Poisson equation examples.

Paper: hp-VPINNs: Variational physics-informed neural networks with domain decomposition
https://doi.org/10.1016/j.cma.2020.113547

Model Description

hp-VPINN constructs its variational loss with Gauss–Lobatto–Jacobi quadrature and represents the equation solution with a fully connected network. The one-dimensional example supports piecewise integration domains, while the two-dimensional example supports non-square subdomain grids. The number of subdomains and the order of the test functions can be adjusted independently to study the effects of h- and p-refinement on solution quality.

Use Cases

Use Case Description
One-dimensional Poisson equation Constrain the weak-form residual using piecewise integration domains and higher-order test functions
Two-dimensional Poisson equation Perform tensor-product quadrature on a two-dimensional domain-decomposition grid
h-refinement research Vary the number of subdomains to compare spatial decomposition strategies
p-refinement research Vary the test-function order to compare weak-form constraint capacity

Usage

1. OneCode

Use the online OneCode environment for an intelligent, one-click AI for Science (AI4S) programming experience:

Launch OneCode for one-click AI4S programming

2. Manual Setup

Hardware Requirements

  • A GPU or DCU is recommended for training.
  • A CPU can be used for inference and small-scale pipeline validation, but full training will be slow.
  • DCU users must install DTK and a PyTorch environment compatible with the target cluster.

Download the Model Package

hf download OneScience-Group/VPINNs --local-dir ./VPINNs
cd VPINNs

Set Up the Runtime Environment

DCU Environment

# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

GPU Environment

# Activate Conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

Training Data

Both the one- and two-dimensional Poisson examples construct source terms, boundary values, and evaluation data from analytical solutions, with no dependency on external data files. The numbers of subdomains, test functions, and quadrature points can be configured in conf/config.yaml.

Training

The training example is controlled by common.case in conf/config.yaml, which supports 1d, 2d, and all:

python scripts/train.py

Training weights are saved to the weight/ directory by default.

Model Weights

This repository provides weights trained on the one- and two-dimensional Poisson datasets in the weight/ directory.

Inference, Evaluation, and Visualization

The model package provides one-dimensional Poisson weights for validation. Run:

python scripts/inference.py

For the two-dimensional example, first train the corresponding weights, then set common.case to 2d or all before running inference. The script reports the relative L2 error and saves result plots to result/. Model, training, and inference parameters can all be modified in conf/config.yaml.

Official OneScience Resources

Citations and License

  • Kharazmi, E., Zhang, Z., and Karniadakis, G. E. hp-VPINNs: Variational physics-informed neural networks with domain decomposition. Computer Methods in Applied Mechanics and Engineering, 374, 113547, 2021.
  • This model package is released under the Apache-2.0 license and retains attribution to the original paper.

中文说明

模型概述

hp-VPINN(Variational Physics-Informed Neural Network with h- and p-Refinement)使用偏微分方程的变分弱形式训练神经网络。测试函数对方程残差施加积分约束,区域分解(h-refinement)和高阶多项式测试函数(p-refinement)改善复杂场的表征与求解。

此模型包提供一维和二维 Poisson 方程示例。

论文《hp-VPINNs:采用区域分解的变分物理信息神经网络(physics-informed neural network (PINN))》
https://doi.org/10.1016/j.cma.2020.113547

模型描述

hp-VPINN 采用 Gauss–Lobatto–Jacobi 求积构造变分损失,并使用全连接网络表征方程解。一维示例支持分段积分域,二维示例支持非方形子域网格。子域数量和测试函数阶数可独立调整,以研究 h 加密和 p 加密对解质量的影响。

使用场景

使用场景 说明
一维 Poisson 方程 使用分段积分域和高阶测试函数约束弱形式残差
二维 Poisson 方程 在二维区域分解网格上进行张量积求积
h 加密研究 通过改变子域数量比较空间分解策略
p 加密研究 通过改变测试函数阶数比较弱形式约束能力

使用方法

1. OneCode

通过 OneCode 在线环境体验智能一键式 AI 科学计算(AI4S)编程。

启动 OneCode 体验一键 AI4S 编程

2. 手动配置

硬件要求

  • 建议使用 GPU 或 DCU 进行训练。
  • 可使用 CPU 进行推理(inference)和小规模流程验证,完整训练会较慢。
  • DCU 用户必须安装与目标集群兼容的 DTK 和 PyTorch 环境。

下载模型包

hf download OneScience-Group/VPINNs --local-dir ./VPINNs
cd VPINNs

配置运行环境

DCU 环境

# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

GPU 环境

# Activate Conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

训练数据

一维和二维 Poisson 示例均从解析解构造源项、边界值和评估数据,无需外部数据文件。可在 conf/config.yaml 中配置子域、测试函数和求积点的数量。

训练

训练示例由 common.case(位于 conf/config.yaml 中)控制,支持 1d、2d 和 all。

python scripts/train.py

训练权重默认保存至 weight/ 目录。

模型权重

本仓库在 weight/ 目录中提供在一维和二维 Poisson 数据集上训练得到的权重。

推理、评估与可视化

此模型包提供用于验证的一维 Poisson 权重。运行以下命令。

python scripts/inference.py

对于二维示例,请先训练对应权重,再将 common.case 设为 2d 或 all 后运行推理。脚本报告相对 L2 误差,并将结果图保存至 result/。模型、训练和推理参数均可在 conf/config.yaml 中修改。

OneScience 官方资源

引用与许可证

  • Kharazmi, E., Zhang, Z., and Karniadakis, G. E. hp-VPINNs: Variational physics-informed neural networks with domain decomposition. Computer Methods in Applied Mechanics and Engineering, 374, 113547, 2021.
  • 此模型包按照 Apache-2.0 许可证发布,并保留原始论文的署名。
Downloads last month
12
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support