Commit 72c1b75f authored by Matthieu Boileau's avatar Matthieu Boileau

Add orszag-tang_v100.ipynb

parent ed1e7145
......@@ -15,6 +15,7 @@
//#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#include "vortex_kernels.h"
#define real _real_
#define _NX _nx_
......
void flux_phy(const real *W, const real *vn, real *flux);
......@@ -20,6 +20,7 @@ from utils import Figure, float2str, load_kernel, parse_cl_args, get_ite_title
# matplotlib.use('Agg')
#from matplotlib import rcParams
prec = {'single': 'float', 'double': 'double'}
# Default values
......@@ -101,7 +102,8 @@ def solve_ocl(m=_m, n=_n, nx=_nx, ny=_ny, Lx=_Lx, Ly=_Ly, Tmax=_Tmax,
mf = cl.mem_flags
# compile OpenCL C program
prg = cl.Program(ctx, source).build(options="")
prg = cl.Program(ctx, source).build(options=["-I .",
f"-D real={prec[precision]}"])
# create OpenCL buffers
buffer_size = 4 * m * nx * ny * np.dtype(np_real).itemsize
......@@ -169,13 +171,15 @@ def solve_ocl(m=_m, n=_n, nx=_nx, ny=_ny, Lx=_Lx, Ly=_Ly, Tmax=_Tmax,
wplot = np.reshape(fn_cpu, (4, m, ncprx, ncpry))
fig.update(x, y, np.sum(
wplot[:, _ivplot, :, :], axis=0), suptitle=ite_title, cb=ite == 0)
if np.isnan(np.sum(kinetic_cpu)):
exit(f"Nan in kinetic_cpu at ite {ite}")
else:
print("L2 norm =", np.sqrt(np.sum(kinetic_cpu)/Lx/Ly))
fig.update(x, y, np.sum(
wplot[:, _ivplot, :, :], axis=0), suptitle=ite_title, cb=ite == 0)
else:
print(ite_title, end='\r')
......
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