x1 = (sum(N17)*1.0)*scale_x print('x1 = {}'.format(x1)) y1 = ((sum(M19)+sum(M18))*1.0)*(c_y_wanted/y_alpha/ymax) print('y1 = {}'.format(y1)) x2 = ((sum(N17)+sum(N16)+sum(N6))*1.0)*scale_x print('x2 = {}'.format(x1)) y2 = ((sum(M19)+sum(M18)+sum(M12)+sum(M17))*1.0)*(c_y_wanted/y_alpha/ymax) print('y2 = {}'.format(y1)) important_points = np.array([[x1, y1],[x2, y2]]) helper.write_matrix_to_file(important_points, 'data/important_points.txt') wx1 = ((sum(N17)+sum(N16)+sum(N6)-15)*1.0)*scale_x wy1 = ((sum(M19))*1.0)*(c_y_wanted/y_alpha/ymax) wx2 = ((sum(N17)+sum(N16)+sum(N6)+sum(N7)-15)*1.0)*scale_x wy2 = ((sum(M19)+sum(M18)+sum(M12)+sum(M17)+sum(M12))*1.0)*(c_y_wanted/y_alpha/ymax) important_window = np.array([[wx1, wy1],[wx2, wy2]]) helper.write_matrix_to_file(important_window, 'data/window.txt') nodes_to_coordinates[:,0] = nodes_to_coordinates[:,0] *scale_x
# energy += adJ_r/dJ_r**2 * numeric.gauss_2D_3(integrand) #print(adJ_r/dJ_r**2 * numeric.gauss_2D_3(integrand)) energy += energy_i C_ = energy / (1 - (-1))**2 #C_ = energy/(1)**2 print('C_ = ' + str(C_)) print('C_inf = ' + str(eps * 10 * 0.1 / 0.02)) # ------ PLOT CODE ------ if False: with Timer('plotting'): # helper.write_matrix_to_file(energies, 'data/energies.txt') emax = energies.max() emin = energies.min() e_tmp = energies #/ emax fig = plt.figure() ax = plt.gca() from matplotlib.patches import Ellipse, Polygon ax.fill([-10, 90, 90, -10], [-10, -10, 70, 70], fill=True, color='b') for r in range(0, N_fe): i1 = local_to_global[r, 0]
def run(): data = Data() with Timer('preparation'): #create element_table #data.tables.element_table = preparation.create_element_table(data.info) #unused? import build_backup as build #import build_viertel as build #import build_neumann as build #import build_ladung as build data.info.elements_per_line = -1 data.info.number_of_elements = build.get_number_of_elements() data.info.nodes_per_element = build.get_nodes_per_element() data.info.number_of_nodes = build.get_number_of_nodes() #create local_to_global table #data.tables.local_to_global = preparation.create_local_to_global(data.info) data.tables.local_to_global = build.get_local_to_global().copy() #create nodes_to_coordinates #data.tables.nodes_to_coordinates = preparation.create_nodes_to_coordinates(data.info) data.tables.nodes_to_coordinates = build.get_nodes_to_coordinates().copy() #print data.tables.nodes_to_coordinates #neumann #data.tables.edge_to_global = build.get_edge_to_global().copy() #create boundary_table #data.tables.boundary_table = preparation.create_boundary_table(data.info) data.tables.boundary_table = build.get_boundary_table().copy() helper.write_matrix_to_file(data.tables.local_to_global, 'data/local_to_global.txt') helper.write_matrix_to_file(data.tables.nodes_to_coordinates, 'data/nodes_to_coordinates.txt') helper.write_matrix_to_file(data.tables.boundary_table, 'data/boundary_table.txt') with Timer('assembly'): #assemble equations data.equ = assembly.assemble_equations(data.info, data.tables) pass with Timer('solve'): #solve equations data.equ.u_h = solve.solve(data.equ) helper.write_matrix_to_file(data.equ.u_h, 'data/u_h.txt') print(data.equ.u_h) with Timer('plots'): #generate plot_data # data.plots.xx, data.plots.yy, data.plots.zz = plots.generate_plot_data(data.info, # data.tables, data.plots, data.equ.u_h) #plots.contour_plot(data.info, data.tables, data.plots, data.equ.u_h) plots.contour_plot_new(data.info, data.tables, data.plots, data.equ.u_h) #plots.fe_plot(data.info, data.tables, data.plots) pass
def run(): data = Data() with Timer('preparation'): #create element_table #data.tables.element_table = preparation.create_element_table(data.info) #unused? import build_backup as build #import build_viertel as build #import build_neumann as build #import build_ladung as build data.info.elements_per_line = -1 data.info.number_of_elements = build.get_number_of_elements() data.info.nodes_per_element = build.get_nodes_per_element() data.info.number_of_nodes = build.get_number_of_nodes() #create local_to_global table #data.tables.local_to_global = preparation.create_local_to_global(data.info) data.tables.local_to_global = build.get_local_to_global().copy() #create nodes_to_coordinates #data.tables.nodes_to_coordinates = preparation.create_nodes_to_coordinates(data.info) data.tables.nodes_to_coordinates = build.get_nodes_to_coordinates( ).copy() #print data.tables.nodes_to_coordinates #neumann #data.tables.edge_to_global = build.get_edge_to_global().copy() #create boundary_table #data.tables.boundary_table = preparation.create_boundary_table(data.info) data.tables.boundary_table = build.get_boundary_table().copy() helper.write_matrix_to_file(data.tables.local_to_global, 'data/local_to_global.txt') helper.write_matrix_to_file(data.tables.nodes_to_coordinates, 'data/nodes_to_coordinates.txt') helper.write_matrix_to_file(data.tables.boundary_table, 'data/boundary_table.txt') with Timer('assembly'): #assemble equations data.equ = assembly.assemble_equations(data.info, data.tables) pass with Timer('solve'): #solve equations data.equ.u_h = solve.solve(data.equ) helper.write_matrix_to_file(data.equ.u_h, 'data/u_h.txt') print(data.equ.u_h) with Timer('plots'): #generate plot_data # data.plots.xx, data.plots.yy, data.plots.zz = plots.generate_plot_data(data.info, # data.tables, data.plots, data.equ.u_h) #plots.contour_plot(data.info, data.tables, data.plots, data.equ.u_h) plots.contour_plot_new(data.info, data.tables, data.plots, data.equ.u_h) #plots.fe_plot(data.info, data.tables, data.plots) pass
C_ = energy/(1-(-1))**2 #C_ = energy/(1)**2 print('C_ = ' + str(C_)) print('C_inf = ' + str(eps*10*0.1/0.02)) # ------ PLOT CODE ------ if False: with Timer('plotting'): # helper.write_matrix_to_file(energies, 'data/energies.txt') emax = energies.max() emin = energies.min() e_tmp = energies #/ emax fig = plt.figure() ax = plt.gca() from matplotlib.patches import Ellipse, Polygon ax.fill([-10,90,90,-10],[-10,-10,70,70], fill=True, color='b') for r in range(0, N_fe):