208 Star 856 Fork 632

GVPMindSpore / mindscience

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.MD 4.31 KB
一键复制 编辑 原始数据 按行查看 历史
Brian-K 提交于 2023-08-30 17:10 . [fix]

FNO operator solves Burgers equation

Introduction

Background

Computational fluid dynamics is one of the most important techniques in the field of fluid mechanics in the 21st century. The flow analysis, prediction and control can be realized by solving the governing equations of fluid mechanics by numerical method. Traditional finite element method (FEM) and finite difference method (FDM) are inefficient because of the complex simulation process (physical modeling, meshing, numerical discretization, iterative solution, etc.) and high computing costs. Therefore, it is necessary to improve the efficiency of fluid simulation with AI.

Machine learning methods provide a new paradigm for scientific computing by providing a fast solver similar to traditional methods. Classical neural networks learn mappings between finite dimensional spaces and can only learn solutions related to a specific discretization. Different from traditional neural networks, Fourier Neural Operator (FNO) is a new deep learning architecture that can learn mappings between infinite-dimensional function spaces. It directly learns mappings from arbitrary function parameters to solutions to solve a class of partial differential equations. Therefore, it has a stronger generalization capability. More information can be found in the paper, Fourier Neural Operator for Parametric Partial Differential Equations.

This tutorial describes how to solve the 1-d Burgers' equation using Fourier neural operator.

问题描述

Burgers' equation

The 1-d Burgers’ equation is a non-linear PDE with various applications including modeling the one dimensional flow of a viscous fluid. It takes the form

$$ \partial_t u(x, t)+\partial_x (u^2(x, t)/2)=\nu \partial_{xx} u(x, t), \quad x \in(0,1), t \in(0, 1] $$

$$ u(x, 0)=u_0(x), \quad x \in(0,1) $$

where $u$ is the velocity field, $u_0$ is the initial condition and $\nu$ is the viscosity coefficient.

We aim to learn the operator mapping the initial condition to the solution at time one:

$$ u_0 \mapsto u(\cdot, 1) $$

Technical path

The Fourier Neural Operator consists of the Lifting Layer, Fourier Layers, and the Decoding Layer.

Fourier Neural Operator model structure

Fourier layers: Start from input V. On top: apply the Fourier transform $\mathcal{F}$; a linear transform R on the lower Fourier modes and filters out the higher modes; then apply the inverse Fourier transform $\mathcal{F}^{-1}$. On the bottom: apply a local linear transform W. Finally, the Fourier Layer output vector is obtained through the activation function.

Fourier Layer structure

QuickStart

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

Run Method 1: Call train.py from command line

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

where:

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

--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.

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

Run Method 2: Run Jupyter Notebook

You can run the training and validation code line by line using the Chinese or English version of the Jupyter Notebook Chinese Version and English Version.

Results Display

FNO1D Solves Burgers Equation

Performance

Parameter Ascend GPU
Hardware Ascend 910A, 32G;CPU: 2.6GHz, 192 cores NVIDIA V100 32G
MindSpore version 2.1 2.1
train loss 5e-3 4e-3
valid loss 9e-4 8e-4
speed 4.2s/epoch 3.9s/epoch

Contributor

gitee id:liulei277

email: liulei2770919@163.com

1
https://gitee.com/mindspore/mindscience.git
git@gitee.com:mindspore/mindscience.git
mindspore
mindscience
mindscience
r0.5

搜索帮助