From eb4d9be6cfb57d2206bcaa5d80680aa0b813d316 Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 4 Jul 2016 16:35:28 -0700 Subject: [PATCH] use opencl solver (for testing) --- examples/test.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/test.py b/examples/test.py index 098f797..c7b3db3 100644 --- a/examples/test.py +++ b/examples/test.py @@ -10,6 +10,8 @@ import gridlock from matplotlib import pyplot +from opencl_fdfd import cg_solver + __author__ = 'Jan Petykiewicz' @@ -185,16 +187,25 @@ def test1(): # pmcg.draw_cuboid(center=[700, 0, 0], dimensions=[80, 1e8, 1e8], eps=1) # pmcg.visualize_isosurface() + ''' + Solve! + ''' A = fdfd_tools.operators.e_full(omega, dxes, epsilon=vec(grid.grids), pec=vec(pecg.grids), pmc=vec(pmcg.grids)).tocsr() b = -1j * omega * vec(J) - x = solve_A(A, b) + # x = solve_A(A, b) + + x = cg_solver(omega, dxes, J=vec(J), epsilon=vec(grid.grids), + pec=vec(pecg.grids), pmc=vec(pmcg.grids)) E = unvec(x, grid.shape) print('Norm of the residual is ', numpy.linalg.norm(A @ x - b)) + ''' + Plot results + ''' def pcolor(v): vmax = numpy.max(numpy.abs(v)) pyplot.pcolor(v, cmap='seismic', vmin=-vmax, vmax=vmax)