Exemple #1
0
def analyze_rect(step, N, Vx, Vy, Mxx, Myy, Mzz, **kwargs):
    geometry = sections.RectangularSection(d=kwargs['d'], b=kwargs['b'])
    return _analyze_common_structural_geometry(step=step,
                                               geometry=geometry,
                                               mesh_sizes=kwargs['mesh_sizes'],
                                               N=N,
                                               Vx=Vx,
                                               Vy=Vy,
                                               Mxx=Mxx,
                                               Myy=Myy,
                                               Mzz=Mzz)
steel = Material(name='Steel',
                 elastic_modulus=200e3,
                 poissons_ratio=0.3,
                 yield_strength=500,
                 color='grey')
timber = Material(name='Timber',
                  elastic_modulus=8e3,
                  poissons_ratio=0.35,
                  yield_strength=20,
                  color='burlywood')

# create 310UB40.4
ub = sections.ISection(d=304, b=165, t_f=10.2, t_w=6.1, r=11.4, n_r=8)

# create timber panel on top of the UB
panel = sections.RectangularSection(d=50, b=600, shift=[-217.5, 304])

# merge the two sections into one geometry object
geometry = sections.MergedSection([ub, panel])
geometry.clean_geometry()  # clean the geometry
geometry.plot_geometry()  # plot the geometry

# create a mesh - use a mesh size of 5 for the UB, 20 for the panel
mesh = geometry.create_mesh(mesh_sizes=[5, 20])

# create a CrossSection object - take care to list the materials in the same order as entered into
# the MergedSection
section = CrossSection(geometry, mesh, materials=[steel, timber])
section.display_mesh_info()  # display the mesh information

# plot the mesh with coloured materials and a line transparency of 0.5
 def setUp(self):
     self.geometry = sections.RectangularSection(d=100, b=50)
     self.mesh = self.geometry.create_mesh(mesh_sizes=[10])
     self.section = CrossSection(self.geometry, self.mesh)
Exemple #4
0
        def setUp(self):

            self.st = Structure(name='truss')
            self.st.add_node('A', 0, 0, 0)
            self.st.add_node('B', 15, 30 * sqrt(3) / 2, 0)
            self.st.add_node('C', 45, 30 * sqrt(3) / 2, 0)
            self.st.add_node('D', 75, 30 * sqrt(3) / 2, 0)
            self.st.add_node('E', 90, 0, 0)
            self.st.add_node('F', 60, 0, 0)
            self.st.add_node('G', 30, 0, 0)

            pairs = set()
            Lmin = 30 * sqrt(3) / 2
            Lmax = 30.1

            for n1 in self.st.nodes.values():
                for n2 in self.st.nodes.values():

                    L = numpy.sqrt((n1.X - n2.X)**2.0 + (n1.Y - n2.Y)**2.0 +
                                   (n1.Z - n2.Z)**2.0)

                    if L >= Lmin and L <= Lmax and (n1.Name,
                                                    n2.Name) not in pairs and (
                                                        n2.Name,
                                                        n1.Name) not in pairs:
                        #print(f'adding {(n1.Name,n2.Name)}')
                        pairs.add((n1.Name, n2.Name))

                    elif (n1.Name, n2.Name) in pairs or (n2.Name,
                                                         n1.Name) in pairs:
                        pass
                        #print(f'skipping {(n1.Name,n2.Name)}, already in pairs')

            self.beam = sections.RectangularSection(0.5, 0.5)

            constrained = ('A', 'E')
            for n1, n2 in pairs:
                bkey = f'{n1}_{n2}'
                self.bm = self.st.add_member(bkey,
                                             n1,
                                             n2,
                                             material=ANSI_4130(),
                                             section=self.beam)

                # if n1 not in constrained:
                #     print(f'releasing {bkey}')
                #     self.st.frame.DefineReleases(bkey, Rzi=True)

                # if n2 not in constrained:
                #     print(f'releasing {bkey} J')
                #     self.st.frame.DefineReleases(bkey, Rzj=True)

            self.st.add_constraint('A',
                                   SupportDX=True,
                                   SupportDY=True,
                                   SupportDZ=True,
                                   SupportRY=False,
                                   SupportRX=False,
                                   SupportRZ=True)
            self.st.add_constraint('E',
                                   SupportDX=False,
                                   SupportDY=True,
                                   SupportDZ=True,
                                   SupportRY=False,
                                   SupportRX=False,
                                   SupportRZ=False)
            # for node in self.st.nodes:
            #     self.st.frame.DefineSupport(node,SupportDZ=True,SupportRZ=True)

            self.st.frame.AddNodeLoad('F', 'FY', -1000)
            self.st.frame.AddNodeLoad('G', 'FY', -2000)

            self.st.analyze(check_statics=True)

            print(self.st.node_dataframes)
import time
import numpy as np
import matplotlib.pyplot as plt
import sectionproperties.pre.sections as sections
from sectionproperties.analysis.cross_section import CrossSection

# create a rectangular section
geometry = sections.RectangularSection(d=100, b=50)

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

# loop through mesh sizes
for mesh_size in mesh_sizes:
    mesh = geometry.create_mesh(mesh_sizes=[mesh_size])  # create mesh
    section = CrossSection(geometry, mesh)  # create a CrossSection object
    start_time = time.time()  # start timing
    # calculate the frame properties
    (_, _, _, _, j, _) = section.calculate_frame_properties()
    t = time.time() - start_time  # stop timing
    t_calc.append(t)  # save the time
    j_calc.append(j)  # save the torsion constant
    # print the result
    str = "Mesh Size: {0}; ".format(mesh_size)
    str += "Solution Time {0:.5f} s; ".format(t)
    str += "Torsion Constant: {0:.12e}".format(j)
    print(str)

correct_val = j_calc[0]  # assume the finest mesh gives the 'correct' value
Exemple #6
0
def boxgenerator(b, d, t_w, t_f, d_stif, t_stif, n_stif):
    """
    This function allows for generation of a stiffened box section
    This only works with Pint units aware data in SI format at the moment.
    """
    import copy
    import sectionproperties.pre.sections as sections
    from sectionproperties.analysis.cross_section import CrossSection

    # Create the main box sections
    top_flange = sections.RectangularSection(d=t_f, b=b, shift=[0, d - t_f])
    bot_flange = sections.RectangularSection(d=t_f, b=b, shift=[0, 0])
    left_web = sections.RectangularSection(d=d - 2 * t_f,
                                           b=t_w,
                                           shift=[0, t_f])
    right_web = sections.RectangularSection(d=d - 2 * t_f,
                                            b=t_w,
                                            shift=[b - t_w, t_f])

    if n_stif == 3:
        #Create top stiffeners
        top_stif1 = sections.RectangularSection(d=d_stif,
                                                b=t_stif,
                                                shift=[(b - t_stif) / 2,
                                                       d - t_f - d_stif])

        top_stif2 = copy.deepcopy(top_stif1)
        top_stif3 = copy.deepcopy(top_stif1)
        top_stif2.shift = [-b / 4, 0]
        top_stif3.shift = [b / 4, 0]
        top_stif2.shift_section()
        top_stif3.shift_section()

        #Create left stiffeners
        left_stif1 = sections.RectangularSection(d=t_stif,
                                                 b=d_stif,
                                                 shift=[t_w, (d - t_stif) / 2])

        left_stif2 = copy.deepcopy(left_stif1)
        left_stif3 = copy.deepcopy(left_stif1)
        left_stif2.shift = [0, -d / 4]
        left_stif3.shift = [0, d / 4]
        left_stif2.shift_section()
        left_stif3.shift_section()

        #Create right stiffeners
        right_stif1 = copy.deepcopy(left_stif1)
        right_stif2 = copy.deepcopy(left_stif2)
        right_stif3 = copy.deepcopy(left_stif3)
        right_stif1.shift = [b - 2 * t_w - d_stif, 0]
        right_stif2.shift = [b - 2 * t_w - d_stif, 0]
        right_stif3.shift = [b - 2 * t_w - d_stif, 0]
        right_stif1.shift_section()
        right_stif2.shift_section()
        right_stif3.shift_section()

        # create a list of the sections to be merged
        section_list = [
            top_flange, bot_flange, left_web, right_web, top_stif1, top_stif2,
            top_stif3, left_stif1, left_stif2, left_stif3, right_stif1,
            right_stif2, right_stif3
        ]

    elif n_stif == 2:
        #Create top stiffeners
        top_stif1 = sections.RectangularSection(d=d_stif,
                                                b=t_stif,
                                                shift=[(b - t_stif) / 3.0,
                                                       d - t_f - d_stif])

        top_stif2 = copy.deepcopy(top_stif1)
        top_stif2.shift = [b / 3, 0]
        top_stif2.shift_section()

        #Create left stiffeners
        left_stif1 = sections.RectangularSection(d=t_stif,
                                                 b=d_stif,
                                                 shift=[t_w, (d - t_stif) / 3])

        left_stif2 = copy.deepcopy(left_stif1)
        left_stif2.shift = [0, d / 3]
        left_stif2.shift_section()

        #Create right stiffeners
        right_stif1 = copy.deepcopy(left_stif1)
        right_stif2 = copy.deepcopy(left_stif2)
        right_stif1.shift = [b - 2 * t_w - d_stif, 0]
        right_stif2.shift = [b - 2 * t_w - d_stif, 0]
        right_stif1.shift_section()
        right_stif2.shift_section()

        # create a list of the sections to be merged
        section_list = [
            top_flange, bot_flange, left_web, right_web, top_stif1, top_stif2,
            left_stif1, left_stif2, right_stif1, right_stif2
        ]
    else:
        print("Number of stiffeners not supported")

    # merge the three sections into one geometry object
    geometry = sections.MergedSection(section_list)

    geometry.clean_geometry(verbose=False)  # clean the geometry
    geometry.add_hole([b / 2, d / 2])
    fig, ax = plt.subplots()
    ax.set_aspect('equal')
    geometry.plot_geometry(ax=ax)  # plot the geometry

    # create a mesh - use a mesh size of 12 for the RHS, 6 for stiffeners
    rhs_mesh = d / 6
    stif_mesh = t_stif

    if n_stif == 3:
        mesh = geometry.create_mesh(mesh_sizes=[
            rhs_mesh, rhs_mesh, rhs_mesh, rhs_mesh, stif_mesh, stif_mesh,
            stif_mesh, stif_mesh, stif_mesh, stif_mesh, stif_mesh, stif_mesh,
            stif_mesh
        ])
    elif n_stif == 2:
        mesh = geometry.create_mesh(mesh_sizes=[
            rhs_mesh, rhs_mesh, rhs_mesh, rhs_mesh, stif_mesh, stif_mesh,
            stif_mesh, stif_mesh, stif_mesh, stif_mesh
        ])
    else:
        print("Number of stiffeners not supported")

    section = CrossSection(geometry, mesh)  # create a CrossSection object

    return section, fig, ax