|
3 | 3 |
|
4 | 4 | import numpy as np
|
5 | 5 | import scipy.linalg as la
|
| 6 | +import matplotlib.pyplot as plt |
6 | 7 | from time import time
|
7 | 8 |
|
8 | 9 | import bempp.api as bem
|
|
12 | 13 |
|
13 | 14 | lmbda = 0.5
|
14 | 15 | kRef = 2 * np.pi / lmbda
|
| 16 | +print('KRef:', kRef) |
15 | 17 |
|
16 | 18 | #meshname = 'geo/mtf-logo.msh'
|
17 | 19 | meshname = 'geo/rings.msh'
|
|
69 | 71 | #################################################
|
70 | 72 |
|
71 | 73 | def dir_data(x, normal, dom_ind, result):
|
72 |
| - result[0] = -np.exp( 1j * kRef * x[1]) |
| 74 | + result[0] = -np.exp( 1j * kRef * x[0]) |
73 | 75 |
|
74 | 76 | def neu_data(x, normal, dom_ind, result):
|
75 |
| - result[0] = -1j * normal[1] * kRef * np.exp( 1j * kRef * x[1]) |
| 77 | + result[0] = -1j * normal[0] * kRef * np.exp( 1j * kRef * x[0]) |
76 | 78 |
|
77 | 79 | #################################################
|
78 | 80 | #################################################
|
@@ -169,3 +171,26 @@ def rescaleRes(res, P, b):
|
169 | 171 | bem.export(grid_function=gsold,
|
170 | 172 | file_name="soldI.msh",
|
171 | 173 | transformation=np.imag)
|
| 174 | + |
| 175 | +print('solution saved.') |
| 176 | + |
| 177 | +# Nx = 200 |
| 178 | +# Ny = 200 |
| 179 | +# xmin, xmax, ymin, ymax = [-0.5, 4.5, -0.5, 1.5] |
| 180 | +# plot_grid = np.mgrid[xmin:xmax:Nx * 1j, ymin:ymax:Ny * 1j] |
| 181 | +# points = np.vstack((plot_grid[0].ravel(), |
| 182 | +# plot_grid[1].ravel(), |
| 183 | +# np.zeros(plot_grid[0].size))) |
| 184 | +# u = np.zeros(points.shape[1], dtype=np.complex) |
| 185 | +# u[:] = np.nan |
| 186 | + |
| 187 | +# slp = bem.operators.potential.helmholtz.single_layer( |
| 188 | +# space, points, kRef) |
| 189 | +# dlp = bem.operators.potential.helmholtz.double_layer( |
| 190 | +# space, points, kRef) |
| 191 | +# u = slp * gsoln - dlp * gsoln |
| 192 | + |
| 193 | +# uu = u.reshape((Nx, Ny)) |
| 194 | +# plt.imshow(np.real(uu.T), extent=[xmin, xmax, ymin, ymax]) |
| 195 | +# plt.colorbar() |
| 196 | +# plt.show() |
0 commit comments