![cover](https://img-blog.csdnimg.cn/img_convert/cb5b98de9d037c13fab38e91a94020de.jpeg)
飞桨黑客马拉松第四期 针对RANS方程的深度学习机翼翼型优化方法
Deep Learning Methods for Reynolds-Averaged Navier-Stokes Simulationsof Airfoil Flows
★★★ 本文源自AlStudio社区精品项目,【点击此处】查看更多精品内容 >>>
1.简介
本项目基于paddle框架复现。
本研究侧重于现代化的 U-net 架构,并评估大量经过训练的神经网络在计算压力和速度分布方面的准确性。 特别是,它说明了训练数据的大小和权重的数量如何影响解决方案的准确性。 借助最佳模型,这项研究得出的平均相对压力和速度误差小于 3%,涵盖一系列以前未见过的翼型形状。 此外,所有源代码都是公开的,以确保可重复性,并为对物理问题的深度学习方法感兴趣的研究人员提供一个起点。 虽然这项工作侧重于 RANS 解决方案,但神经网络架构和学习设置非常通用,适用于笛卡尔网格上的各种偏微分方程边值问题。
论文主要点如下:
- 作者提出了一种基于UNet神经网络的模型;
- 作者评估了大量训练的神经网络在计算压力和速度分布方面的准确性,说明了训练数据的大小和权重的数量如何影响解决方案的准确性;
- 作者借助最佳模型得出的平均相对压力和速度误差小于 3%。
本项目关键技术要点:
- 使用swin transformer模型替代原论文模型并得到相近结果;
- 针对更高版本openfoam,例如openfoamv10,实现相关文件修改。
实验结果要点:
- 成功复现论文代码框架及全流程运行测试;
- 使用swin transformer提升论文精度;
- openfoamv10版本可应用本项目代码进行数据生成与测试,代码运行环境更加宽松。
论文信息:
Thuerey N, Weißenow K, Prantl L, et al. Deep learning methods for Reynolds-averaged Navier–Stokes simulations of airfoil flows[J]. AIAA Journal, 2020, 58(1): 25-36.
参考GitHub地址:
https://github.com/thunil/Deep-Flow-Prediction
项目aistudio地址:
https://aistudio.baidu.com/aistudio/projectdetail/5671596
模型结构
2.数据集
本项目数据集通过作者提供的dataGen.py代码生成,生成后保存为npz文件,已上传aistudio数据集并关联本项目。
本项目关联数据集为通过原作者链接下载,后续会逐渐上传通过openfoamv10版本制作的数据集,可在数据集页面和项目说明中查看。
2.1 高版本openfoam使用
openfoam安装
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key > /etc/apt/trusted.gpg.d/openfoam.asc"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam10
openfoam代码修改
修改code/data/OpenFOAM/0/p文件:
inlet
{
type freestreamPressure;
freestreamValue uniform 0; # 增加此行
}
exit
{
type freestreamPressure;
freestreamValue uniform 0; # 增加此行
}
top
{
type freestreamPressure;
freestreamValue uniform 0; # 增加此行
}
bottom
{
type freestreamPressure;
freestreamValue uniform 0; # 增加此行
}
修改code/data/OpenFOAM/system/internalCloud文件:
sets
(
cloud
{
type points; # 此处修改
axis xyz;
points $points;
ordered yes; # 此处增加
}
);
修改code/data/dataGen.py文件:
p_ufile在v5版本中为分开输出,在v10版本中为合并输出,此处需要根据数据输出形式进行修改。
修改后在代码文件中修改数据提取dim。
def outputProcessing(basename, freestreamX, freestreamY, dataDir=output_dir, p_ufile='OpenFOAM/postProcessing/internalCloud/500/cloud_p_U.xy',
res=128, imageIndex=0):
···
ar = np.loadtxt(p_ufile) # 此处为加载的输出文件
curIndex = 0
for y in range(res):
for x in range(res):
xf = (x / res - 0.5) * 2 + 0.5
yf = (y / res - 0.5) * 2
if abs(ar[curIndex][0] - xf) < 1e-4 and abs(ar[curIndex][1] - yf) < 1e-4:
npOutput[3][x][y] = ar[curIndex][3] #此处输出为压力场 需要按照输出文件情况进行修改,如果输出文件表示为p_U,表示先p后U,则无需修改
curIndex += 1
# fill input as well
npOutput[0][x][y] = freestreamX
npOutput[1][x][y] = freestreamY
else:
npOutput[3][x][y] = 0
# fill mask
npOutput[2][x][y] = 1.0
ar = np.loadtxt(p_ufile) # 此处为加载的输出文件
curIndex = 0
for y in range(res):
for x in range(res):
xf = (x / res - 0.5) * 2 + 0.5
yf = (y / res - 0.5) * 2
if abs(ar[curIndex][0] - xf) < 1e-4 and abs(ar[curIndex][1] - yf) < 1e-4:
npOutput[4][x][y] = ar[curIndex][4] #此处输出为 X 方向速度场
npOutput[5][x][y] = ar[curIndex][5] #此处输出为 Y 方向速度场
curIndex += 1
else:
npOutput[4][x][y] = 0
npOutput[5][x][y] = 0
···
2.2 数据生成过程
请注意,如果您下载下面的训练数据包,则可以跳过接下来的两个步骤。 只需确保源目录中有 data/train 和 data/test,然后就可以继续训练步骤。
- (1)下载机翼数据
进入data目录,通过运行./download_airfoils.sh下载机翼配置文件,这将创建 airfoil_database 和 airfoil_database_test 目录。
-
(2)生成数据
运行python ./dataGen.py
生成一组机翼数据。 此脚本执行 openfoam 并运行 gmsh 以对机翼剖面进行网格划分。 -
(3)生成过程
首先通过gmsh对机翼剖面进行网格划分,然后通过openfoam计算网格点的压强和速度(包含x方向和y方向)。
2.3 数据说明
数据保存为为压缩的numpy数组。 每个文件中的张量大小为 6x128x128,维度为:通道、x、y。
前三个通道表示source,包含x和y方向上的自由流速度的两个字段和一个包含机翼几何形状的掩码。 最后三个通道代表target,包含一个压力场和两个速度场。
source:[free-stream x, free-stream y, mask]
target:[pressure, flow-velocity x, flow-velocity y]
3.环境依赖
python依赖
- paddle
- matplotlib
环境依赖
- openfoam (任意版本)aistudio无法安装,此处不进行安装,可在本地机器进行安装运行
4.快速开始
!cd work
!tar zxf /home/aistudio/data/data197778/dataset.tgz -C /home/aistudio/work
模型训练
默认使用TurbNetG(原论文)模型进行训练
使用swin transformer 模型请在train.py中修改
line 43 model_name = "TurbNetG"
line 44 # model_name = "SwinTransformer"
!python train.py # 4.1.1 使用TurbNetG(原论文)模型进行训练
模型测试
默认使用TurbNetG(原论文)模型进行测试
使用swin transformer 模型请在test.py中修改
line 26 model_name = "TurbNetG"
line 27 # model_name = "SwinTransformer"
!cd work && python test.py # 4.1.2 使用TurbNetG(原论文)模型进行测试
/opt/conda/envs/python35-paddle120-env/lib/python3.9/site-packages/matplotlib/__init__.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
from collections import MutableMapping
/opt/conda/envs/python35-paddle120-env/lib/python3.9/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
from collections import Iterable, Mapping
/opt/conda/envs/python35-paddle120-env/lib/python3.9/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
from collections import Sized
2.4.1
Reducing data to load for tests
Number of data loaded: 10
Using fixed maxima [4.65, 2.04, 2.37]
Data stats, input mean 0.190220, max 0.961052; targets mean 0.289502 , max 1.000000
W0313 21:44:46.654492 4140 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 11.2
W0313 21:44:46.658141 4140 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
Loading ckpt/TurbNetG_modelG
Loaded ckpt/TurbNetG_modelG
Test sample 0
pressure: abs. difference, ratio: 7.541733 , 0.064720
velocity: abs. difference, ratio: 41.243343 , 0.004871
aggregate: abs. difference, ratio: 48.785076 , 0.005683
Test sample 1
pressure: abs. difference, ratio: 11.380314 , 0.029595
velocity: abs. difference, ratio: 44.250813 , 0.004930
aggregate: abs. difference, ratio: 55.631126 , 0.005943
Test sample 2
pressure: abs. difference, ratio: 48.586723 , 0.057289
velocity: abs. difference, ratio: 179.028320 , 0.019362
aggregate: abs. difference, ratio: 227.615036 , 0.022548
Test sample 3
pressure: abs. difference, ratio: 14.942351 , 0.069424
velocity: abs. difference, ratio: 69.792336 , 0.007912
aggregate: abs. difference, ratio: 84.734688 , 0.009377
Test sample 4
pressure: abs. difference, ratio: 36.281765 , 0.076660
velocity: abs. difference, ratio: 127.992668 , 0.014184
aggregate: abs. difference, ratio: 164.274429 , 0.017297
Test sample 5
pressure: abs. difference, ratio: 13.671535 , 0.125503
velocity: abs. difference, ratio: 46.971291 , 0.005730
aggregate: abs. difference, ratio: 60.642826 , 0.007301
Test sample 6
pressure: abs. difference, ratio: 26.762314 , 0.043416
velocity: abs. difference, ratio: 67.555252 , 0.007238
aggregate: abs. difference, ratio: 94.317574 , 0.009479
Test sample 7
pressure: abs. difference, ratio: 7.594967 , 0.020744
velocity: abs. difference, ratio: 25.535044 , 0.002934
aggregate: abs. difference, ratio: 33.130013 , 0.003653
Test sample 8
pressure: abs. difference, ratio: 26.178436 , 0.058260
velocity: abs. difference, ratio: 48.826454 , 0.005420
aggregate: abs. difference, ratio: 75.004890 , 0.007931
Test sample 9
pressure: abs. difference, ratio: 131.783478 , 0.229701
velocity: abs. difference, ratio: 433.095154 , 0.047239
aggregate: abs. difference, ratio: 564.878601 , 0.057985
Test sample 10
pressure: abs. difference, ratio: 429.114929 , 0.457698
velocity: abs. difference, ratio: 1455.894775 , 0.149659
aggregate: abs. difference, ratio: 1885.009766 , 0.176737
Test sample 11
pressure: abs. difference, ratio: 384.945862 , 0.463513
velocity: abs. difference, ratio: 1550.793823 , 0.159280
aggregate: abs. difference, ratio: 1935.739624 , 0.183191
Test sample 12
pressure: abs. difference, ratio: 20.451612 , 0.053103
velocity: abs. difference, ratio: 105.308311 , 0.011398
aggregate: abs. difference, ratio: 125.759926 , 0.013067
Test sample 13
pressure: abs. difference, ratio: 15.262141 , 0.038865
velocity: abs. difference, ratio: 57.568710 , 0.006508
aggregate: abs. difference, ratio: 72.830856 , 0.007884
Test sample 14
pressure: abs. difference, ratio: 12.622210 , 0.075746
velocity: abs. difference, ratio: 28.688154 , 0.003323
aggregate: abs. difference, ratio: 41.310364 , 0.004694
Test sample 15
pressure: abs. difference, ratio: 5.819428 , 0.088553
velocity: abs. difference, ratio: 27.414394 , 0.003351
aggregate: abs. difference, ratio: 33.233822 , 0.004030
Test sample 16
pressure: abs. difference, ratio: 9.158109 , 0.053407
velocity: abs. difference, ratio: 31.416241 , 0.003667
aggregate: abs. difference, ratio: 40.574352 , 0.004643
Test sample 17
pressure: abs. difference, ratio: 102.497696 , 0.088611
velocity: abs. difference, ratio: 346.644592 , 0.036898
aggregate: abs. difference, ratio: 449.142334 , 0.042567
Test sample 18
pressure: abs. difference, ratio: 45.613579 , 0.105714
velocity: abs. difference, ratio: 38.792717 , 0.004281
aggregate: abs. difference, ratio: 84.406296 , 0.008891
Test sample 19
pressure: abs. difference, ratio: 7.334759 , 0.080041
velocity: abs. difference, ratio: 25.782650 , 0.003168
aggregate: abs. difference, ratio: 33.117409 , 0.004024
Test sample 20
pressure: abs. difference, ratio: 15.688185 , 0.079443
velocity: abs. difference, ratio: 22.483028 , 0.002690
aggregate: abs. difference, ratio: 38.171215 , 0.004461
Test sample 21
pressure: abs. difference, ratio: 30.413546 , 0.097325
velocity: abs. difference, ratio: 78.901566 , 0.008924
aggregate: abs. difference, ratio: 109.315109 , 0.011941
Test sample 22
pressure: abs. difference, ratio: 15.006035 , 0.058603
velocity: abs. difference, ratio: 36.395584 , 0.004196
aggregate: abs. difference, ratio: 51.401619 , 0.005756
Test sample 23
pressure: abs. difference, ratio: 39.271141 , 0.103554
velocity: abs. difference, ratio: 122.687126 , 0.013538
aggregate: abs. difference, ratio: 161.958267 , 0.017154
Test sample 24
pressure: abs. difference, ratio: 5.238309 , 0.067478
velocity: abs. difference, ratio: 26.199211 , 0.003200
aggregate: abs. difference, ratio: 31.437523 , 0.003804
Test sample 25
pressure: abs. difference, ratio: 44.321941 , 0.154487
velocity: abs. difference, ratio: 138.115692 , 0.015734
aggregate: abs. difference, ratio: 182.437622 , 0.020125
Test sample 26
pressure: abs. difference, ratio: 18.283770 , 0.071782
velocity: abs. difference, ratio: 27.601242 , 0.003274
aggregate: abs. difference, ratio: 45.885010 , 0.005283
Test sample 27
pressure: abs. difference, ratio: 60.211853 , 0.062823
velocity: abs. difference, ratio: 252.243027 , 0.025828
aggregate: abs. difference, ratio: 312.454865 , 0.029134
Test sample 28
pressure: abs. difference, ratio: 15.129694 , 0.042032
velocity: abs. difference, ratio: 49.465195 , 0.005831
aggregate: abs. difference, ratio: 64.594894 , 0.007305
Test sample 29
pressure: abs. difference, ratio: 13.591174 , 0.042877
velocity: abs. difference, ratio: 50.179184 , 0.005982
aggregate: abs. difference, ratio: 63.770359 , 0.007326
Test sample 30
pressure: abs. difference, ratio: 38.543484 , 0.129453
velocity: abs. difference, ratio: 143.974274 , 0.016298
aggregate: abs. difference, ratio: 182.517776 , 0.019988
Test sample 31
pressure: abs. difference, ratio: 47.155083 , 0.161945
velocity: abs. difference, ratio: 167.415680 , 0.019492
aggregate: abs. difference, ratio: 214.570770 , 0.024163
Test sample 32
pressure: abs. difference, ratio: 48.379963 , 0.163672
velocity: abs. difference, ratio: 171.805191 , 0.019934
aggregate: abs. difference, ratio: 220.185150 , 0.024700
Test sample 33
pressure: abs. difference, ratio: 15.324881 , 0.097100
velocity: abs. difference, ratio: 31.415966 , 0.003740
aggregate: abs. difference, ratio: 46.740845 , 0.005461
Test sample 34
pressure: abs. difference, ratio: 36.650009 , 0.100210
velocity: abs. difference, ratio: 88.366074 , 0.009862
aggregate: abs. difference, ratio: 125.016083 , 0.013405
Test sample 35
pressure: abs. difference, ratio: 36.660965 , 0.100269
velocity: abs. difference, ratio: 96.813461 , 0.010797
aggregate: abs. difference, ratio: 133.474426 , 0.014302
Test sample 36
pressure: abs. difference, ratio: 27.518192 , 0.052913
velocity: abs. difference, ratio: 91.301941 , 0.009748
aggregate: abs. difference, ratio: 118.820137 , 0.012018
Test sample 37
pressure: abs. difference, ratio: 9.618777 , 0.050618
velocity: abs. difference, ratio: 44.682846 , 0.005046
aggregate: abs. difference, ratio: 54.301624 , 0.006004
Test sample 38
pressure: abs. difference, ratio: 17.689243 , 0.101737
velocity: abs. difference, ratio: 58.713486 , 0.007189
aggregate: abs. difference, ratio: 76.402740 , 0.009160
Test sample 39
pressure: abs. difference, ratio: 87.879349 , 0.070384
velocity: abs. difference, ratio: 186.526093 , 0.019500
aggregate: abs. difference, ratio: 274.405457 , 0.025375
Test sample 40
pressure: abs. difference, ratio: 24.566008 , 0.053255
velocity: abs. difference, ratio: 80.498718 , 0.008829
aggregate: abs. difference, ratio: 105.064720 , 0.010969
Test sample 41
pressure: abs. difference, ratio: 41.146324 , 0.034380
velocity: abs. difference, ratio: 111.383522 , 0.011931
aggregate: abs. difference, ratio: 152.529846 , 0.014481
Test sample 42
pressure: abs. difference, ratio: 14.349619 , 0.134923
velocity: abs. difference, ratio: 51.199043 , 0.006060
aggregate: abs. difference, ratio: 65.548660 , 0.007661
Test sample 43
pressure: abs. difference, ratio: 10.360880 , 0.097327
velocity: abs. difference, ratio: 40.199043 , 0.004856
aggregate: abs. difference, ratio: 50.559925 , 0.006030
Test sample 44
pressure: abs. difference, ratio: 8.979531 , 0.024710
velocity: abs. difference, ratio: 39.143166 , 0.004440
aggregate: abs. difference, ratio: 48.122696 , 0.005243
Test sample 45
pressure: abs. difference, ratio: 9.192400 , 0.047613
velocity: abs. difference, ratio: 33.020470 , 0.003979
aggregate: abs. difference, ratio: 42.212868 , 0.004971
Test sample 46
pressure: abs. difference, ratio: 85.206848 , 0.073123
velocity: abs. difference, ratio: 240.733856 , 0.025408
aggregate: abs. difference, ratio: 325.940704 , 0.030634
Test sample 47
pressure: abs. difference, ratio: 30.576273 , 0.061746
velocity: abs. difference, ratio: 102.112396 , 0.011416
aggregate: abs. difference, ratio: 132.688675 , 0.014056
Test sample 48
pressure: abs. difference, ratio: 7.718664 , 0.037831
velocity: abs. difference, ratio: 38.369850 , 0.004669
aggregate: abs. difference, ratio: 46.088520 , 0.005473
Test sample 49
pressure: abs. difference, ratio: 13.563601 , 0.106162
velocity: abs. difference, ratio: 53.974442 , 0.006366
aggregate: abs. difference, ratio: 67.538040 , 0.007848
Test sample 50
pressure: abs. difference, ratio: 12.638635 , 0.024771
velocity: abs. difference, ratio: 39.490276 , 0.004405
aggregate: abs. difference, ratio: 52.128910 , 0.005502
Test sample 51
pressure: abs. difference, ratio: 13.847477 , 0.034949
velocity: abs. difference, ratio: 52.361973 , 0.006028
aggregate: abs. difference, ratio: 66.209450 , 0.007290
Test sample 52
pressure: abs. difference, ratio: 35.732975 , 0.109515
velocity: abs. difference, ratio: 120.152893 , 0.013620
aggregate: abs. difference, ratio: 155.885880 , 0.017040
Test sample 53
pressure: abs. difference, ratio: 23.236235 , 0.041578
velocity: abs. difference, ratio: 94.716537 , 0.010461
aggregate: abs. difference, ratio: 117.952782 , 0.012270
Test sample 54
pressure: abs. difference, ratio: 115.699196 , 0.156205
velocity: abs. difference, ratio: 367.947327 , 0.039851
aggregate: abs. difference, ratio: 483.646484 , 0.048491
Test sample 55
pressure: abs. difference, ratio: 124.986427 , 0.186404
velocity: abs. difference, ratio: 411.311584 , 0.044885
aggregate: abs. difference, ratio: 536.298035 , 0.054535
Test sample 56
pressure: abs. difference, ratio: 110.981537 , 0.162885
velocity: abs. difference, ratio: 376.274200 , 0.041110
aggregate: abs. difference, ratio: 487.255737 , 0.049547
Test sample 57
pressure: abs. difference, ratio: 7.504612 , 0.098075
velocity: abs. difference, ratio: 33.055882 , 0.003927
aggregate: abs. difference, ratio: 40.560497 , 0.004775
Test sample 58
pressure: abs. difference, ratio: 35.316601 , 0.137631
velocity: abs. difference, ratio: 102.868591 , 0.011758
aggregate: abs. difference, ratio: 138.185181 , 0.015345
Test sample 59
pressure: abs. difference, ratio: 25.409216 , 0.040697
velocity: abs. difference, ratio: 81.400658 , 0.008830
aggregate: abs. difference, ratio: 106.809875 , 0.010851
Test sample 60
pressure: abs. difference, ratio: 21.601875 , 0.057070
velocity: abs. difference, ratio: 76.941978 , 0.008950
aggregate: abs. difference, ratio: 98.543854 , 0.010979
Test sample 61
pressure: abs. difference, ratio: 25.304165 , 0.046774
velocity: abs. difference, ratio: 65.757996 , 0.007260
aggregate: abs. difference, ratio: 91.062164 , 0.009486
Test sample 62
pressure: abs. difference, ratio: 26.901779 , 0.049738
velocity: abs. difference, ratio: 189.682159 , 0.020270
aggregate: abs. difference, ratio: 216.583923 , 0.021880
Test sample 63
pressure: abs. difference, ratio: 11.343700 , 0.047383
velocity: abs. difference, ratio: 50.929131 , 0.005765
aggregate: abs. difference, ratio: 62.272835 , 0.006864
Test sample 64
pressure: abs. difference, ratio: 11.730069 , 0.019010
velocity: abs. difference, ratio: 56.992035 , 0.006194
aggregate: abs. difference, ratio: 68.722099 , 0.007000
Test sample 65
pressure: abs. difference, ratio: 21.648609 , 0.086805
velocity: abs. difference, ratio: 93.968590 , 0.010715
aggregate: abs. difference, ratio: 115.617203 , 0.012819
Test sample 66
pressure: abs. difference, ratio: 9.621416 , 0.054342
velocity: abs. difference, ratio: 30.190792 , 0.003690
aggregate: abs. difference, ratio: 39.812206 , 0.004763
Test sample 67
pressure: abs. difference, ratio: 18.818493 , 0.104117
velocity: abs. difference, ratio: 57.017784 , 0.006429
aggregate: abs. difference, ratio: 75.836281 , 0.008380
Test sample 68
pressure: abs. difference, ratio: 174.816391 , 0.277120
velocity: abs. difference, ratio: 816.383362 , 0.086224
aggregate: abs. difference, ratio: 991.199707 , 0.098148
Test sample 69
pressure: abs. difference, ratio: 17.010338 , 0.041488
velocity: abs. difference, ratio: 55.629848 , 0.005949
aggregate: abs. difference, ratio: 72.640182 , 0.007442
Test sample 70
pressure: abs. difference, ratio: 20.357388 , 0.150105
velocity: abs. difference, ratio: 68.950439 , 0.008467
aggregate: abs. difference, ratio: 89.307823 , 0.010787
Test sample 71
pressure: abs. difference, ratio: 28.007280 , 0.157469
velocity: abs. difference, ratio: 77.650475 , 0.009286
aggregate: abs. difference, ratio: 105.657753 , 0.012372
Test sample 72
pressure: abs. difference, ratio: 147.016724 , 0.183443
velocity: abs. difference, ratio: 483.985596 , 0.052549
aggregate: abs. difference, ratio: 631.002319 , 0.063027
Test sample 73
pressure: abs. difference, ratio: 114.368454 , 0.160116
velocity: abs. difference, ratio: 409.075867 , 0.044525
aggregate: abs. difference, ratio: 523.444336 , 0.052864
Test sample 74
pressure: abs. difference, ratio: 17.119675 , 0.056443
velocity: abs. difference, ratio: 65.643860 , 0.007557
aggregate: abs. difference, ratio: 82.763535 , 0.009207
Test sample 75
pressure: abs. difference, ratio: 27.077772 , 0.022747
velocity: abs. difference, ratio: 98.285736 , 0.010496
aggregate: abs. difference, ratio: 125.363510 , 0.011877
Test sample 76
pressure: abs. difference, ratio: 12.579189 , 0.047450
velocity: abs. difference, ratio: 41.150932 , 0.004783
aggregate: abs. difference, ratio: 53.730125 , 0.006059
Test sample 77
pressure: abs. difference, ratio: 47.669624 , 0.073946
velocity: abs. difference, ratio: 131.058517 , 0.014196
aggregate: abs. difference, ratio: 178.728149 , 0.018096
Test sample 78
pressure: abs. difference, ratio: 34.369064 , 0.069596
velocity: abs. difference, ratio: 109.658798 , 0.011937
aggregate: abs. difference, ratio: 144.027863 , 0.014878
Test sample 79
pressure: abs. difference, ratio: 70.092766 , 0.055162
velocity: abs. difference, ratio: 255.221466 , 0.025983
aggregate: abs. difference, ratio: 325.314240 , 0.029325
Test sample 80
pressure: abs. difference, ratio: 43.505470 , 0.087505
velocity: abs. difference, ratio: 144.530075 , 0.015722
aggregate: abs. difference, ratio: 188.035538 , 0.019405
Test sample 81
pressure: abs. difference, ratio: 212.001282 , 2.913883
velocity: abs. difference, ratio: 685.139648 , 0.083587
aggregate: abs. difference, ratio: 897.140930 , 0.108489
Test sample 82
pressure: abs. difference, ratio: 269.600311 , 0.262374
velocity: abs. difference, ratio: 799.176270 , 0.086034
aggregate: abs. difference, ratio: 1068.776611 , 0.103597
Test sample 83
pressure: abs. difference, ratio: 197.009125 , 0.828765
velocity: abs. difference, ratio: 700.400879 , 0.080130
aggregate: abs. difference, ratio: 897.410034 , 0.099950
Test sample 84
pressure: abs. difference, ratio: 11.614113 , 0.031601
velocity: abs. difference, ratio: 30.824902 , 0.003549
aggregate: abs. difference, ratio: 42.439018 , 0.004688
Test sample 85
pressure: abs. difference, ratio: 591.566895 , 0.663549
velocity: abs. difference, ratio: 1701.354370 , 0.173312
aggregate: abs. difference, ratio: 2292.921387 , 0.214127
Test sample 86
pressure: abs. difference, ratio: 611.477295 , 0.685693
velocity: abs. difference, ratio: 1781.136475 , 0.181536
aggregate: abs. difference, ratio: 2392.613770 , 0.223541
Test sample 87
pressure: abs. difference, ratio: 122.863495 , 0.126634
velocity: abs. difference, ratio: 162.909576 , 0.017511
aggregate: abs. difference, ratio: 285.773071 , 0.027817
Test sample 88
pressure: abs. difference, ratio: 9.603952 , 0.033885
velocity: abs. difference, ratio: 26.950329 , 0.003054
aggregate: abs. difference, ratio: 36.554283 , 0.004013
Test sample 89
pressure: abs. difference, ratio: 7.024361 , 0.028847
velocity: abs. difference, ratio: 27.973354 , 0.003218
aggregate: abs. difference, ratio: 34.997715 , 0.003917
Loss percentage (p, v, combined) (relative error): 14.640122 % 2.204290 % 2.691775 %
L1 error: 0.005441
Denormalized error: 0.012608
le 89
pressure: abs. difference, ratio: 7.024361 , 0.028847
velocity: abs. difference, ratio: 27.973354 , 0.003218
aggregate: abs. difference, ratio: 34.997715 , 0.003917
Loss percentage (p, v, combined) (relative error): 14.640122 % 2.204290 % 2.691775 %
L1 error: 0.005441
Denormalized error: 0.012608
5.代码结构
.
├── ckpt # 预训练模型文件
│ ├── SwinTransformer_modelG # 使用swin transformer模型进行训练
│ └── TurbNetG_modelG # 使用原论文模型进行训练
├── data
│ ├── dataGen.py # 数据生成脚本
│ ├── download_airfoils.sh # 下载机翼配置文件脚本
│ ├── OpenFOAM # openfoam配置文件
│ ├── shearAirfoils.py
│ └── utils.py
├── dataset # 数据集存放位置
│ ├── test
│ └── train
├── dataset.py # dataloader
├── DfpNet.py # 原论文模型
├── swin_transformer.py # swin transformer模型
├── test.py # 测试文件
├── train.py # 训练文件
└── utils.py
6.复现结果
6.1 精度对齐
复现后模型精度基本与论文报告精度保持一致。
针对模型TurbNetG模型(7.7m参数)
Validation loss | Test data L1 error | Test data relative error | |
---|---|---|---|
原论结果 | 0.004 | 0.0055 | 0.0026 |
复现结果 | 0.004 | 0.0054 | 0.0026 |
6.2 生成样本可视化展示
6.3 Swin Transformer精度
使用Swin Transformer能在参数缩减的情况下取得和TurbNetG几乎持平的效果。
同时受益于Swin Transformer架构,针对更大的数据,例如224224, 384384, 依旧能够保持良好的性能优势。
Validation loss | Test data L1 error | Test data relative error | |
---|---|---|---|
TurbNetG (30.9m参数) | 0.004 | 0.005 | 0.0024 |
Swin Transformer (10m参数) | 0.004 | 0.005 | 0.0025 |
7.模型信息
信息 | 说明 |
---|---|
发布者 | 朱卫国 (DrownFish19) |
发布时间 | 2023.03 |
框架版本 | paddle 2.4.1 |
支持硬件 | GPU、CPU |
aistudio | notebook |
请点击此处查看本环境基本用法.
Please click here for more detailed instructions.
此文章为搬运
原项目链接
更多推荐
所有评论(0)