Пример #1
0
#
# We'll use a very coarse mesh here, to show a conservative
# comparison for accuracy. Theoretically, with more
# discretization, we would capture the real results more accurately.
geometry = nastran_sections.nastran_i(6, 3, 3, 1, 1, 1)
geometry = geometry.shift_section(x_offset=0, y_offset=-3)
geometry = geometry.create_mesh(mesh_sizes=[0.25])
section = Section(geometry)
section.plot_mesh()

# %%
# Perform a geometric analysis on the section, and plot properties
# We don't need warping analysis for these simple checks,
# 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)

# %%
import pytest_check as check
from shapely.geometry import Polygon
from sectionproperties.pre.geometry import Geometry
import sectionproperties.pre.library.primitive_sections as sections
import sectionproperties.pre.library.steel_sections as steel_sections
from sectionproperties.analysis.section import Section
from sectionproperties.tests.helper_functions import validate_properties


# Setup for angle section
angle = steel_sections.angle_section(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
angle.create_mesh(mesh_sizes=2.5)
angle_section = Section(angle)
angle_section.calculate_geometric_properties()
angle_section.calculate_plastic_properties()
angle_section.calculate_warping_properties()


def test_angle_all_properties():
    check.almost_equal(angle_section.section_props.area, 2747.059)
    check.almost_equal(angle_section.section_props.perimeter, 471.3501)
    check.almost_equal(angle_section.section_props.cx, 2.122282e1)
    check.almost_equal(angle_section.section_props.cy, 5.098127e1)
    check.almost_equal(angle_section.section_props.ixx_g, 1.342632e7)
    check.almost_equal(angle_section.section_props.iyy_g, 2.955753e6)
    check.almost_equal(angle_section.section_props.ixy_g, 1.086603e6)
    check.almost_equal(angle_section.section_props.ixx_c, 6.286470e6)
    check.almost_equal(angle_section.section_props.iyy_c, 1.718455e6)
    check.almost_equal(angle_section.section_props.ixy_c, -1.885622e6)
    check.almost_equal(angle_section.section_props.zxx_plus, 6.348769e4)
    check.almost_equal(angle_section.section_props.zxx_minus, 1.233094e5)
Пример #3
0
import pytest_check as check

# import unittest
import sectionproperties.pre.library.primitive_sections as primitive_sections
import sectionproperties.pre.pre as pre
from sectionproperties.analysis.section import Section
from sectionproperties.tests.helper_functions import validate_properties

import sectionproperties.analysis.section as file

# Rectangle section setup
rectangle_geometry = primitive_sections.rectangular_section(b=50, d=100)
rectangle_geometry.create_mesh(mesh_sizes=100)
rectangle_section = Section(rectangle_geometry)
rectangle_section.calculate_geometric_properties()
rectangle_section.calculate_warping_properties()
rectangle_section.calculate_plastic_properties()

tol = 1e-6
warp_tol = 1e-4


def test_rectangular_section_geometric():
    check.almost_equal(rectangle_section.section_props.area, 100 * 50, rel=tol)
    check.almost_equal(rectangle_section.section_props.perimeter,
                       2 * 100 + 2 * 50,
                       rel=tol)
    check.almost_equal(rectangle_section.section_props.mass,
                       1 * 100 * 50,
                       rel=tol)
    check.almost_equal(rectangle_section.section_props.ea,