-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in Dipole and Wire sources #348
Comments
The problem lies in the function It works if:
It does NOT work if:
NEEDS FIXING |
Current Work-AroundRefine your source by adding enough points so that the wire points are never further away than one cell. If Here is an example function that you can use to refine your source: def refine(source):
pts = source.points
new_pts = np.zeros((pts.shape[0]*2-1, 3))
for i in range(pts.shape[0]-1):
new_pts[2*i, :] = pts[i, :]
new_pts[2*i+1, :] = (pts[i, :] + pts[i+1, :]) / 2
new_pts[-1, :] = pts[-1, :]
return emg3d.TxElectricWire(new_pts) The above example needs four times refining, after which there is no more warning and the source is correct: new_src = source
for i in range(4):
new_src = refine(new_src)
print(new_src.points)
sfield = emg3d.get_source_field(grid, new_src, frequency)
sfield.grid.plot_3d_slicer(sfield.fx.ravel('F'), view='abs', v_type='Ex', pcolor_opts={'norm': LogNorm()}) The output from the printing: [[-1000. 1000. 0.]
[ -875. 875. 0.]
[ -750. 750. 0.]
[ -625. 625. 0.]
[ -500. 500. 0.]
[ -375. 375. 0.]
[ -250. 250. 0.]
[ -125. 125. 0.]
[ 0. 0. 0.]
[ 125. -125. 0.]
[ 250. -250. 0.]
[ 375. -375. 0.]
[ 500. -500. 0.]
[ 625. -625. 0.]
[ 750. -750. 0.]
[ 875. -875. 0.]
[ 1000. -1000. 0.]] |
Horrible bug in Dipole and Wire sources
Output:
The text was updated successfully, but these errors were encountered: