File size: 4,124 Bytes
d46a58d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
130
131
132
133
134
135
136
137
---
frameworks:
- ""
language:
- en
license: apache-2.0
tags:
- OneScience
- fluid dynamics
- external flow prediction
- unstructured-mesh simulation

---
<p align="center">
  <strong>
    <span style="font-size: 30px;">MeshGraphNet</span>
  </strong>
</p>

# Model Overview

MeshGraphNets is a graph neural network developed by DeepMind for mesh-based physical simulation. It rapidly predicts the dynamics of complex physical systems, including fluids, structures, and cloth.

Paper: Learning Mesh-Based Simulation with Graph Networks
https://arxiv.org/abs/2010.03409

# Model Description
MeshGraphNets uses an encoder–processor–decoder graph-network architecture trained on trajectories from fluid, structural, and cloth simulations to perform long-horizon dynamical simulation of complex physical systems.

## Use Cases

| Use Case | Description |
|---|---|
| External flow prediction | Predict velocity, pressure, and other flow variables at mesh nodes |
| Structural deformation simulation | Predict the displacement, stress, and deformation of loaded structures |
| Cloth dynamics | Simulate the motion of deformable objects such as flexible membranes and cloth |
| ModelScope/OneCode execution | Download the standalone model package, install its dependencies, and run the provided scripts |


# 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.
- DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version for the target cluster, is recommended.


### Download the Model Package

```bash
modelscope download --model OneScience/MeshGraphNet --local_dir ./MeshGraphNet 
cd MeshGraphNet 
```

### Set Up the Runtime Environment


**DCU Environment**

```bash
# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is also supported
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
# Installation with uv is also supported
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai
```

### Training Data

The OneScience community provides the `cylinder_flow` dataset for training. Download it with the command below and verify that the data path in `config/config.yaml` is configured correctly:

```bash
modelscope download --dataset OneScience/cylinder_flow --local_dir ./data
```

### Training

Single GPU:

```bash
python scripts/train.py
```

Multiple GPUs:

```bash
torchrun --nproc_per_node=8 --nnodes=1 --rdzv_id=1000 --rdzv_backend=c10d --max_restarts=0 --master_addr="localhost" --master_port=29500 scripts/train.py
```

Training saves `.pth` files under `weight/checkpoints`.

### Model Weights
This repository will provide weights trained on the `cylinder_flow` dataset in the `weights/` directory. The weights will be uploaded soon.

### Inference

```bash
python scripts/inference.py
```

Inference results are saved to `result/output/`.

### Evaluation and Visualization

```bash
python scripts/result.py
```


# 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
- Original MeshGraphNet paper: [Learning Mesh-Based Simulation with Graph Networks](https://arxiv.org/abs/2010.03409).
- This repository retains source attribution and has been adapted for automated execution through OneScience and ModelScope.