def test_compound_stiffened_isection():
    """
    Tests that plates 1 and 2 can be eroded to nothing and a valid Section can
    still be generated without errors.
    """
    uc = steel_sections.i_section(d=400, b=400, t_f=25, t_w=25, r=30, n_r=8)
    plate1 = (sections.rectangular_section(b=500,
                                           d=10).align_center(uc).align_to(
                                               uc, "top"))
    plate2 = (sections.rectangular_section(b=500,
                                           d=10).align_center(uc).align_to(
                                               uc, "bottom"))
    geom = uc + plate1 + plate2

    new_geom = geom.offset_perimeter(-9)
    new_geom.create_mesh([100])
    section = Section(new_geom)

    new_geom = geom.offset_perimeter(-10)
    new_geom.create_mesh([100])
    section = Section(new_geom)

    new_geom = geom.offset_perimeter(-11)
    new_geom.create_mesh([100])
    section = Section(new_geom)
def test_compound_rectangular_offset():
    rect1 = sections.rectangular_section(d=50, b=50)
    rect2 = sections.rectangular_section(d=50, b=50).align_to(rect1, "right")
    geom = rect1 + rect2
    geom = geom.offset_perimeter(amount=-5, where="exterior")
    geom.create_mesh([50])
    section = Section(geom)
    section.calculate_geometric_properties()
    area = 90 * 40
    check.almost_equal(section.get_area(), area, rel=r_tol)
예제 #3
0
def test_compound_rectangular_perimeter():
    rect1 = sections.rectangular_section(d=100, b=100)
    rect2 = sections.rectangular_section(d=50, b=50).align_to(rect1, on="top")
    rect3 = sections.rectangular_section(d=50, b=100).align_to(rect1,
                                                               on="right")
    rect4 = (sections.rectangular_section(d=50, b=50).align_to(
        rect3, on="bottom").align_to(rect3, on="right", inner=True))
    geom = rect1 + rect2 + rect3 + rect4
    geom.create_mesh([100])
    section = Section(geom)
    section.calculate_geometric_properties()
    assert section.get_perimeter() == (150 + 50 + 50 + 100 + 100 + 50 + 50 +
                                       50 + 50 + 150)
예제 #4
0
def test_compound_rectangular_isection_perimeter2():
    i_section = steel_sections.i_section(d=308,
                                         b=305,
                                         t_f=15.4,
                                         t_w=9.9,
                                         r=16.5,
                                         n_r=16)
    rect1 = (sections.rectangular_section(
        d=330, b=16).align_center(i_section).align_to(i_section, "left"))
    rect2 = (sections.rectangular_section(
        d=330, b=16).align_center(i_section).align_to(i_section, "right"))
    geom = i_section + rect1 + rect2
    geom.create_mesh([100])
    section = Section(geom)
    section.calculate_geometric_properties()
    assert section.get_perimeter(
    ) == 2 * 330 + 4 * 16 + 2 * 305 + 2 * (330 - 308)
def test_rectangular_offset():
    # exterior negative offset
    rect = sections.rectangular_section(d=500, b=300)
    rect = rect.offset_perimeter(amount=-10, where="exterior")
    rect.create_mesh([200])
    section = Section(rect)
    section.calculate_geometric_properties()
    area = 480 * 280
    check.almost_equal(section.get_area(), area, rel=r_tol)

    # exterior positive offset
    rect = sections.rectangular_section(d=500, b=300)
    rect = rect.offset_perimeter(amount=10, where="exterior")
    rect.create_mesh([200])
    section = Section(rect)
    section.calculate_geometric_properties()
    area = 520 * 320 - (20 * 20 - np.pi * 10 * 10)
    check.almost_equal(section.get_area(), area, rel=r_tol)
def test_compound_rectangular_isection_offset_corrode():
    d = 300
    b = 150
    tf = 10
    tw = 8
    r = 12
    b_p = 250
    t_p = 16
    ub = steel_sections.i_section(d=d, b=b, t_f=tf, t_w=tw, r=r, n_r=16)
    plate = (sections.rectangular_section(
        b=b_p, d=t_p).align_center(ub).align_to(ub, on="top"))
    geom_test = ub + plate
    geom_test = geom_test.offset_perimeter(amount=-2, where="exterior")
    geom_test.create_mesh([100])
    section_test = Section(geom_test)
    section_test.calculate_geometric_properties()

    ub_corroded = steel_sections.mono_i_section(d=298,
                                                b_t=146,
                                                b_b=146,
                                                t_ft=8,
                                                t_fb=6,
                                                t_w=4,
                                                r=14,
                                                n_r=16)
    plate_corroded1 = (sections.rectangular_section(
        b=146, d=2).align_center(ub_corroded).align_to(ub_corroded, "top"))
    plate_corroded2 = (sections.rectangular_section(
        b=246,
        d=12).align_center(ub_corroded).align_to(plate_corroded1, "top"))
    rad_l = (draw_radius(2,
                         8).align_to(plate_corroded1,
                                     "left").align_to(plate_corroded2,
                                                      "bottom"))
    rad_r = (draw_radius(2, 8).mirror_section("y", [2, 0]).align_to(
        plate_corroded1, "right").align_to(plate_corroded2, "bottom"))
    geom_corroded = ub_corroded + plate_corroded1 + plate_corroded2 + rad_l + rad_r
    geom_corroded.create_mesh([100])
    section_corroded = Section(geom_corroded)
    section_corroded.calculate_geometric_properties()

    check.almost_equal(section_test.get_area(),
                       section_corroded.get_area(),
                       rel=r_tol)
예제 #7
0
def test_compound_rhs_isection_perimeter():
    d = 200
    b = 150
    t = 9
    r = 15
    b_p = 250
    t_p = 16
    rhs = steel_sections.rectangular_hollow_section(d=d,
                                                    b=b,
                                                    t=t,
                                                    r_out=r,
                                                    n_r=16)
    plate1 = (sections.rectangular_section(
        b=b_p, d=t_p).align_center(rhs).align_to(rhs, on="top"))
    plate2 = (sections.rectangular_section(
        b=b_p, d=t_p).align_center(rhs).align_to(rhs, on="bottom"))
    geom = rhs + plate1 + plate2
    geom.create_mesh([100])
    section = Section(geom)
    section.calculate_geometric_properties()
    perim = ((2 * b_p) + (4 * t_p) + 2 * (b_p - b + 2 * r) + (2 * np.pi * r) +
             2 * (d - 2 * r))
    check.almost_equal(section.get_perimeter(), perim, rel=r_tol)
예제 #8
0
def test_rectangle():
    fy = 500
    E = 200e3
    b = 50
    d = 100

    steel = Material(
        name="Steel",
        elastic_modulus=E,
        poissons_ratio=0.3,
        yield_strength=fy,
        density=8.05e-6,
        color="grey",
    )

    Sx = b * d * d / 4
    Mp = Sx * fy

    geom_mat = sections.rectangular_section(d=d, b=b, material=steel)
    geom_nomat = sections.rectangular_section(d=d, b=b)

    geom_mat.create_mesh(mesh_sizes=[2.5])
    geom_nomat.create_mesh(mesh_sizes=[2.5])

    sec_mat = Section(geom_mat)
    sec_nomat = Section(geom_nomat)

    sec_mat.calculate_geometric_properties()
    sec_mat.calculate_plastic_properties()

    sec_nomat.calculate_geometric_properties()
    sec_nomat.calculate_plastic_properties()

    assert sec_nomat.get_s()[0] == pytest.approx(Sx)
    assert sec_mat.get_s()[0] == pytest.approx(Mp)
    assert sec_mat.get_s()[0] / fy == sec_nomat.get_s()[0]
예제 #9
0
def test_compound_rectangular_isection_perimeter1():
    d = 300
    b = 150
    tf = 10
    tw = 6
    r = 12
    b_p = 250
    t_p = 16
    ub = steel_sections.i_section(d=d, b=b, t_f=tf, t_w=tw, r=r, n_r=16)
    plate = (sections.rectangular_section(
        b=b_p, d=t_p).align_center(ub).align_to(ub, on="top"))
    geom = ub + plate
    geom.create_mesh([100])
    section = Section(geom)
    section.calculate_geometric_properties()
    perim = (b + (4 * tf) + 2 * (b - tw - 2 * r) + (2 * np.pi * r) + 2 *
             (d - 2 * tf - 2 * r) + (b_p - b) + (2 * t_p) + b_p)
    check.almost_equal(section.get_perimeter(), perim, rel=r_tol)
def do_section(b, S, d_mid=1, plot_geom=False):
    delta = S * d_mid
    d1 = d_mid - delta
    d2 = d_mid + delta

    # compute mesh size
    ms = d_mid * b / n

    points = []
    points.append([0, 0])
    points.append([0, d1])
    points.append([b, d2])
    points.append([b, 0])
    if S < 1.0:
        trap_geom = geometry.Geometry(Polygon(points))
    else:
        trap_geom = sections.triangular_section(h=d2, b=b)
    jt = get_section_j(trap_geom, ms, plot_geom)

    rect_geom = sections.rectangular_section(d=(d1 + d2) / 2, b=b)
    jr = get_section_j(rect_geom, ms, plot_geom)
    return jt, jr, d1, d2
예제 #11
0
def concrete_tee_section(
    b: float,
    d: float,
    b_f: float,
    d_f: float,
    dia: float,
    n_bar: int,
    n_circle: int,
    cover: float,
    conc_mat: pre.Material = pre.DEFAULT_MATERIAL,
    steel_mat: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.CompoundGeometry:
    """Constructs a concrete tee section of width *b*, depth *d*, flange width *b_f* and flange
    depth *d_f* with *n_bar* steel bars of diameter *dia*, discretised with *n_circle* points with
    equal side and bottom *cover* to the steel.

    :param float b: Concrete section depth
    :param float d: Concrete section width
    :param float b_f: Concrete section flange depth
    :param float d_f: Concrete section flange width
    :param float dia: Diameter of the steel reinforcing bars
    :param int n_bar: Number of steel reinforcing bars
    :param int n_circle: Number of points discretising the steel reinforcing bars
    :param float cover: Side and bottom cover to the steel reinforcing bars
    :param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to associate with
        the concrete
    :param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to associate with
        the steel

    :raises ValueErorr: If the number of bars is not greater than or equal to 2

    The following example creates a 900D x 450W concrete beam with a 1200W x 250D flange, with 5N24
    steel reinforcing bars and 30 mm cover::

        from sectionproperties.pre.library.concrete_sections import concrete_tee_section
        from sectionproperties.pre.pre import Material

        concrete = Material(
            name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32, color='lightgrey'
        )
        steel = Material(
            name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500, color='grey'
        )

        geometry = concrete_tee_section(
            b=450, d=900, b_f=1200, d_f=250, dia=24, n_bar=5, n_circle=24, cover=30,
            conc_mat=concrete, steel_mat=steel
        )
        geometry.create_mesh(mesh_sizes=[500])

    ..  figure:: ../images/sections/concrete_tee_section_geometry.png
        :align: center
        :scale: 50 %

        Concrete tee section geometry.

    ..  figure:: ../images/sections/concrete_tee_section_mesh.png
        :align: center
        :scale: 50 %

        Mesh generated from the above geometry.
    """

    if n_bar < 2:
        raise ValueError("Please provide 2 or more steel reinforcing bars.")

    geom = primitive_sections.rectangular_section(b=b,
                                                  d=d - d_f,
                                                  material=conc_mat)
    flange = primitive_sections.rectangular_section(b=b_f,
                                                    d=d_f,
                                                    material=conc_mat)
    geom += flange.align_center(align_to=geom).align_to(other=geom, on="top")

    x_i = cover + dia / 2
    spacing = (b - 2 * cover - dia) / (n_bar - 1)

    for i in range(n_bar):
        bar = primitive_sections.circular_section(d=dia,
                                                  n=n_circle,
                                                  material=steel_mat)
        geom += bar.shift_section(x_offset=x_i + spacing * i,
                                  y_offset=cover + dia / 2)

    return geom
예제 #12
0
# %%
# Number of elements for each analysis
n = 100

# %%
# 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]")
예제 #13
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,
예제 #14
0
def concrete_rectangular_section(
    b: float,
    d: float,
    dia_top: float,
    n_top: int,
    dia_bot: float,
    n_bot: int,
    n_circle: int,
    cover: float,
    area_top: float = None,
    area_bot: float = None,
    conc_mat: pre.Material = pre.DEFAULT_MATERIAL,
    steel_mat: pre.Material = pre.DEFAULT_MATERIAL,
) -> geometry.CompoundGeometry:
    """Constructs a concrete rectangular section of width *b* and depth *d*, with
    *n_top* top steel bars of diameter *dia_top*, *n_bot* bottom steel bars of diameter
    *dia_bot*, discretised with *n_circle* points with equal side and top/bottom
    *cover* to the steel.

    :param float b: Concrete section width
    :param float d: Concrete section depth
    :param float dia_top: Diameter of the top steel reinforcing bars
    :param int n_top: Number of top steel reinforcing bars
    :param float dia_bot: Diameter of the bottom steel reinforcing bars
    :param int n_bot: Number of bottom steel reinforcing bars
    :param int n_circle: Number of points discretising the steel reinforcing bars
    :param float cover: Side and bottom cover to the steel reinforcing bars
    :param float area_top: If provided, constructs top reinforcing bars based on their
        area rather than diameter (prevents the underestimation of steel area due to
        circle discretisation)
    :param float area_bot: If provided, constructs bottom reinforcing bars based on
        their area rather than diameter (prevents the underestimation of steel area due
        to circle discretisation)
    :param Optional[sectionproperties.pre.pre.Material] conc_mat: Material to
        associate with the concrete
    :param Optional[sectionproperties.pre.pre.Material] steel_mat: Material to
        associate with the steel

    :raises ValueErorr: If the number of bars is not greater than or equal to 2 in an
        active layer

    The following example creates a 600D x 300W concrete beam with 3N20 bottom steel
    reinforcing bars and 30 mm cover::

        from sectionproperties.pre.library.concrete_sections import concrete_rectangular_section
        from sectionproperties.pre.pre import Material

        concrete = Material(
            name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32,
            density=2.4e-6, color='lightgrey'
        )
        steel = Material(
            name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500,
            density=7.85e-6, color='grey'
        )

        geometry = concrete_rectangular_section(
            b=300, d=600, dia_top=20, n_top=0, dia_bot=20, n_bot=3, n_circle=24, cover=30,
            conc_mat=concrete, steel_mat=steel
        )
        geometry.create_mesh(mesh_sizes=[500])

    ..  figure:: ../images/sections/concrete_rectangular_section_geometry.png
        :align: center
        :scale: 50 %

        Concrete rectangular section geometry.

    ..  figure:: ../images/sections/concrete_rectangular_section_mesh.png
        :align: center
        :scale: 50 %

        Mesh generated from the above geometry.
    """

    if n_top == 1 or n_bot == 1:
        raise ValueError(
            "If adding a reinforcing layer, provide 2 or more bars.")

    # create rectangular concrete geometry
    geom = primitive_sections.rectangular_section(b=b, d=d, material=conc_mat)

    # calculate reinforcing bar dimensions
    x_i_top = cover + dia_top / 2
    x_i_bot = cover + dia_bot / 2
    spacing_top = (b - 2 * cover - dia_top) / (n_top - 1)
    spacing_bot = (b - 2 * cover - dia_bot) / (n_bot - 1)

    # add top bars
    for i in range(n_top):
        if area_top:
            bar = primitive_sections.circular_section_by_area(
                area=area_top, n=n_circle, material=steel_mat)
        else:
            bar = primitive_sections.circular_section(d=dia_top,
                                                      n=n_circle,
                                                      material=steel_mat)

        bar = bar.shift_section(x_offset=x_i_top + spacing_top * i,
                                y_offset=d - cover - dia_top / 2)

        geom = (geom - bar) + bar

    # add bot bars
    for i in range(n_bot):
        if area_bot:
            bar = primitive_sections.circular_section_by_area(
                area=area_bot, n=n_circle, material=steel_mat)
        else:
            bar = primitive_sections.circular_section(d=dia_bot,
                                                      n=n_circle,
                                                      material=steel_mat)

        bar = bar.shift_section(x_offset=x_i_bot + spacing_bot * i,
                                y_offset=cover + dia_bot / 2)

        geom = (geom - bar) + bar

    return geom
예제 #15
0
def test_rectangular_perimeter():
    rect = sections.rectangular_section(d=500, b=300)
    rect.create_mesh([200])
    section = Section(rect)
    section.calculate_geometric_properties()
    assert section.get_perimeter() == 2 * (500 + 300)
예제 #16
0
    color="burlywood",
)

# %%
# Create 310UB40.4
ub = steel_sections.i_section(d=304,
                              b=165,
                              t_f=10.2,
                              t_w=6.1,
                              r=11.4,
                              n_r=8,
                              material=steel)

# %%
# Create timber panel on top of the UB
panel = sections.rectangular_section(d=50, b=600, material=timber)
panel = panel.align_center(ub).align_to(ub, on="top")
# Create intermediate nodes in panel to match nodes in ub
panel = (panel - ub) | panel

# %%
# Merge the two sections into one geometry object
section_geometry = CompoundGeometry([ub, panel])

# %%
# Create a mesh and a Section object. For the mesh use a mesh size of 5 for
# the UB, 20 for the panel
section_geometry.create_mesh(mesh_sizes=[5, 20])
comp_section = Section(section_geometry, time_info=True)
comp_section.display_mesh_info()  # display the mesh information
예제 #17
0
required for a frame analysis are computed. In this example the torsion constant of
a rectangular section is calculated for a number of different mesh sizes and the
accuracy of the result compared with the time taken to obtain the solution.
"""

# sphinx_gallery_thumbnail_number = 1

import time
import numpy as np
import matplotlib.pyplot as plt
import sectionproperties.pre.library.primitive_sections as sections
from sectionproperties.analysis.section import Section

# %%
# Create a rectangular section
geometry = sections.rectangular_section(d=100, b=50)

# %%
# Create a list of mesh sizes to analyse
mesh_sizes = [3, 4, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100, 200]
j_calc = []  # list to store torsion constants
t_calc = []  # list to store computation times

# %%
# Loop through mesh sizes
for mesh_size in mesh_sizes:
    geometry.create_mesh(mesh_sizes=[mesh_size])  # create mesh
    section = Section(geometry)  # create a Section object
    start_time = time.time()  # start timing
    # calculate the frame properties
    (_, _, _, _, j, _) = section.calculate_frame_properties()