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 32G | NVIDIA V100 32G |
MindSpore version | >=2.1.0 | >=2.1.0 |
dataset | 2D Navier-Stokes Equation Dataset | 2D Navier-Stokes Equation Dataset |
Parameters | 4e5 | 4e5 |
Train Config | batch_size=19, steps_per_epoch=1000, epochs=50 | batch_size=19, steps_per_epoch=1000, epochs=50 |
Evaluation Config | batch_size=19 | batch_size=19 |
Optimizer | Adam | Adam |
Train Loss(MSE) | 0.2 | 0.2 |
Evaluation Error(RMSE) | 0.03 | 0.03 |
Speed(ms/step) | 30 | 40 |
gitee id:dyonghan
email: dyonghan@qq.com
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》