# fig, ax = plt.subplots()
# clf = ax.pcolor(x, y, np.abs(err), vmin=1e-5, norm=mpl.colors.LogNorm())
# plt.plot(ebdy.bdy.x, ebdy.bdy.y, color='red')
# plt.colorbar(clf)

print('On grid:            {:0.1e}'.format(merr))

# assess error in position
err_bx = np.abs(bxe - ebdy.bdy.x)
err_by = np.abs(bye - ebdy.bdy.y)
err_b = max(err_bx.max(), err_by.max())

print('Boundary motion is: {:0.1e}'.format(err_b))

# assess on radial grid (via NUFFT of eulerian solution)
cr = ebdy.interpolate_grid_to_radial(c_eulerian)
err_r = np.abs(cr - c.radial_value_list[0])
merr_r = err_r.max()

print('On radial grid:     {:0.1e}'.format(merr_r))

# plot the errors properly...
cerr = EmbeddedFunction(ebdyc)
cerr.load_data(err, [
    err_r,
])

fig, ax = plt.subplots()
clf = (cerr + 1e-15).plot(ax)  #, norm=mpl.colors.SymLogNorm(1e-10))
plt.colorbar(clf)
for xtr, ytr in zip(x_tracers, y_tracers):
Exemplo n.º 2
0
ax.scatter(ebdy.interface.x, ebdy.interface.y, color='gray', s=10, label='interface')
ax.legend()
ax.set_title('Special Coordinates')

################################################################################
# Test interpolation operations

k = 2*np.pi/3
test_func = lambda x, y: np.exp(np.sin(k*x))*np.sin(k*y)
test_func_x = lambda x, y: k*np.exp(np.sin(k*x))*np.cos(k*x)*np.sin(k*y)
test_func_y = lambda x, y: k*np.exp(np.sin(k*x))*np.cos(k*y)

# Interpolation of a globally smooth function on grid to radial
f = test_func(grid.xg, grid.yg)
fr = test_func(ebdy.radial_x, ebdy.radial_y)
fe = ebdy.interpolate_grid_to_radial(f, order=5)
err = np.abs(fe-fr).max()
print('Error in grid --> radial interpolation:    {:0.2e}'.format(err))

# Interpolation of a function to the interface
fr = test_func(ebdy.interface.x, ebdy.interface.y)
fe = ebdy.interpolate_grid_to_interface(f, order=5)
err = np.abs(fe-fr).max()
print('Error in grid --> interface interpolation: {:0.2e}'.format(err))

# Interpolation of a function from radial to grid
fr = test_func(ebdy.radial_x, ebdy.radial_y)
ft = ebdy.interpolate_radial_to_grid(fr)
fe = test_func(ebdy.grid_ia_x, ebdy.grid_ia_y)
err = np.abs(fe-ft).max()
print('Error in radial --> grid interpolation:    {:0.2e}'.format(err))