def get_section_j(geom, ms, plot_geom=False): geom.create_mesh(mesh_sizes=[ms]) section = Section(geom) if plot_geom: section.plot_mesh() section.calculate_geometric_properties() section.calculate_warping_properties() return section.get_j()
# %% # Loop through all the widths for b in b_list: # calculate d assuming area = 1 d = 1 / b d_list.append(d) # compute mesh size ms = d * b / n # perform a warping analysis on rectangle geometry = sections.rectangular_section(d=d, b=b) geometry.create_mesh(mesh_sizes=[ms]) section = Section(geometry) section.calculate_geometric_properties() section.calculate_warping_properties() # get the torsion constant j = section.get_j() print("d/b = {0:.3f}; J = {1:.5e}".format(d / b, j)) j_list.append(j) # %% # Plot the torsion constant as a function of the aspect ratio (fig, ax) = plt.subplots() ax.plot(np.array(d_list) / b_list, j_list, "kx-") ax.set_xlabel("Aspect Ratio [d/b]") ax.set_ylabel("Torsion Constant [J]") ax.set_title("Rectangular Section Torsion Constant") plt.show()
nr_results = [] nr_elements = [] # %% # Calculate reference solution geometry = steel_sections.i_section(d=203, b=133, t_f=7.8, t_w=5.8, r=8.9, n_r=32) geometry.create_mesh(mesh_sizes=[5]) # create mesh section = Section(geometry) # create a Section object section.calculate_geometric_properties() section.calculate_warping_properties() j_reference = section.get_j() # get the torsion constant # %% # Run through mesh_sizes with n_r = 8 for mesh_size in mesh_size_list: geometry = steel_sections.i_section(d=203, b=133, t_f=7.8, t_w=5.8, r=8.9, n_r=8) geometry.create_mesh(mesh_sizes=[mesh_size]) # create mesh section = Section(geometry) # create a Section object section.calculate_geometric_properties() section.calculate_warping_properties()