tMade find_u operation OpenMP parallel - lbm-d3q19 - 3D lattice-Boltzmann code … | |
git clone git://src.adamsgaard.dk/lbm-d3q19 | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit b76cc7f8ed01abbed03e020b96b72e66c6407ecc | |
parent 1e0a6e6406bfb66a9c64fb94e8370ea2513ecea7 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Sun, 22 Sep 2013 17:19:06 +0200 | |
Made find_u operation OpenMP parallel | |
Diffstat: | |
M Makefile | 2 +- | |
M lbm.c | 8 +++----- | |
2 files changed, 4 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
t@@ -1,4 +1,4 @@ | |
-CFLAGS=-g -Wall -pg -O2 | |
+CFLAGS=-g -Wall -pg -O2 -fopenmp | |
LDLIBS=-lm | |
BIN=lbm | |
diff --git a/lbm.c b/lbm.c | |
t@@ -2,10 +2,6 @@ | |
#include <stdlib.h> // dynamic allocation | |
#include <math.h> | |
-// Courant kriterie for tidsskridt | |
-// No slip top og bund | |
-// Periodiske sider | |
- | |
// Floating point precision | |
//typedef float Float; | |
typedef double Float; | |
t@@ -40,7 +36,7 @@ const int m = 19; | |
// Time step length | |
//const double dt = 1.0; | |
const double dt = 1.0e-3; | |
-//const double dt = 0.01; | |
+//const double dt = 1.0e-6; | |
// Simulation end time | |
//const Float t_end = 1.5e-4; | |
t@@ -250,6 +246,7 @@ Float3 find_u( | |
Float3 u = {0.0, 0.0, 0.0}; | |
Float f_i; | |
unsigned int i; | |
+#pragma omp parallel for private(f_i,u) | |
for (i=0; i<m; i++) { | |
f_i = f[idxi(x,y,z,i)]; | |
u.x += f_i*e[i].x/rho; | |
t@@ -299,6 +296,7 @@ void collide( | |
u[idx(x,y,z)] = u_new; | |
// Find new f values by fluid particle collision | |
+//#pragma omp parallel for | |
for (i=0; i<m; i++) { | |
f[idxi(x,y,z,i)] = | |
bgk(f[idxi(x,y,z,i)], tau(), rho_new, |