File size: 4,893 Bytes
40b99fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | ---
frameworks:
- pytorch
language:
- en
license: apache-2.0
tags:
- OneScience
- XPINNs
- physics-informed-neural-networks
- domain-decomposition
- partial-differential-equations
- Poisson
tasks:
- pde-solving
---
<p align="center">
<strong>
<span style="font-size: 30px;">XPINNs</span>
</strong>
</p>
# Model Overview
XPINNs (Extended Physics-Informed Neural Networks) decompose a complex computational domain into multiple subdomains and assign an independent neural network to each. In addition to enforcing PDE residuals and external boundary conditions, training constrains solution continuity and residual consistency across subdomain interfaces.
This model package reproduces the two-dimensional Poisson benchmark from the XPINNs paper. An irregular X-shaped domain is decomposed into three subdomains governed by:
```text
u_xx + u_yy = exp(x) + exp(y)
```
Paper: Extended Physics-Informed Neural Networks (XPINNs): A Generalized Space-Time Domain Decomposition Based Deep Learning Framework for Nonlinear Partial Differential Equations
https://doi.org/10.4208/cicp.OA-2020-0164
# Model Description
XPINNs assign a separate neural network to each of the three subdomains, using `tanh`, `sin`, and `cos` activation functions by default. The model solves the equation on the irregular domain by jointly optimizing boundary loss, PDE residual loss, interface-value loss, and interface-residual loss.
# Use Cases
| Use Case | Description |
| :---: | :--- |
| PDE solving on complex domains | Solve a two-dimensional Poisson equation on an irregular X-shaped domain |
| Domain-decomposition research | Configure independent network architectures and activation functions for different subdomains |
| Interface-constraint research | Compare losses for interface solution continuity and residual consistency |
| Pipeline validation | Validate training and inference using the bundled data and a small-scale configuration |
# 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](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
## 2. Manual Setup
**Hardware Requirements**
- A GPU or DCU is recommended for training.
- A CPU can be used for small-scale pipeline validation, but training with the full sample set will be slow.
- DCU users must install DTK and a PyTorch environment compatible with the target cluster.
### Download the Model Package
```bash
modelscope download --model OneScience/XPINNs --local_dir ./XPINNs
cd XPINNs
```
### Set Up the Runtime Environment
**DCU Environment**
```bash
# 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**
```bash
# 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
The model package includes the two-dimensional Poisson data file `data/XPINN_2D_PoissonEqn.mat`, which contains interior, boundary, and interface points for the three subdomains together with the exact solution. The number of training samples of each type can be adjusted in `conf/config.yaml`.
### Training
```bash
python scripts/train.py
```
The default weights are saved to `weight/xpinn_poisson_2d.pt`.
### Model Weights
This repository provides weights trained on the two-dimensional Poisson dataset in the `weight/` directory.
### Inference, Evaluation, and Visualization
After training, run:
```bash
python scripts/inference.py
```
The script reports the overall relative L2 error and saves plots of the exact solution, prediction, and absolute error to `result/xpinn_poisson_2d.png`. Model, data, loss, and inference parameters can all be modified in `conf/config.yaml`.
# Official OneScience Resources
| Platform | OneScience Repository | Skills Repository |
| --- | --- | --- |
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
# Citations and License
- Jagtap, A. D., Kharazmi, E., and Karniadakis, G. E. Extended Physics-Informed Neural Networks (XPINNs): A Generalized Space-Time Domain Decomposition Based Deep Learning Framework for Nonlinear Partial Differential Equations. Communications in Computational Physics, 28(5), 2002-2041, 2020.
- This model package is released under the Apache-2.0 license and retains attribution to the original paper and data sources.
|