Commit cd081a59 authored by helluy's avatar helluy

up

parent 7c8ba864
......@@ -25,8 +25,8 @@ _n = 4 * _m
_ivplot = 0
# grid size
_nx = 1024
_ny = 1024
_nx = 256
_ny = 256
_Lx = 1
_Ly = 1
......@@ -113,6 +113,7 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
event = prg.init_sol(queue, (nx * ny, ), (32, ), fnp1_gpu)
event.wait()
queue.finish()
# number of animation frames
nbplots = 100
itermax = int(np.floor(Tmax / dt))
......@@ -133,9 +134,10 @@ def solve_ocl(m = _m, n = _n, nx = _nx, ny = _ny,
while t < Tmax:
t = t + dt
#event = prg.time_step(queue, (nx * ny, ), (32, ), wn_gpu, wnp1_gpu)
event = prg.time_step(queue, (nx * ny, ), (64, ), fn_gpu, fnp1_gpu)
event = prg.time_step(queue, (nx * ny, ), (32, ), fn_gpu, fnp1_gpu)
#event = prg.time_step(queue, (nx * ny, ), (32, ), wn_gpu, wnp1_gpu, wait_for = [event])
event.wait()
queue.finish()
elapsed += 1e-9 * (event.profile.end - event.profile.start)
# exchange buffer references for avoiding a copy
fn_gpu, fnp1_gpu = fnp1_gpu, fn_gpu
......
......@@ -26,6 +26,7 @@ __constant int dir[4][2] = { {-1, 0}, {1, 0},
__constant real ds[4] = { _DY, _DY, _DX, _DX };
// physical flux of the hyperbolic system
/* void flux_phy(const real *w, const real* vnorm, real* flux){ */
/* real vdotn = _VX * vnorm[0] + _VY * vnorm[1]; */
......@@ -74,7 +75,7 @@ void flux_phy(const real *W, const real *vn, real *flux) {
void w2f(const real *w, real *f){
for(int d = 0; d < 4; d++){
real flux[_M];
real vnorm[2] = {dir[d][0], dir[d][1]};
real vnorm[2] = {(real) dir[d][0], (real) dir[d][1]};
flux_phy(w, vnorm, flux);
for(int iv = 0; iv < _M; iv++){
f[d * _M + iv] = w[iv] / 4 + flux[iv] / 2 / _LAMBDA;
......
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