def contf_plot(type, data): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) levels = np.linspace(-0.5, 0.5, 21) tools.plot_mesh(fault_mesh, show = False, fig_ax = (fig, ax)) im = ax.contourf(X, Y, data, levels) ax.contour(X, Y, data, levels, colors = ('k',), linestyles=['solid']) ax.set_ylabel(r'$x/d$', fontsize = 18) ax.set_xlabel(r'$y/d$', fontsize = 18) ax.set_title(type + ' displacement contours.') ax.set_xlim(min_x, max_x) ax.set_ylim(min_y, max_y) fig.colorbar(im)
fault_normal = np.array((fault_tangential[1], -fault_tangential[0])) # left_surface = np.array((-10.0, 0.0)) # right_surface = np.array((10.0, 0.0)) # mesh = simple_line_mesh(n_elements_surface, left_surface, right_surface) left_surface = np.array((-30.0, 0.0)) rise_begin = np.array((0.0, 0.0)) rise_end = np.array((3.0, 0.3)) right_surface = np.array((30.0, 0.3)) mesh1 = simple_line_mesh(n_elements_surface, left_surface, rise_begin) mesh2 = simple_line_mesh(n_elements_surface, rise_begin, rise_end) mesh3 = simple_line_mesh(n_elements_surface / 3, rise_end, right_surface) mesh = combine_meshes(mesh1, combine_meshes(mesh2, mesh3), ensure_continuity = True) tools.plot_mesh(mesh) plt.plot([x_di, x_df], [-di, -df], 'r-') plt.axis([-1.0, 4.0, -2.5, 2.5]) plt.xlabel(r'$x/d$', fontsize = 18) plt.ylabel(r'$y/d$', fontsize = 18) plt.text(0.50, 0.25, r'slope $\approx$ 6 degrees', rotation = 5.0) plt.text(-0.5, 0.05, 'flat') plt.text(3.3, 0.35, 'flat') plt.text(0.0, -0.4, 'Thrust fault (dip = 45 degrees)', rotation=-38) plt.suptitle('Geometry for topographic rise problem', fontsize = 18) plt.title('Total rise = 0.3 fault lengths.', fontsize = 16) plt.show() bf = basis_from_degree(degree) qs = QuadStrategy(mesh, quad_min, quad_max, quad_logr, quad_oneoverr) apply_to_elements(mesh, "basis", bf, non_gen = True)