Commit 97f21ac2 authored by ph's avatar ph
parents 89ae6c85 4c691bf5
......@@ -11,6 +11,8 @@
#define _WBORD _wbord_
#define _VOL (_DX * _DY)
__constant int dir[4][2] = { {1, 0}, {-1, 0},
......@@ -87,7 +89,8 @@ __kernel void time_step(__global float *wn, __global float *wnp1){
wnow[iv] = wn[imem];
wnext[iv] = wnow[iv];
}
// only compute internal cells
if (i > 0 && i < _NX - 1 && j > 0 && j < _NY - 1){
float flux[_M];
......@@ -102,33 +105,29 @@ __kernel void time_step(__global float *wn, __global float *wnp1){
vn[1] = dir[idir][1];
int iR = i + dir[idir][0];
int jR = j + dir[idir][1];
// load neighbour values if accessible
// load neighbour values
float wR[_M];
for(int iv = 0; iv < _M; iv++) wR[iv] = _WBORD;
// if ((iR >= 0) && (iR <= _NX - 1) && (jR >= 0) && (jR <= _NY - 1)){
for(int iv = 0; iv < _M; iv++){
int imem = iv * ngrid + iR + jR * _NX;
wR[iv] = wn[imem];
}
//}
fluxnum(wnow, wR, vn, flux);
// time evolution
for(int iv = 0; iv < _M; iv++){
wnext[iv] -= _DT * ds[idir] / _VOL * flux[iv];
}
}
}
}
} // end test for internal cells
// copy wnext into global memory
// (including boundary cells)
for(int iv = 0; iv < _M; iv++){
int imem = iv * ngrid + i + j * _NX;
wnp1[imem] = wnext[iv];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment