# print(mdl.check_node_exists(xyz=[5, 5, 0]))
# print(mdl.node_bounds())

# print(mdl.elements[3])
# print(mdl.elements[3].nodes)
# print(mdl.element_count())
# print(mdl.element_index)
# print(mdl.check_element_exists(nodes=[2, 3]))

rhino.add_sets_from_layers(mdl, layers=['supports', 'loads'])

# print(mdl.sets['trusses'])
# print(mdl.sets['supports'])
# print(mdl.sets['loads'])

mdl.add(Steel(name='steel', fy=355))

# print(mdl.materials['steel'])

mdl.add(TrussSection(name='section', A=0.001))

# print(mdl.sections['section'])

mdl.add(
    ElementProperties(name='property',
                      material='steel',
                      section='section',
                      elset='trusses'))

# print(mdl.element_properties['property'])
示例#2
0
# Structure

mdl = Structure(name='block_tets', path='C:/Temp/')

# Tetrahedrons

mesh = rs.ObjectsByLayer('base_mesh')[0]
rhino.add_tets_from_mesh(mdl, name='elset_tets', mesh=mesh, volume=10**(-4))

# Sets

rhino.add_sets_from_layers(mdl, layers=['nset_base', 'nset_top'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=10 * 10**9, v=0.3, p=1))

# Sections

mdl.add(SolidSection(name='sec_solid'))

# Properties

mdl.add(
    Properties(name='ep_tets',
               material='mat_elastic',
               section='sec_solid',
               elset='elset_tets'))

# Displacementss
mdl = Structure(name='beam_simple', path=compas_vibro.TEMP + '/')

# Elements

filepath = os.path.join(compas_vibro.DATA, 'network_10x10.json')

network = Network.from_json(filepath)
mdl.add_nodes_elements_from_network(network=network,
                                    element_type='BeamElement',
                                    elset='elset_lines',
                                    axes={'ex': [0, 0, 1]})

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=20 * 10**9, v=0.3, p=1500))

# Sets

mdl.add_set(name='load_pts', selection=[15, 14], type='node')

# Section

mdl.add(CircularSection(name='cirsec', r=.05))
mdl.add(
    Properties(name='ep',
               material='mat_elastic',
               section='cirsec',
               elset='elset_lines'))

# Displacements
示例#4
0
blender.add_nodes_elements_from_layers(
    mdl,
    layers=['elset_top_plate', 'elset_bot_plate'],
    mesh_type='ShellElement')
blender.add_nodes_elements_from_layers(mdl,
                                       layers='elset_ties',
                                       line_type='TrussElement')

# Sets

blender.add_nsets_from_layers(mdl, layers=['nset_supports', 'nset_load'])

# Materials

mdl.add([
    Steel(name='mat_steel', fy=355),
    Concrete(name='mat_concrete', fck=90),
])

# Sections

mdl.add([
    ShellSection(name='sec_plate', t=0.005),
    TrussSection(name='sec_tie', A=0.25 * 3.142 * 0.008**2),
    SolidSection(name='sec_solid'),
])

# Properties

mdl.add([
    Properties(name='ep_plate1',
               material='mat_steel',
示例#5
0
zmin, zmax = mdl.node_bounds()[2]
nodes_top = [i for i, node in mdl.nodes.items() if node.z > zmax - 0.010]
nodes_bot = [i for i, node in mdl.nodes.items() if node.z < zmin + 0.010]

mdl.add_set(name='nset_top', type='node', selection=nodes_top)
mdl.add_set(name='nset_bot', type='node', selection=nodes_bot)

#print(mdl.sets['nset_top'])
#print(mdl.sets['nset_bot'])

mdl.add([
    ElasticIsotropic(name='mat_elastic', E=50 * 10**9, v=0.3, p=1),
    SolidSection(name='sec_solid'),
    ElementProperties(name='ep_tets',
                      material='mat_elastic',
                      section='sec_solid',
                      elset='mesh_tets'),
    PinnedDisplacement(name='disp_pinned', nodes='nset_bot'),
    PointLoad(name='load_top', nodes='nset_top', y=20000, z=10000),
    GeneralStep(name='step_bc', displacements='disp_pinned'),
    GeneralStep(name='step_load', loads='load_top'),
])
mdl.steps_order = ['step_bc', 'step_load']

mdl.summary()

mdl.analyse_and_extract(software='abaqus', fields=['u', 's'])

rhino.plot_data(mdl, step='step_load', field='um')
rhino.plot_data(mdl, step='step_load', field='smises')
#rhino.plot_voxels(mdl, step='step_load', field='um', vdx=0.100)
示例#6
0
# print('Check element with nodes 0-1: ', mdl.check_element_exists([0, 1]))

# Add sets

mdl.add_set(name='nset_base', type='node', selection=[0, 1, 2, 3])
mdl.add_set(name='nset_top', type='node', selection=[4])
mdl.add_set(name='elset_beams', type='element', selection=[0, 1, 2, 3])
mdl.add_set(name='elset_shell', type='element', selection=[4])

# print('Set: nset_base: ', mdl.sets['nset_base'])
# print('Set: elset_shell: ', mdl.sets['elset_shell'])

# Add sections

mdl.add([
    CircularSection(name='sec_circ', r=0.010),
    ShellSection(name='sec_shell', t=0.005),
])

# print('Section geometry: ', mdl.sections['sec_circ'].geometry)

# Add materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=10 * 10**9, v=0.3, p=1500))

# print('Material E: ', mdl.materials['mat_elastic'].E)

# Add element properties

mdl.add([
    Properties(name='ep_circ',
               material='mat_elastic',
示例#7
0
mdl = Structure(name='mesh_plate', path='C:/Temp/')

# Elements

rhino.add_nodes_elements_from_layers(mdl,
                                     mesh_type='ShellElement',
                                     layers='elset_mesh')

# Sets

rhino.add_sets_from_layers(mdl,
                           layers=['nset_load', 'nset_left', 'nset_right'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=75 * 10**9, v=0.3, p=2700))

# Sections

mdl.add(ShellSection(name='sec_plate', t=0.020))

# Properties

mdl.add(
    Properties(name='ep_plate',
               material='mat_elastic',
               section='sec_plate',
               elset='elset_mesh'))

# Displacements
mdl = Structure(name='mesh_principal', path='C:/Temp/')

# Elements

rhino.add_nodes_elements_from_layers(mdl,
                                     mesh_type='ShellElement',
                                     layers='elset_mesh')

# Sets

rhino.add_sets_from_layers(mdl, layers='nset_pins')

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=10**12, v=0.3, p=1000))

# Sections

mdl.add(ShellSection(name='sec_plate', t=1))

# Properties

mdl.add(
    Properties(name='ep_plate',
               material='mat_elastic',
               section='sec_plate',
               elset='elset_mesh'))

# Displacements
示例#9
0
                                       layers='elset_floor',
                                       mesh_type='ShellElement')
blender.add_nodes_elements_from_layers(mdl,
                                       layers='elset_ties',
                                       line_type='TrussElement')

# Sets

blender.add_nsets_from_layers(mdl, layers=['nset_corner1', 'nset_corner2'])
edges = [i for i in mdl.nodes if mdl.nodes[i].z < 0.001]
mdl.add_set(name='nset_edges', type='node', selection=edges)

# Materials

mdl.add([
    Concrete(name='mat_concrete', fck=90, fr=[1.16, 0.15]),
    Steel(name='mat_steel', fy=355),
])

# Sections

mdl.add([
    ShellSection(name='sec_floor', t=0.050),
    TrussSection(name='sec_ties', A=pi * 0.25 * 0.030**2),
])

# Properties

mdl.add([
    Properties(name='ep_floor',
               material='mat_concrete',
               section='sec_floor',
示例#10
0
mdl = Structure(name='beam_bench', path=compas_fea.TEMP)

# Nodes and Elements

xyz = [[0, 0, 0], [1, 0, 0]]
nodes = mdl.add_nodes(xyz)
beam = mdl.add_element(nodes, 'BeamElement', axes={'ex': [0, 1, 0]})

# Sets

elset_beams = mdl.add_set('elset_beams', 'element', [beam])

# Materials

mdl.add(Steel(name='mat_steel'))

# Sections

mdl.add(RectangularSection(name='sec_pipe', b=0.05, h=0.1))

# Properties

mdl.add(
    Properties(name='ep_beam',
               material='mat_steel',
               section='sec_pipe',
               elset='elset_beams'))

# Displacements
示例#11
0
rhino.add_nodes_elements_from_layers(mdl, mesh_type='ShellElement', layers=['elset_ribs', 'elset_vault'])
rhino.add_nodes_elements_from_layers(mdl, line_type='BeamElement', layers='elset_stiff')
rhino.add_nodes_elements_from_layers(mdl, line_type='TrussElement', layers='elset_ties')

# Sets

rhino.add_sets_from_layers(mdl, layers=['nset_corner1', 'nset_corner2'])
edges = [i for i in mdl.nodes if mdl.nodes[i].z < 0.001]
mdl.add_set(name='nset_edges', type='node', selection=edges)

# Materials

mdl.add([
    Concrete(name='mat_concrete', fck=90, fr=[1.16, 0.15]),
    Stiff(name='mat_stiff', E=10**12),
    Steel(name='mat_steel', fy=355),
])

# Sections

mdl.add([
    ShellSection(name='sec_ribs', t=0.020),
    ShellSection(name='sec_vault', t=0.050),
    RectangularSection(name='sec_stiff', b=1, h=1),
    TrussSection(name='sec_ties', A=pi*0.25*0.030**2),
])

# Properties

mdl.add([
示例#12
0
mdl = Structure(name='beam_frame', path='C:/Temp/')

# Elements

rhino.add_nodes_elements_from_layers(mdl,
                                     line_type='BeamElement',
                                     layers='elset_lines')

# Sets

rhino.add_sets_from_layers(mdl, layers=['nset_left', 'nset_right'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=210 * 10**9, v=0.3, p=7500))

# Sections

mdl.add(RectangularSection(name='sec_beam', b=1, h=1))

# Properties

mdl.add(
    Properties(name='ep_beam',
               material='mat_elastic',
               section='sec_beam',
               elset='elset_lines'))

# Displacements
示例#13
0
mdl = Structure(name='spring_simple', path='C:/Temp/')

# Elements

springs = ['spring_bot_left', 'spring_bot_right', 'spring_top_left', 'spring_top_right']
rhino.add_nodes_elements_from_layers(mdl, line_type='SpringElement', layers=springs)

# Sets

rhino.add_sets_from_layers(mdl, layers=['pins', 'middle'])

# Sections

mdl.add([
    SpringSection(name='spring_elastic', stiffness={'axial': 10000}),
    SpringSection(name='spring_soft', stiffness={'axial': 1000}),
])

# Properties

mdl.add([
    Properties(name='ep_bl', section='spring_elastic', elset='spring_bot_left'),
    Properties(name='ep_br', section='spring_soft', elset='spring_bot_right'),
    Properties(name='ep_tl', section='spring_elastic', elset='spring_top_left'),
    Properties(name='ep_tr', section='spring_elastic', elset='spring_top_right'),
])

# Displacements

mdl.add([
    PinnedDisplacement(name='disp_pins', nodes='pins'),
示例#14
0
# Structure

mdl = Structure(name='beam_shell_rhino', path='C:/Temp/')

# Elements
layers = ['beams', 'shell']
rhino.add_nodes_elements_from_layers(mdl, line_type='BeamElement', mesh_type='ShellElement', layers=layers)

# Sets

rhino.add_sets_from_layers(mdl, layers=['supports'])

# Materials

mdl.add(ElasticIsotropic(name='mat_1', E=20*10**9, v=0.3, p=1500))
mdl.add(ElasticIsotropic(name='mat_2', E=30*10**9, v=0.3, p=1500))

# Sections

mdl.add(RectangularSection(name='bsec', b=0.1, h=.2))
mdl.add(Properties(name='ep_1', material='mat_1', section='bsec', elsets=['beams']))

mdl.add(ShellSection(name='ssec', t=.1))
mdl.add(Properties(name='ep_2', material='mat_2', section='ssec', elsets=['shell']))

# Displacements

mdl.add([FixedDisplacement(name='supports', nodes='supports')])

# Loads
示例#15
0
mdl = Structure(name='mesh_mould', path='C:/Temp/')

# Elements

rhino.add_nodes_elements_from_layers(mdl,
                                     mesh_type='ShellElement',
                                     layers=['elset_wall', 'elset_plinth'])

# Sets

rhino.add_sets_from_layers(mdl, layers=['nset_fixed', 'nset_loads'])

# Materials

mdl.add([
    Concrete(name='mat_concrete', fck=40),
    Steel(name='mat_rebar', fy=500),
])

# Sections

mdl.add([
    ShellSection(name='sec_wall', t=0.150),
    ShellSection(name='sec_plinth', t=0.300),
])

# Properties

reb_plinth = {
    'p_u1': {
        'pos': +0.130,
        'spacing': 0.100,
示例#16
0
def compute_compas_fea(file_path, load_path, fea_engine='abaqus', recompute=True):
    """ Use abaqus (via compas_fea) to perform elastic FEA on the given frame
    under a given load case. If no load path is specified, elemental gravity
    will be assumbed to be applied.

    Parameters
    ----------
    file_path : string
        full path to the frame shape's json file.
    load_path : type
        full path to the load case's json file.

    Returns
    -------
    nD: dict
        Reactional nodal displacement
        key is the node id.
        value is
        (nodal_id, dx, dy, dz, theta_x, theta_y, theta_z).

    fR: dict
        Fixities reaction force, moment.
        key is the nodal id.
        value is [Fxyz, Mxyz] in the global axes.

    eR: dict
        Element-wise reaction force, moment (two ends).
        key is the element id.
        (Fxyz_1, Mxyz_1, Fxyz_2, Mxyz_2)

    """
    root_dir = os.path.dirname(os.path.abspath(__file__))
    temp_dir = os.path.join(root_dir, 'compas_fea-temp')
    if not os.path.exists(temp_dir):
        os.makedirs(temp_dir)

    file_json_name = file_path.split(os.sep)[-1]
    file_name = file_json_name.split('.')[0]
    print('compas_fea initing: file name {}'.format(file_name))
    if not recompute:
        nD, fR, eR = parse_abaqus_result_json(file_name, temp_dir)
        return nD, fR, eR

    with open(file_path, 'r') as f:
        json_data = json.loads(f.read())
    load_json_data = {}
    if load_path:
        with open(load_path, 'r') as f:
            load_json_data = json.loads(f.read())

    # init an empty structure
    mdl = Structure(name=file_name, path=os.path.join(temp_dir, ''))

    # nodes
    mdl.add_nodes(nodes=parse_frame_nodes(json_data))

    # elements
    elements = parse_elements(json_data)

    # align local axes with conmech
    sc = stiffness_checker(json_file_path=file_path, verbose=False)
    e_rot_mats = sc.get_element_local2global_rot_matrices()
    assert len(e_rot_mats) == len(elements)
    for e, mat in zip(elements, e_rot_mats):
        # compas_fea local axis convention is differrent to the one used in conmech:
        # in compas_fea
        # 'ex' axis represents the cross-section’s major axis
        # 'ey' is the cross-section’s minor axis
        # 'ez' is the axis along the element
        # TODO: this numpy array to list conversion
        # is essential to make compas_fea work...
        ez = list(mat[0][0:3]) # conmech longitude axis
        ex = list(mat[1][0:3]) # conmech cross sec major axis
        ey = list(mat[2][0:3]) # conmech cross sec minor axis

        mdl.add_element(nodes=e,
                        type='BeamElement',
                        axes={'ex': ex, 'ey': ey, 'ez': ez})
        # print(mdl.elements[mdl.check_element_exists(nodes=e)])

    assert_equal(mdl.element_count(), len(elements))

    # Sets
    # just convenient aliases for referring to a group of elements
    mdl.add_set(name='elset_all', type='element', selection=list(range(mdl.element_count())))

    mdl.add_set(name='nset_all', type='node', selection=list(range(mdl.node_count())))

    fixities = parse_fixties(json_data)
    mdl.add_set(name='nset_fix', type='node', selection=[f[0] for f in fixities])

    if load_json_data:
        pt_loads, include_sw = parse_load_case(load_json_data)
        # mdl.add_set(name='nset_pt_load', type='node', selection=[l[0] for l in pt_loads])
    else:
        pt_loads = []
        include_sw = True
    if pt_loads:
        mdl.add_set(name='nset_v_load_all', type='node', selection=[pl[0] for pl in pt_loads])

    # Materials
    # Young’s modulus E [in units of Pa]
    # Poisson’s ratio v and density p [kg per cubic metre].
    mat_json = json_data['material_properties']
    mat_name = 'mat_' + mat_json['material_name']
    E_scale = parse_pressure_scale_conversion(mat_json['youngs_modulus_unit'])
    p_scale = parse_density_scale_conversion(mat_json['density_unit'])
    mdl.add(ElasticIsotropic(name=mat_name,
                             E=E_scale * mat_json['youngs_modulus'],
                             v=mat_json['poisson_ratio'],
                             p=p_scale * mat_json['density']))

    # G_scale = parse_pressure_scale_conversion(mat_json['shear_modulus_unit'])
    # print('{}, {}'.format(mdl.materials['mat_' + mat_json['material_name']].G, G_scale * mat_json['shear_modulus']))
    # assert_almost_equal(mdl.materials['mat_' + mat_json['material_name']].G['G'], G_scale * mat_json['shear_modulus'])
    # print('-----------material')
    # print(mdl.materials[mat_name])

    # Sections
    # SI units should be used, this includes the use of metres m for cross-section dimensions, not millimetres mm.
    sec_name = 'sec_circ'
    mdl.add(CircularSection(name=sec_name, r=parse_circular_cross_sec_radius(json_data)))

    # print('-----------cross section')
    # print(mdl.sections[sec_name])

    # Properties, associate material & cross sec w/ element sets
    mdl.add(Properties(name='ep_all', material=mat_name, section=sec_name, elset='elset_all'))

    # Displacements
    # pin supports
    for i, fix in enumerate(fixities):
        f_dof = []
        for j in range(6):
            if fix[j+1] == 1:
                f_dof.append(0)
            else:
                f_dof.append(None)
        mdl.add(GeneralDisplacement(name='disp_fix_'+str(i), nodes=[fix[0]], x=f_dof[0], y=f_dof[1], z=f_dof[2], xx=f_dof[3], yy=f_dof[4], zz=f_dof[5]))
    # print('-----------fixities')
    # for i in range(len(fixities)):
    #     print(mdl.displacements['disp_fix_'+str(i)])

    # Loads
    if pt_loads:
        mdl.add([PointLoad(name='load_v_'+str(i), nodes=[pl[0]],
                           x=pl[1], y=pl[2], z=pl[3],
                           xx=pl[4], yy=pl[5], zz=pl[6])
                 for i, pl in enumerate(pt_loads)])
        if include_sw:
            mdl.add(GravityLoad(name='load_gravity', elements='elset_all'))
    else:
        mdl.add(GravityLoad(name='load_gravity', elements='elset_all'))
    # print('-----------loads')
    # print(mdl.loads['load_gravity'])
    # for i in range(len(pt_loads)):
    #     print(mdl.loads['load_v_'+str(i)])

    # Steps
    loads_names = []
    if pt_loads:
        loads_names.extend(['load_v_'+str(i) for i in range(len(pt_loads))])
    if include_sw:
        loads_names.append('load_gravity')
    mdl.add([
        GeneralStep(name='step_bc', displacements=['disp_fix_'+str(i) for i in range(len(fixities))]),
        GeneralStep(name='step_loads', loads=loads_names)
        ])

    # a boundary condition step such as 'step_bc' above, should always be applied as the first step to prevent rigid body motion
    mdl.steps_order = ['step_bc', 'step_loads']

    # Summary
    mdl.summary()

    # Run
    # node
    # 'u': nodal displacement: ux, uy, uz, um (magnitude)
    # 'ur': nodal rotation
    # 'rf': reaction force
    # 'cf': concentrated force (external load)
    # 'cm': concentrated moment (external load)

    # element
    # 's': beam stress (conmech cannot compute this at
    # version 0.1.1)
    # For beam, the following values are evaluated
    # at the "integration point" 'ip1' (middle point)
    # and pts along the axis: 'sp3, sp7, sp11, sp15'
    # sxx: axial
    # syy: hoop
    # sxy: torsion
    # smises: Von Mises
    # smaxp: max principal
    # sminp: min principal

    # 'sf': beam section force
    # sf1: axial
    # sf2: shear x
    # sf3: shear y
    if fea_engine == 'abaqus':
        mdl.analyse_and_extract(software='abaqus', fields=['u', 'ur', 'rf', 'rm', 'sf'], ndof=6, output=True)
        nD, fR, eR = parse_abaqus_result_json(file_name, temp_dir)
    elif fea_engine == 'opensees':
        mdl.analyse_and_extract(software='opensees', fields=['u'], exe=OPENSEES_PATH, ndof=6, output=True, save=True)
        raise NotImplementedError('opensees from compas_fea is not fully supported at this moment...')

        nD = {}
        fR = {}
        eR = {}
        # nD = mdl.get_nodal_results(step='step_load', field='ux', nodes='nset_all')
        print(mdl.results)
    else:
        raise NotImplementedError('FEA engine not supported!')

    return nD, fR, eR
# Structure

mdl = Structure(name='mesh_modal_from_mesh', path='C:/Temp/')

# Elements

rhino.add_nodes_elements_from_layers(mdl, mesh_type='ShellElement', layers='elset_concrete', pA=100)
rhino.add_nodes_elements_from_layers(mdl, mesh_type='MassElement', layers='elset_mass',pA=1000)

# Sets

rhino.add_sets_from_layers(mdl, layers='nset_pins')

# Materials

mdl.add(ElasticIsotropic(name='mat_concrete', E=40*10**9, v=0.2, p=2400))

# Sections

mdl.add([ShellSection(name='sec_concrete', t=0.250),
        MassSection(name='sec_mass')])

# Properties

mdl.add([Properties(name='ep_concrete', material='mat_concrete', section='sec_concrete', elset='elset_concrete'),
        Properties(name='ep_mass', section='sec_mass', elset='elset_mass')])

# Displacements

mdl.add(PinnedDisplacement(name='disp_pinned', nodes='nset_pins'))
# Elements

network = rhino.network_from_lines(layer='elset_lines')
mdl.add_nodes_elements_from_network(network=network,
                                    element_type='BeamElement',
                                    elset='elset_lines',
                                    axes={'ex': [0, -1, 0]})

# Sets

rhino.add_sets_from_layers(mdl,
                           layers=['nset_left', 'nset_right', 'nset_weights'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=20 * 10**9, v=0.3, p=1500))

# Sections

_, ekeys, L, Lt = rhino.ordered_network(mdl,
                                        network=network,
                                        layer='nset_left')

for i, Li in zip(ekeys, L):
    ri = (1 + Li / Lt) * 0.020
    sname = 'sec_{0}'.format(i)
    mdl.add(CircularSection(name=sname, r=ri))
    mdl.add(
        Properties(name='ep_{0}'.format(i),
                   material='mat_elastic',
                   section=sname,
示例#19
0
rhino.add_nodes_elements_from_layers(mdl,
                                     line_type='BeamElement',
                                     layers='elset_ends')

# Sets

ymin, ymax = mdl.node_bounds()[1]
nodes_top = [i for i, node in mdl.nodes.items() if node.y > ymax - 0.01]
nodes_bot = [i for i, node in mdl.nodes.items() if node.y < ymin + 0.01]
mdl.add_set(name='nset_top', type='node', selection=nodes_top)
mdl.add_set(name='nset_bot', type='node', selection=nodes_bot)

# Materials

mdl.add([
    Concrete(name='mat_concrete', fck=90),
    Steel(name='mat_steel', fy=355),
])

# Sections

mdl.add([
    ShellSection(name='sec_mesh', t=0.004),
    TrussSection(name='sec_ties', A=0.25 * pi * 0.010**2),
    RectangularSection(name='sec_ends', b=0.030, h=0.030),
])

# Properties

mdl.add([
    Properties(name='ep_mesh',
               material='mat_concrete',
示例#20
0
# Sets

ymin, ymax = mdl.node_bounds()[1]
top = [i for i, node in mdl.nodes.items() if node.y > ymax - 0.001]
bot = [i for i, node in mdl.nodes.items() if node.y < ymin + 0.001]
mdl.add_set(name='nset_top', type='node', selection=top)
mdl.add_set(name='nset_bot', type='node', selection=bot)

# Materials

MPa = 10**6
GPa = 10**9

mdl.add([
    ElasticPlastic(name='mat_1', E=100*GPa, v=0.3, p=1, f=[100*MPa, 100*MPa], e=[0, 1]),
    ElasticPlastic(name='mat_2', E=150*GPa, v=0.3, p=1, f=[150*MPa, 150*MPa], e=[0, 1]),
    ElasticPlastic(name='mat_3', E=200*GPa, v=0.3, p=1, f=[900*MPa, 900*MPa], e=[0, 1]),
])

# Sections

mdl.add([
    SolidSection(name='sec_solid'),
    ShellSection(name='sec_membrane', t=0.002),
    RectangularSection(name='sec_rectangle', b=0.002, h=0.002),
])

# Properties

rebar = {
    'top': {'pos': +0.001, 'spacing': 0.010, 'material': 'mat_3', 'dia': 0.002, 'angle': 0},
示例#21
0
# Elements

network = rhino.network_from_lines(layer='elset_lines')
mdl.add_nodes_elements_from_network(network=network,
                                    element_type='BeamElement',
                                    elset='elset_lines',
                                    axes={'ex': [0, -1, 0]})

# Sets

rhino.add_sets_from_layers(mdl,
                           layers=['nset_left', 'nset_right', 'nset_weights'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=20 * 10**9, v=0.3, p=1500))

# Sections

_, ekeys, L, Lt = rhino.ordered_network(mdl,
                                        network=network,
                                        layer='nset_left')

for i, Li in zip(ekeys, L):
    ri = (1 + Li / Lt) * 0.020
    sname = 'sec_{0}'.format(i)
    mdl.add(CircularSection(name=sname, r=ri))
    mdl.add(
        Properties(name='ep_{0}'.format(i),
                   material='mat_elastic',
                   section=sname,
示例#22
0
mdl = Structure(name='truss_tower', path='C:/Temp/')

# Elements

blender.add_nodes_elements_from_layers(mdl,
                                       line_type='TrussElement',
                                       layers='elset_truss')

# Sets

blender.add_nsets_from_layers(mdl, layers=['nset_pins', 'nset_top'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=200 * 10**9, v=0.3, p=7850))

# Sections

mdl.add(TrussSection(name='sec_truss', A=0.0001))

# Properties

mdl.add(
    Properties(name='ep_truss',
               material='mat_elastic',
               section='sec_truss',
               elset='elset_truss'))

# Displacements
示例#23
0
rhino.add_nodes_elements_from_layers(mdl,
                                     mesh_type='ShellElement',
                                     layers=['elset_mesh', 'elset_plates'])
rhino.add_nodes_elements_from_layers(mdl,
                                     line_type='TrussElement',
                                     layers=['elset_tie'])

# Sets

rhino.add_sets_from_layers(mdl, layers=['nset_pin', 'nset_roller'])

# Materials

mdl.add([
    Concrete(name='mat_concrete', fck=50),
    Steel(name='mat_steel', fy=460),
])

# Sections

mdl.add([
    ShellSection(name='sec_planar', t=0.050),
    TrussSection(name='sec_tie', A=0.0001),
])

# Properties

mdl.add([
    Properties(name='ep_planar',
               material='mat_concrete',
               section='sec_planar',
示例#24
0
mdl = Structure(name='meshpillow_from_rhino', path='C:/Temp/')

# Elements

rhino.add_nodes_elements_from_layers(mdl,
                                     mesh_type='ShellElement',
                                     layers=['mesh'])

# Sets

rhino.add_sets_from_layers(mdl, layers=['supports', 'lpts1', 'lpts2'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=20 * 10**9, v=0.3, p=1500))

# Sections

mdl.add(ShellSection(name='sec_shell', t=0.050))

# Properties

mdl.add(
    Properties(name='ep_shell',
               material='mat_elastic',
               section='sec_shell',
               elset='mesh'))

# Displacements
示例#25
0
# Extrude

nz = 20
rhino.mesh_extrude(mdl,
                   guid=rs.ObjectsByLayer('base_mesh'),
                   layers=nz,
                   thickness=1. / nz,
                   blocks_name='elset_blocks')

# Sets

rhino.add_sets_from_layers(mdl, layers=['nset_load', 'nset_supports'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=10**(10), v=0.3, p=1))

# Sections

mdl.add(SolidSection(name='sec_solid'))

# Properties

mdl.add(
    Properties(name='ep_solid',
               material='mat_elastic',
               section='sec_solid',
               elset='elset_blocks'))

# Displacements
示例#26
0
xyz = [[0, 0, 0], [1, 0, 0], [2, 0, 0], [0, 1, 0], [1, 1, 0], [2, 1, 0],
       [0, 2, 0], [1, 2, 0], [2, 2, 0]]

nodes = mdl.add_nodes(xyz)
shells = [[0, 1, 4, 3], [1, 2, 5, 4], [3, 4, 7, 6], [4, 5, 8, 7]]

shells = [mdl.add_element(shell, 'ShellElement') for shell in shells]

# Sets

elset_shells = mdl.add_set('elset_shells', 'element', shells)

# Materials

mdl.add(Steel(name='mat_steel'))

# Sections

mdl.add(ShellSection(name='sec_shell', t=0.01))

# Properties

mdl.add(
    Properties(name='ep_shell',
               material='mat_steel',
               section='sec_shell',
               elset='elset_shells'))

# Displacements
示例#27
0
# For the path in the command below, select the location you prefer
mdl = Structure(name='Nexorades', path='C:/TEMP/')
#-------------------------------------------------------------------------------

# Elements
rhino.add_nodes_elements_from_layers(mdl,
                                     line_type='BeamElement',
                                     layers='elset_beams')
#-------------------------------------------------------------------------------

# Sets
rhino.add_sets_from_layers(mdl, layers=['nset_support', 'nset_load'])
#-------------------------------------------------------------------------------

# Materials
mdl.add(ElasticIsotropic(name='mat_elastic', E=11000000, v=10**(-5), p=0.01))
#-------------------------------------------------------------------------------

# Sections
mdl.add(CircularSection(name='sec_beam', r=0.2))
#-------------------------------------------------------------------------------

# Properties
mdl.add(
    Properties(name='ep_beam',
               material='mat_elastic',
               section='sec_beam',
               elset='elset_beams'))
#-------------------------------------------------------------------------------

# Displacements
示例#28
0
mdl = Structure(name='mesh_strip', path='C:/Temp/')

# Elements

rhino.add_nodes_elements_from_layers(mdl,
                                     mesh_type='ShellElement',
                                     layers='elset_mesh')

# Sets

rhino.add_sets_from_layers(mdl,
                           layers=['nset_left', 'nset_right', 'nset_middle'])

# Materials

mdl.add(ElasticIsotropic(name='mat_elastic', E=75 * 10**9, v=0.3, p=2700))

# Sections

mdl.add(ShellSection(name='sec_plate', t=0.001))

# Properties

mdl.add(
    Properties(name='ep_plate',
               material='mat_elastic',
               section='sec_plate',
               elset='elset_mesh'))

# Displacements
from compas_fea.structure import ModalStep

# Author(s): Andrew Liew (github.com/andrewliew)

mdl = Structure(name='example_shell', path='C:/Temp/')

rhino.add_nodes_elements_from_layers(mdl,
                                     mesh_type='ShellElement',
                                     layers='mesh')
rhino.add_sets_from_layers(mdl, layers=['loads', 'supports', 'area'])

#print(mdl.sets['loads'])
#print(mdl.sets['supports'])
#print(mdl.sets['area'])

mdl.add(Concrete(name='concrete', fck=50))

#print(mdl.materials['concrete'])

mdl.add(ShellSection(name='shell', t=0.100))

#print(mdl.sections['shell'])

mdl.add(
    ElementProperties(name='ep',
                      material='concrete',
                      section='shell',
                      elset='mesh'))

#print(mdl.element_properties['ep'])
示例#30
0
    'struts_mushroom', 'struts_bamboo', 'joints_mushroom', 'joints_bamboo',
    'joints_grid'
]
rhino.add_nodes_elements_from_layers(mdl,
                                     line_type='BeamElement',
                                     layers=layers)

# Sets

rhino.add_sets_from_layers(mdl, layers=['supports_bot', 'supports_top'])

# Sections

mdl.add([
    TrapezoidalSection(name='sec_mushroom', b1=0.001, b2=0.150, h=0.225),
    RectangularSection(name='sec_bamboo', b=0.020, h=0.100),
    RectangularSection(name='sec_joints', b=0.020, h=0.075),
])

# Materials

fm = [i * 1000000 for i in [5, 9, 12, 14, 16, 18, 19, 20, 21, 22]]
em = [0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09]

mdl.add([
    ElasticIsotropic(name='mat_bamboo', E=20 * 10**9, v=0.35, p=1100),
    ElasticPlastic(name='mat_mushroom', E=5 * 10**6, v=0.30, p=350, f=fm,
                   e=em),
])

# Properties