1) https://github.com/yskmt/navier_stokes_multigrid 这个代码直接 可以编译运行 2) 如何运行: ./multigrid multigrid [# of threads] [max level] [I_size] [J_size] [K_size] 写得很清楚 3) 运行命令 ./multigrid 4 3 16 16 16 需要带参数 4线程结果 level: 3 n_dof: 8 create finite difference matrix convergence reached after 51 iterations post-smoothing 1000000000 times on level 2 convergence reached after 974 iterations post-smoothing 1000000000 times on level 1 convergence reached after 12975 iterations post-smoothing 1000000000 times on level 0 convergence reached after 137608 iterations advection time: 0.00327898 viscosity time: 0.419935 pressure time: 48.7225 total time: 49.2826 with 4 threads 4) ./multigrid 1 3 16 16 16 post-smoothing 1000000000 times on level 2 convergence reached after 974 iterations post-smoothing 1000000000 times on level 1 convergence reached after 12975 iterations post-smoothing 1000000000 times on level 0 convergence reached after 137608 iterations advection time: 0.00645429 viscosity time: 1.16773 pressure time: 182.543 total time: 183.849 with 1 threads 可见多线程提升计算速度很快。 |
说点什么...