206 Star 845 Fork 624

GVPMindSpore / mindscience

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 3.28 KB
一键复制 编辑 原始数据 按行查看 历史
xingzhongfan 提交于 2023-12-04 10:53 . update bergers performance table

Solve 2D Navier-Stokes Equation by FNO

Overview

Navier-Stokes equation is a classical equation in computational fluid dynamics. It is a set of partial differential equations describing the conservation of fluid momentum, called N-S equation for short. Its vorticity form in two-dimensional incompressible flows is as follows:

$$ \partial_t w(x, t)+u(x, t) \cdot \nabla w(x, t)=\nu \Delta w(x, t)+f(x), \quad x \in(0,1)^2, t \in(0, T] $$

$$ \nabla \cdot u(x, t)=0, \quad x \in(0,1)^2, t \in[0, T] $$

$$ w(x, 0)=w_0(x), \quad x \in(0,1)^2 $$

where $u$ is the velocity field, $w=\nabla \times u$ is the vorticity, $w_0(x)$ is the initial vorticity, $\nu$ is the viscosity coefficient, $f(x)$ is the forcing function.

We aim to solve two-dimensional incompressible N-S equation by learning the Fourier Operator mapping from each time step to the next time step:

$$ w_t \mapsto w(\cdot, t+1) $$

QuickStart

You can download dataset from data_driven/navier_stokes/dataset. Save these dataset at ./dataset.

Run Option 1: Call train.py from command line

python train.py --config_file_path ./configs/fno2d.yaml --mode GRAPH --device_target Ascend --device_id 0

where:

--config_file_path indicates the path of the parameter file. Default './configs/fno2d.yaml';

--mode is the running mode. 'GRAPH' indicates static graph mode. 'PYNATIVE' indicates dynamic graph mode. Default 'GRAPH'.

--device_target indicates the computing platform. You can choose 'Ascend' or 'GPU'. Default 'Ascend'.

--device_id indicates the index of NPU or GPU. Default 0.

Run Option 2: Run Jupyter Notebook

You can use Chinese or EnglishJupyter Notebook to run the training and evaluation code line-by-line.

Results

Take 1 samples, and do 10 consecutive steps of prediction. Visualize the prediction as follows.

Inference Error

Performance

Parameter Ascend GPU
Hardware Ascend 32G NVIDIA V100 32G
MindSpore version >=2.1.0 >=2.1.0
dataset 2D Navier-Stokes Equation Dataset 2D Navier-Stokes Equation Dataset
Parameters 9e5 9e5
Train Config batch_size=19, steps_per_epoch=1000, epochs=150 batch_size=19, steps_per_epoch=1000, epochs=150
Evaluation Config batch_size=1 batch_size=1
Optimizer Adam Adam
Train Loss(MSE) 0.7 0.7
Evaluation Error(RMSE) 0.06 0.06
Speed(ms/step) 15 45

Contributor

gitee id:yi-zhang95

email: zhang_yi_1995@163.com

1
https://gitee.com/mindspore/mindscience.git
git@gitee.com:mindspore/mindscience.git
mindspore
mindscience
mindscience
master

搜索帮助