Пример #1
0
def simply_released_beam_test():
    #FEModel Test
    model=FEModel()

    E=1.999e11
    mu=0.3
    A=4.265e-3
    J=9.651e-8
    I3=6.572e-5
    I2=3.301e-6
    rho=7849.0474
    
    model.add_node(0,0,0)
    model.add_node(0.5,1,0.5)
    model.add_node(1,2,1)
    
    model.add_beam(0,1,E,mu,A,I2,I3,J,rho)
    model.add_beam(1,2,E,mu,A,I2,I3,J,rho)

    model.set_node_force(1,(0,0,-1e6,0,0,0))
    model.set_node_restraint(2,[True]*6)
    model.set_node_restraint(0,[True]*6)
    
    model.set_beam_releases(0,[True]*6,[False]*6)
    model.set_beam_releases(1,[False]*6,[True]*6)
    
    model.assemble_KM()
    model.assemble_f()
    model.assemble_boundary()
    solve_linear(model)
    print(np.round(model.d_,6))
    print("The result of node 1 should be about [0.00445,0.00890,-0.02296,-0.01930,-0.03860,-0.01930]")
Пример #2
0
def shear_test4():
    model=FEModel()
    n1=Node(0,0,0)
    n2=Node(0,0,5)
    n3=Node(5,0,5)
    n4=Node(10,0,5)
    n5=Node(10,0,0)
    n6=Node(5,0,0)
    
    a1=Membrane4(n1,n2,n3,n6,0.25,2e11,0.3,7849)
    a2=Membrane4(n3,n4,n5,n6,0.25,2e11,0.3,7849)
    
    model.add_node(n1)
    model.add_node(n2)
    model.add_node(n3)
    model.add_node(n4)
    model.add_node(n5)
    model.add_node(n6)

    model.add_membrane4(a1)
    model.add_membrane4(a2)

    n3.fn=(0,0,-100000,0,0,0)
    n1.dn=n2.dn=n4.dn=n5.dn=[0]*6
    n3.dn=n6.dn=[0,0,None,0,0,0]
    
    model.assemble_KM()
    model.assemble_f()
    model.assemble_boundary()
    res=solve_linear(model)

    np.set_printoptions(precision=6,suppress=True)
    print(res)
    print(r"correct answer should be ???")
Пример #3
0
def planar_frame_test():
    #FEModel Test
    model=FEModel()
    n1=Node(0,0,0)
    n2=Node(0,0,5)
    n3=Node(5,0,5)
    n4=Node(10,0,5)
    n5=Node(10,0,0)
    b1=Beam(n1,n2,2e11,0.3,0.013,2.675e-5,3.435e-4,1.321e-6,7849)
    b2=Beam(n2,n3,2e11,0.3,0.013,2.675e-5,3.435e-4,1.321e-6,7849)
    b3=Beam(n3,n4,2e11,0.3,0.013,2.675e-5,3.435e-4,1.321e-6,7849)
    b4=Beam(n4,n5,2e11,0.3,0.013,2.675e-5,3.435e-4,1.321e-6,7849)
    
    model.add_node(n1)
    model.add_node(n2)
    model.add_node(n3)
    model.add_node(n4)
    model.add_node(n5)

    model.add_beam(b1)
    model.add_beam(b2)
    model.add_beam(b3)
    model.add_beam(b4)

    n2.fn=(100000,0,0,0,0,0)
    n3.fn=(0,0,-100000,0,0,0)
    n1.dn=[0,0,0,0,0,0]
    n5.dn=[0,0,0,0,0,0]

    model.assemble_KM()
    model.assemble_f()
    model.assemble_boundary()
    res=solve_linear(model)
    
    print(res)
Пример #4
0
def pseudo_cantilever_test4(l=25,h=5):
    """
    This is a cantilever beam with 50x10
    l,h: division on l and h direction
    """
    model=FEModel()
    nodes=[]
    model=FEModel()
    nodes=[]
    for i in range(h+1):
        for j in range(l+1):
            nodes.append(Node(j*50/l,0,i*10/h))
            model.add_node(nodes[-1])
            
    for i in range(h):
        for j in range(l):
            area=Membrane4(nodes[i*(l+1)+j],
                           nodes[i*(l+1)+j+1],
                           nodes[(i+1)*(l+1)+j+1],
                           nodes[(i+1)*(l+1)+j+1],
                           0.25,2e11,0.3,7849)
            if j==0:
                nodes[i*(l+1)+j].dn=[0]*6
                nodes[(i+1)*(l+1)+j].dn=[0]*6

            model.add_membrane4(area)

    nodes[(l+1)*(h+1)-1].fn=(0,0,-100000,0,0,0)
    
    model.assemble_KM()
    model.assemble_f()
    model.assemble_boundary()
    res=solve_linear(model)

    np.set_printoptions(precision=6,suppress=True)
    print(res[(l+1)*(h+1)*6-6:])
    print(r"correct answer should be ???")
Пример #5
0
def cantilever_beam_test():
    #FEModel Test
    model=FEModel()
    model.add_node(0,0,0)
    model.add_node(2,1,1)
    E=1.999e11
    mu=0.3
    A=4.265e-3
    J=9.651e-8
    I3=6.572e-5
    I2=3.301e-6
    rho=7849.0474
    
    model.add_beam(0,1,E,mu,A,I2,I3,J,rho)
    model.set_node_force(1,(0,0,-1e6,0,0,0))
    model.set_node_restraint(0,[True]*6)
    model.assemble_KM()
    model.assemble_f()
    model.assemble_boundary()
    solve_linear(model)
    print(np.round(model.d_,6))
    print("The result of node 1 should be about [0.12879,0.06440,-0.32485,-0.09320,0.18639,0]")
Пример #6
0
    def __init__(self):
        self.locked = False
        self.session = None
        self.fe_model = FEModel()

        #database
        self.open = MethodType(db.open, self)
        self.create = MethodType(db.create, self)
        self.save = MethodType(db.save, self)
        self.close = MethodType(db.close, self)

        #project configuration
        self.get_project_name = MethodType(project.get_project_name, self)
        self.get_author = MethodType(project.get_author, self)
        self.get_description = MethodType(project.get_description, self)
        self.get_tolerance = MethodType(project.get_tolerance, self)
        self.get_unit = MethodType(project.get_unit, self)
        self.set_project_name = MethodType(project.set_project_name, self)
        self.set_author = MethodType(project.set_author, self)
        self.set_description = MethodType(project.set_description, self)
        self.set_tolerance = MethodType(project.set_tolerance, self)
        self.set_unit = MethodType(project.set_unit, self)

        #material
        self.add_material = MethodType(material.add_material, self)
        self.add_material_quick = MethodType(material.add_material_quick, self)
        self.get_material_names = MethodType(material.get_material_names, self)
        self.get_material_isotropic_elastic = None
        self.set_material_name = MethodType(material.set_material_name, self)
        self.set_material_isotropic_elastic = MethodType(
            material.set_material_isotropic_elastic, self)
        self.delete_material = MethodType(material.delete_material, self)

        #point
        self.add_point = MethodType(point.add_point, self)
        self.get_point_coordinate = MethodType(point.get_point_coordinate,
                                               self)
        self.get_point_name_by_coor = MethodType(point.get_point_name_by_coor,
                                                 self)
        self.get_point_names = MethodType(point.get_point_names, self)
        self.set_point_name = MethodType(point.set_point_name, self)
        self.set_point_coordinate = MethodType(point.set_point_coordinate,
                                               self)
        self.set_mass_sources = MethodType(point.set_mass_sources, self)
        self.set_point_load = MethodType(point.set_point_load, self)
        self.set_point_mass = MethodType(point.set_point_mass, self)
        self.set_point_restraint = MethodType(point.set_point_restraint, self)
        self.set_point_restraint_batch = MethodType(
            point.set_point_restraint_batch, self)
        self.delete_point = MethodType(point.delete_point, self)

        #frame section
        self.add_frame_section = MethodType(frame_section.add_frame_section,
                                            self)
        self.add_frame_section_SD = MethodType(
            frame_section.add_frame_section_SD, self)
        self.add_frame_section_variate = MethodType(
            frame_section.add_frame_section_variate, self)
        self.get_frame_section_names = MethodType(
            frame_section.get_frame_section_names, self)
        self.get_frame_section_SD = None
        self.get_frame_section_variate = None
        self.set_frame_section_name = None
        self.set_frame_section_SD = None
        self.set_frame_section_variate = None
        self.delete_frame_section = MethodType(
            frame_section.delete_frame_section, self)

        #area section
        self.add_area_section = MethodType(area_section.add_area_section, self)
        self.add_area_section_layered = MethodType(
            area_section.add_area_section_layered, self)
        self.get_area_section_names = MethodType(
            area_section.get_area_section_names, self)
        self.get_area_section_layered = None
        self.set_area_section_name = None
        self.set_area_section_layered = None
        self.delete_area_section = MethodType(area_section.delete_area_section,
                                              self)

        #curve for loadcase
        self.add_curve = None
        self.add_spectrum = None
        self.set_curve = None
        self.set_spectrum = None
        self.delete_curve = None
        self.delete_spectrum = None

        #loadcase
        self.add_loadcase = MethodType(loadcase.add_loadcase, self)
        self.get_loadcase_names = MethodType(loadcase.get_loadcase_names, self)
        self.get_loadcase_2nd = None
        self.get_loadcase_2nd = None
        self.get_loadcase_buckling = None
        self.get_loadcase_modal = None
        self.get_loadcase_response_spectrum = None
        self.get_loadcase_static_linear = None
        self.get_loadcase_time_history = None
        self.set_loadcase_2nd = MethodType(loadcase.set_loadcase_2nd, self)
        self.set_loadcase_3rd = MethodType(loadcase.set_loadcase_3rd, self)
        self.set_loadcase_buckling = MethodType(loadcase.set_loadcase_buckling,
                                                self)
        self.set_loadcase_modal = MethodType(loadcase.set_loadcase_modal, self)
        self.set_loadcase_response_spectrum = MethodType(
            loadcase.set_loadcase_response_spectrum, self)
        self.set_loadcase_static_linear = MethodType(
            loadcase.set_loadcase_static_linear, self)
        self.set_loadcase_time_history = MethodType(
            loadcase.set_loadcase_time_history, self)
        self.delete_loadcase = MethodType(loadcase.delete_loadcase, self)

        #combination
        self.add_combination = None
        self.set_combination = None
        self.get_combination = None
        self.delete_combinataion = None

        #frame
        self.add_frame = MethodType(frame.add_frame, self)
        self.add_frame_batch = MethodType(frame.add_frame_batch, self)
        self.get_frame_end_coors = MethodType(frame.get_frame_end_coors, self)
        self.get_frame_end_names = MethodType(frame.get_frame_end_names, self)
        self.get_frame_names = MethodType(frame.get_frame_names, self)
        self.get_frame_names_by_points = MethodType(
            frame.get_frame_names_by_points, self)
        self.get_frame_section_attribute = MethodType(
            frame.get_frame_section_attribute, self)
        self.get_frame_dir_by_rotation = None
        self.get_frame_dir_by_vector = None
        self.get_frame_dir_by_point = None
        self.set_frame_name = None
        self.set_frame_section_attribute = None
        self.set_frame_dir_by_rotation = None
        self.set_frame_dir_by_vector = None
        self.set_frame_dir_by_point = None
        self.set_frame_mesh = None
        self.delete_frame = MethodType(frame.delete_frame, self)

        #area
        self.add_area = MethodType(area.add_area, self)
        self.add_area_batch = MethodType(area.add_area_batch, self)
        self.delete_area = MethodType(area.delete_area, self)

        #result
        self.add_result_point_displacement = None
        self.add_result_point_reaction = None
        self.add_result_frame_force = None
        self.add_result_period = None
        self.add_result_modal_mass = None
        self.add_result_modal_participate_factor = None
        self.get_result_point_displacement = MethodType(
            result.get_result_point_displacement, self)
        self.get_result_point_reaction = MethodType(
            result.get_result_point_reaction, self)
        self.get_result_frame_force = MethodType(result.get_result_frame_force,
                                                 self)
        self.get_result_area_stress = None
        self.get_result_period = MethodType(result.get_result_period, self)
        self.combine_result_point_displacement = None
        self.combine_result_frame_force = None
        self.combine_result_area_stress = None
        self.clear_all_result = None

        #design/checking
        self.set_global_steel_check_settings = None
        self.set_global_concrete_rebar_settings = None
        self.set_frame_steel_check_settings = None
        self.set_frame_concrete_rebar_settings = None
        self.set_area_concrete_rebar_settings = None
        self.set_concrete_check_settings = None
        self.set_frame_check_settings = None
        self.set_frame_rebar_settings = None

        #io
        self.import_dxf = MethodType(dxf.import_dxf, self)
        self.export_dxf = MethodType(dxf.export_dxf, self)
        self.import_s2k = None
        self.export_s2k = None