From 479d4782df70a5e4bf9f228b7af5bf3273aa8a0d Mon Sep 17 00:00:00 2001 From: George Bisbas Date: Wed, 19 Jul 2023 17:20:00 +0100 Subject: [PATCH] bench: more cleanup --- fast/diffusion_2D_wBCs.py | 6 ++---- fast/diffusion_3D_wBCs.py | 7 ++++--- fast/nd_nwave_devito_nodamp.py | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fast/diffusion_2D_wBCs.py b/fast/diffusion_2D_wBCs.py index 1515b9632c..0de0340254 100644 --- a/fast/diffusion_2D_wBCs.py +++ b/fast/diffusion_2D_wBCs.py @@ -56,16 +56,14 @@ t = grid.stepping_dim initdata = u.data[:] -op = Operator([eq_stencil]) +op = Operator([eq_stencil], name='DevitoOperator') op.apply(time=nt, dt=dt, a=nu) print("Devito Field norm is:", norm(u)) -# plot_image(u.data[0], cmap="seismic") - # Reset data and run XDSLOperator init_hat(field=u.data[0], dx=dx, dy=dy, value=1.) -xdslop = XDSLOperator([eq_stencil]) +xdslop = XDSLOperator([eq_stencil], name='XDSLOperator') xdslop.apply(time=nt, dt=dt, a=nu) print("XDSL Field norm is:", norm(u)) diff --git a/fast/diffusion_3D_wBCs.py b/fast/diffusion_3D_wBCs.py index 88e56363b9..9f225efe42 100644 --- a/fast/diffusion_3D_wBCs.py +++ b/fast/diffusion_3D_wBCs.py @@ -65,7 +65,8 @@ def plot_3dfunc(u): a = Constant(name='a') # Create an equation with second-order derivatives -eq = Eq(u.dt, a * u.laplace, subdomain=grid.interior) +eq = Eq(u.dt, a * u.laplace) + stencil = solve(eq, u.forward) eq_stencil = Eq(u.forward, stencil) @@ -76,7 +77,7 @@ def plot_3dfunc(u): print(eq_stencil) # Create Operator -op = Operator([eq_stencil]) +op = Operator([eq_stencil], name='DevitoOperator') # Apply the operator for a number of timesteps op.apply(time=nt, dt=dt, a=nu) print("Devito Field norm is:", norm(u)) @@ -84,7 +85,7 @@ def plot_3dfunc(u): # Reset field u.data[:, :, :, :] = 0 u.data[:, :, :, int(nz/2)] = 1 -xdslop = XDSLOperator([eq_stencil]) +xdslop = XDSLOperator([eq_stencil], name='xDSLOperator') # Apply the xdsl operator for a number of timesteps xdslop.apply(time=nt, dt=dt, a=nu) diff --git a/fast/nd_nwave_devito_nodamp.py b/fast/nd_nwave_devito_nodamp.py index 0806783211..1c44b38e7f 100644 --- a/fast/nd_nwave_devito_nodamp.py +++ b/fast/nd_nwave_devito_nodamp.py @@ -104,7 +104,7 @@ def plot_3dfunc(u): # the corresponding code print(time_range) src_term = src.inject(field=u.forward, expr=src * dt**2 / model.m) -op = Operator([stencil] + src_term, subs=model.spacing_map) +op = Operator([stencil] + src_term, subs=model.spacing_map, name='DevitoOperator') # Run with source and plot op.apply(time=time_range.num-1, dt=model.critical_dt) @@ -115,7 +115,7 @@ def plot_3dfunc(u): initdata = u.data[:] # Run more with no sources now (Not supported in xdsl) -xdslop = XDSLOperator([stencil]) +xdslop = XDSLOperator([stencil], name='XDSLOperator') xdslop.apply(time=time_range.num-1, dt=model.critical_dt) if len(shape) == 3: