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 operator mapping from each time step to the next time step:
$$ w_t \mapsto w(\cdot, t+1) $$
train.py
from command linepython --mode GRAPH --save_graphs_path ./graphs --device_target Ascend --device_id 0 --config_file_path ./configs/kno2d.yaml
where:
--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.
--config_file_path
indicates the path of the parameter file. Default './configs/kno2d.yaml';
You can use Chinese or English Jupyter Notebook to run the training and evaluation code line-by-line.
Take 1 samples, and do 10 consecutive steps of prediction. Visualize the prediction as follows.
Parameter | Ascend | GPU |
---|---|---|
Hardware | Ascend 910A, 32G;CPU: 2.6GHz, 192 cores | NVIDIA V100 32G |
MindSpore版本 | 2.1 | 2.1 |
train loss | 0.17 | 0.16 |
valid loss | 3e-2 | 3e-2 |
speed | 25s/epoch | 160s/epoch |
gitee id:dyonghan
email: dyonghan@qq.com
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。