예제 #1
0
fig, ax = plt.subplots()
clf = ax.pcolor(x, y, np.abs(err), vmin=1e-5, norm=mpl.colors.LogNorm())
plt.plot(new_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()
cerr.plot(ax, vmin=1e-5, norm=mpl.colors.LogNorm())
예제 #2
0
        # c_new.grid_value[new_ebdyc.phys_not_in_annulus] = ch[:gp.N]
        # # set the radial values
        # c_new.radial_value_list[0][:] = ch[gp.N:].reshape(ebdy.radial_shape)
        # bb = c_new.radial_value_list[0][-1].copy()

        # visualize fc3n
        if False:
            fig, ax = plt.subplots()
            is_fc3 = EmbeddedFunction(new_ebdyc)
            is_fc3_grid = np.zeros(x.shape, dtype=bool)
            is_fc3_grid[new_ebdyc.phys] = fc3[:gp.N]
            is_fc3_radial = fc3[gp.N:].reshape(new_ebdy.radial_shape)
            is_fc3.load_data(is_fc3_grid, [
                is_fc3_radial,
            ])
            clf = is_fc3.plot(ax)
            for bb, col in zip([new_ebdyc, ebdyc, ebdyc_old],
                               ['red', 'pink', 'gray']):
                bbb = bb.ebdys[0].bdy
                ax.plot(bbb.x, bbb.y, color=col)
            ax.scatter(new_ebdyc.ebdys[0].radial_x,
                       new_ebdyc.ebdys[0].radial_y,
                       color='white')

    # now reset naming conventions
    try:
        ebdy_old_save = ebdy_old
        ebdyc_old_save = ebdyc_old
        c_old_save = c_old
    except:
        pass
예제 #3
0
	# set the radial values
	c_new.radial_value_list[0][:] = ch[gp.N:].reshape(ebdy.radial_shape)
	# merge the grid and the radial values where they overlap
	new_ebdyc.merge_grids(c_new)
	# overwrite under grid under annulus by radial grid
	# _ = new_ebdyc.interpolate_radial_to_grid(c_new.radial_value_list, c_new.grid_value)

	# visualize fc3n
	if False:
		fig, ax = plt.subplots()
		is_fc3 = EmbeddedFunction(new_ebdyc)
		is_fc3_grid = np.zeros(x.shape, dtype=bool)
		is_fc3_grid[new_ebdyc.phys] = fc3[:gp.N]
		is_fc3_radial = fc3[gp.N:].reshape(new_ebdy.radial_shape)
		is_fc3.load_data(is_fc3_grid, [is_fc3_radial,])
		clf = is_fc3.plot(ax)
		for bb, col in zip([new_ebdyc, ebdyc], ['red', 'pink', 'gray']):
			bbb = bb.ebdys[0].bdy
			ax.plot(bbb.x, bbb.y, color=col)
		ax.scatter(new_ebdyc.ebdys[0].radial_x, new_ebdyc.ebdys[0].radial_y, color='white')

	# now reset naming conventions
	old_ebdy = ebdy
	old_ebdyc = ebdyc
	ebdy = new_ebdy
	ebdyc = new_ebdyc
	c = c_new

	# assess error on underlying grid
	err = (np.abs(c.grid_value - ce)*ebdyc.phys).max()