Exemplo n.º 1
0
class Z_Section:
    """
    This is basically just a fixture for testing purposes.
    It's called by the actual pytest fixtures to generate
    the Z-sections for analysis.

    We have this class for fixtures, just to have
    a method for the load application, and simpler fixtures,
    along with the same base for multiple Z_Sections.
    """
    def __init__(self, DIM1, DIM2, DIM3, DIM4, shift, m, name):
        # Setup the analysis, and calculate properties
        base_geom = nastran_sections.nastran_zed(DIM1, DIM2, DIM3, DIM4)
        self.geom = base_geom.shift_section(*shift)
        self.geom = self.geom.create_mesh(mesh_sizes=[m])
        self.xsect = Section(self.geom)
        self.xsect.calculate_geometric_properties()
        # This plotting code was just for verifying the section offsets.
        # ax = self.xsect.plot_centroids(pause=False, render=False)
        # ax.grid(1, which='both', linestyle=':')
        # fig = ax.get_figure()
        # fig.savefig(f'{name}_geom.png')

    def apply_load(self, v):
        """
        This method applies the suplied load to the section.
        v is a list-like with the first entry being Mxx, and
        second entry Myy.
        """
        self.xsect.calculate_warping_properties()
        self.stress = self.xsect.calculate_stress(Mxx=v[0], Myy=v[1])
Exemplo n.º 2
0
comp_section = Section(section_geometry, time_info=True)
comp_section.display_mesh_info()  # display the mesh information

# %%
# Plot the mesh with coloured materials and a line transparency of 0.6
comp_section.plot_mesh(materials=True, alpha=0.6)

# %%
# Perform a geometric, warping and plastic analysis
comp_section.calculate_geometric_properties()
comp_section.calculate_warping_properties()
comp_section.calculate_plastic_properties(verbose=True)

# %%
# Perform a stress analysis with N = 100 kN, Mxx = 120 kN.m and Vy = 75 kN
stress_post = comp_section.calculate_stress(N=-100e3, Mxx=-120e6, Vy=-75e3)

# %%
# Print the results to the terminal
comp_section.display_results()

# %%
# Plot the centroids
comp_section.plot_centroids()

# %%
# Plot the axial stress
stress_post.plot_stress_n_zz(pause=False)

# %%
# Plot the bending stress
Exemplo n.º 3
0
# but sectionproperties needs them before evaluating stress.
section.calculate_geometric_properties()
section.calculate_warping_properties()
section.plot_centroids()

# %%
# Directly from the example, we know that the 2nd moment of inertia
# resisting the bending is 43.3 in\ :sup:`4`.
section.section_props.ixx_g

# %%
# From statics, we know the max bending moment on the beam will
# be 80,000 in-lbs. We can apply this moment to the section, and
# evaluate stress.
moment = 8e5
stress = section.calculate_stress(Mxx=moment)

# %%
# Next we can extract the max stress from the section, and let's
# go ahead and look at the calculated fringe plot. Refer to the
# stress example for details.
numerical_result = max(stress.get_stress()[0]["sig_zz"])
stress.plot_stress_zz()

# %%
# From the book, and simple statics, we know the max stress is
# 55,427.3 psi.
numerical_result

# %%
# This example is admittedly more simple, but it's still a nice
# in a 2x2 subplot arrangement.
geometry = steel_sections.rectangular_hollow_section(d=100,
                                                     b=100,
                                                     t=6,
                                                     r_out=15,
                                                     n_r=8)

# Plot the geometry
ax = geometry.plot_geometry(nrows=2,
                            ncols=2,
                            figsize=(12, 7),
                            render=False,
                            labels=[])
fig = ax.get_figure()  # get the figure

# Create a mesh and section object, for the mesh, use a maximum area of 2
geometry.create_mesh(mesh_sizes=[2])
section = Section(geometry)
section.plot_mesh(ax=fig.axes[1], materials=False)  # plot the mesh

# Perform a geometry and warping analysis
section.calculate_geometric_properties()
section.calculate_warping_properties()
section.plot_centroids(ax=fig.axes[2])  # plot the cetnroids

# Perform a stress analysis with Mzz = 10 kN.m
stress = section.calculate_stress(Mzz=10e6)
stress.plot_vector_mzz_zxy(ax=fig.axes[3],
                           title="Torsion Vectors")  # plot the torsion vectors
plt.show()  # show the plot