def modal(geom_file, num_modes, path):
    # add shell elements from mesh ---------------------------------------------
    with open(geom_file, 'rb') as fh:
        geom_data = json.load(fh)
    mesh = Mesh.from_data(geom_data['mesh'])
    s = structure.Structure()
    s.add_nodes_elements_from_mesh(mesh, element_type='ShellElement')

    # add displacements --------------------------------------------------------
    pts = geom_data['pts']
    nkeys = []
    for pt in pts:
        nkeys.append(s.check_node_exists(pt))
    s.add_set(name='support_nodes', type='NODE', selection=nkeys)
    supppots = FixedDisplacement(name='supports', nodes='support_nodes')
    s.add_displacement(supppots)

    # add materials and sections -----------------------------------------------
    E35 = 35 * 10**9
    concrete = ElasticIsotropic(name='MAT_CONCRETE', E=E35, v=0.2, p=2400)
    s.add_material(concrete)
    section = ShellSection(name='SEC_CONCRETE', t=0.020)
    s.add_section(section)
    prop = ElementProperties(type='SHELL', material='MAT_CONCRETE', section='SEC_CONCRETE', elsets=['ELSET_ALL'])
    s.add_element_properties(prop)

    # add modal step -----------------------------------------------------------

    step = ModalStep(name='modal_analysis', displacements=['supports'], num_modes=num_modes)
    s.add_step(step)
    fnm = path + 'modal.inp'
    ansys.inp_generate(s, filename=fnm)
    # temp = path + '_Temp/'
    s.analyse(path=path, name='modal.inp', temp=None, software='ansys')
    return s
Example #2
0
def harmonic_pressure(mesh, pts, freq_list, path, name, damping):
    # add shell elements from mesh ---------------------------------------------
    s = structure.Structure()
    s.add_nodes_elements_from_mesh(mesh, element_type='ShellElement')
    s.add_set(name='all_elements', type='element', selection=s.elements.keys())

    # add virtual elements -----------------------------------------------------

    for fkey in list(mesh.faces()):
        face = [
            s.check_node_exists(mesh.vertex_coordinates(i))
            for i in mesh.face[fkey]
        ]
        s.add_virtual_element(nodes=face, type='FaceElement')

    # add displacements --------------------------------------------------------
    nkeys = []
    for pt in pts:
        nkeys.append(s.check_node_exists(pt))
    s.add_set(name='support_nodes', type='NODE', selection=nkeys)
    supppots = FixedDisplacement(name='supports', nodes='support_nodes')
    s.add_displacement(supppots)

    # add materials and sections -----------------------------------------------
    E35 = 35 * 10**9
    concrete = ElasticIsotropic(name='MAT_CONCRETE', E=E35, v=0.2, p=2400)
    s.add_material(concrete)
    section = ShellSection(name='SEC_CONCRETE', t=0.020)
    s.add_section(section)
    prop = ElementProperties(name='shell_props',
                             material='MAT_CONCRETE',
                             section='SEC_CONCRETE',
                             elsets=['all_elements'])
    s.add_element_properties(prop)

    # add loads ----------------------------------------------------------------

    load = HarmonicPressureLoad(name='pressureload',
                                elements=['virtual_elements'],
                                pressure=3.,
                                phase=math.pi / 2.)
    s.add_load(load)

    # add modal step -----------------------------------------------------------
    step = HarmonicStep(name='harmonic_analysis',
                        displacements=['supports'],
                        loads=['pressureload'],
                        freq_list=freq_list,
                        damping=damping)
    s.add_step(step)
    s.set_steps_order(['harmonic_analysis'])

    # analysis -----------------------------------------------------------------
    s.path = path
    s.name = name
    fields = ['all']
    s.write_input_file('ansys', fields=fields)
    s.analyse(software='ansys', cpus=4)
    s.extract_data(software='ansys', fields=fields, steps='last')
    return s
Example #3
0
def harmonic(geom_file, freq_range, freq_steps, damping):
    # add shell elements from mesh ---------------------------------------------
    with open(geom_file, 'rb') as fh:
        geom_data = json.load(fh)
    mesh = Mesh.from_data(geom_data['mesh'])
    s = structure.Structure()
    s.add_nodes_elements_from_mesh(mesh, element_type='ShellElement')

    # add displacements --------------------------------------------------------
    pts = geom_data['pts']
    nkeys = []
    for pt in pts:
        nkeys.append(s.check_node_exists(pt))
    s.add_set(name='support_nodes', type='NODE', selection=nkeys)
    supppots = FixedDisplacement(name='supports', nodes='support_nodes')
    s.add_displacement(supppots)

    # add materials and sections -----------------------------------------------
    E35 = 35 * 10**9
    concrete = ElasticIsotropic(name='MAT_CONCRETE', E=E35, v=0.2, p=2400)
    s.add_material(concrete)
    section = ShellSection(name='SEC_CONCRETE', t=0.020)
    s.add_section(section)
    prop = ElementProperties(type='SHELL',
                             material='MAT_CONCRETE',
                             section='SEC_CONCRETE',
                             elsets=['ELSET_ALL'])
    s.add_element_properties(prop)

    # add loads ----------------------------------------------------------------
    f_pts = geom_data['f_pts']
    nodes = [s.check_node_exists(pt) for pt in f_pts]
    s.add_set(name='load_nodes', type='NODE', selection=nodes)
    load = PointLoad(name='hload',
                     nodes='load_nodes',
                     x=0,
                     y=0,
                     z=1,
                     xx=0,
                     yy=0,
                     zz=0)
    s.add_load(load)

    # add modal step -----------------------------------------------------------
    step = HarmonicStep(name='harmonic_analysis',
                        displacements=['supports'],
                        loads=['hload'],
                        freq_range=freq_range,
                        freq_steps=freq_steps,
                        damping=damping)
    s.add_step(step)
    fnm = path + 'harmonic.inp'
    ansys.inp_generate(s, filename=fnm)
    # temp = path+'_Temp/'
    s.analyse(path=path, name='harmonic.inp', temp=None, software='ansys')
    return s
Example #4
0
def harmonic(mesh, pts, lpts, freq_range, freq_steps, damping, path, filename):
    # add shell elements from mesh ---------------------------------------------
    s = structure.Structure()
    s.add_nodes_elements_from_mesh(mesh, element_type='ShellElement')

    # add displacements --------------------------------------------------------
    nkeys = []
    for pt in pts:
        nkeys.append(s.check_node_exists(pt))
    s.add_set(name='support_nodes', type='NODE', selection=nkeys)
    supports = PinnedDisplacement(name='supports', nodes='support_nodes')
    s.add_displacement(supports)

    # add materials and sections -----------------------------------------------
    E35 = 35 * 10**9
    concrete = ElasticIsotropic(name='MAT_CONCRETE', E=E35, v=0.2, p=2400)
    s.add_material(concrete)
    section = ShellSection(name='SEC_CONCRETE', t=0.050)
    s.add_section(section)
    prop = ElementProperties(material='MAT_CONCRETE',
                             section='SEC_CONCRETE',
                             elsets=['ELSET_ALL'])
    s.add_element_properties(prop)

    # add loads ----------------------------------------------------------------
    nkeys = []
    for lpt in lpts:
        nkeys.append(s.check_node_exists(lpt))
    load = HarmonicPointLoad(name='harmonic_load', nodes=nkeys, z=-1)
    s.add_load(load)

    # add modal step -----------------------------------------------------------
    step = HarmonicStep(name='harmonic_analysis',
                        displacements=['supports'],
                        loads=['harmonic_load'],
                        freq_range=freq_range,
                        freq_steps=freq_steps,
                        damping=damping)
    s.add_step(step)
    fnm = path + filename
    ansys.inp_generate(s, filename=fnm, output_path=path)
    s.analyse(path=path, name=filename, fields=None, software='ansys')
    return s
Example #5
0
def modal(mesh, pts, num_modes, path, name):
    # add shell elements from mesh ---------------------------------------------
    s = structure.Structure(name=name, path=path)
    s.add_nodes_elements_from_mesh(mesh, element_type='ShellElement')

    # add displacements --------------------------------------------------------
    nkeys = []
    for pt in pts:
        nkeys.append(s.check_node_exists(pt))
    s.add_set(name='support_nodes', type='NODE', selection=nkeys)
    supports = PinnedDisplacement(name='supports', nodes='support_nodes')
    s.add_displacement(supports)

    # add materials and sections -----------------------------------------------
    E35 = 35 * 10**9
    concrete = ElasticIsotropic(name='MAT_CONCRETE', E=E35, v=0.2, p=2400)
    s.add_material(concrete)
    section = ShellSection(name='SEC_CONCRETE', t=0.050)
    s.add_section(section)
    prop = ElementProperties(material='MAT_CONCRETE',
                             section='SEC_CONCRETE',
                             elsets=['ELSET_ALL'])
    s.add_element_properties(prop)

    # add modal step -----------------------------------------------------------

    step = ModalStep(name='modal_analysis',
                     displacements=['supports'],
                     modes=num_modes)
    s.add_step(step)
    s.set_steps_order(['modal_analysis'])

    # analyse ------------------------------------------------------------------
    fields = 'all'
    s.write_input_file(software='ansys', fields=fields)
    s.analyse(software='ansys', cpus=4)
    s.extract_data(software='ansys', fields=fields, steps='last')
    return s
pts = rs.ObjectsByLayer('pts')
pts = [rs.PointCoordinates(pt) for pt in pts]
nkeys = []
for pt in pts:
    nkeys.append(s.check_node_exists(pt))
s.add_set(name='support_nodes', type='NODE', selection=nkeys)
supppots = FixedDisplacement(name='supports', nodes='support_nodes')
s.add_displacement(supppots)

# add materials and sections -----------------------------------------------
E = 40 * 10**9
v = .02
p = 2400
thickness = .02
matname = 'concrete'
concrete = ElasticIsotropic(name=matname, E=E, v=v, p=p)
s.add_material(concrete)
section = ShellSection(name='concrete_sec', t=thickness)
s.add_section(section)
prop = ElementProperties(name='floor',
                         material=matname,
                         section='concrete_sec',
                         elsets=['shell'])
s.add_element_properties(prop)

# add gravity load -------------------------------------------------------------

s.add_load(GravityLoad(name='load_gravity', elements=['shell']))

# add steps --------------------------------------------------------------------
Example #7
0
    
# Structure

mdl = Structure(name='beam_bathe', 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_support', 'nset_load'])

# Materials

mdl.add_material(ElasticIsotropic(name='mat_elastic', E=10**7, v=0.0001, p=1))

# Sections

mdl.add_section(RectangularSection(name='sec_rect', b=1, h=1))

# Properties

ep = Properties(name='ep', material='mat_elastic', section='sec_rect', elsets='elset_lines')
mdl.add_element_properties(ep)

# Displacements

mdl.add_displacement(FixedDisplacement(name='disp_fixed', nodes='nset_support'))

# Loads
Example #8
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
# 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'))
Example #10
0
mdl = Structure(name='beam_bathe', 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=10**7, v=10**(-5), p=1))

# 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_beams'))

# Displacements
Example #11
0
rhino.add_sets_from_layers(mdl, layers=['supports_bot', 'supports_top'])

# Sections

mdl.add_sections([
    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 * 10000 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_materials([
    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

s1 = ['struts_mushroom', 'joints_mushroom']
s2 = ['struts_bamboo', 'joints_bamboo']
s3 = ['joints_grid']
mdl.add_element_properties([
    Properties(name='ep_mushroom',
               material='mat_mushroom',
               section='sec_mushroom',
               elsets=s1),
    Properties(name='ep_bamboo',
               material='mat_bamboo',
Example #12
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
Example #13
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
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
Example #15
0
#print(len(mdl.sets['mesh_tets'].selection))

# Analyse

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'])
Example #16
0
Ly = 2
Lz = 1
bmesh = bmesh=draw_plane(Lx=Lx, Ly=Ly, dx=ds, dy=ds)
blender.mesh_extrude(mdl, bmesh=bmesh, layers=int(Lz/ds), thickness=ds, blocks_name='elset_blocks')

# Sets

pins = [[ds, ds, 0], [Lx - ds, ds, 0], [Lx - ds, Ly - ds, 0], [ds, Ly - ds, 0]]
supports = [mdl.check_node_exists(i) for i in pins]
top = [mdl.check_node_exists([Lx * 0.5, Ly * 0.5, Lz])]
mdl.add_set(name='nset_supports', type='node', selection=supports)
mdl.add_set(name='nset_load', type='node', selection=top)

# Materials

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

# Sections

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

# Properties

mdl.add_element_properties(
    Properties(name='ep_solid', material='mat_elastic', section='sec_solid', elsets='elset_blocks'))

# Displacements

mdl.add_displacement(PinnedDisplacement(name='disp_pinned', nodes='nset_supports'))

# Loads
Example #17
0
# 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_material(
    ElasticIsotropic(name='mat_linear', E=75 * 10**9, v=0.3, p=2700))

# Sections

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

# Properties

ep = Properties(name='ep',
                material='mat_linear',
                section='sec_plate',
                elsets='elset_mesh')
mdl.add_element_properties(ep)

# Displacements
Example #18
0
# Structure

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

# Elements

rhino.add_nodes_elements_from_layers(mdl, line_type='TrussElement', layers='elset_struts')

# Sets

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

# Materials

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

# Sections

mdl.add_section(TrussSection(name='sec_truss', A=0.00010))

# Properties

ep = Properties(name='ep_strut', material='mat_elastic', section='sec_truss', elsets='elset_struts')
mdl.add_element_properties(ep)

# Displacements

mdl.add_displacement(PinnedDisplacement(name='disp_pinned', nodes='nset_pins'))

# Loads
Example #19
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_material(ElasticIsotropic(name='mat_alu', E=75 * 10**9, v=0.3, p=2700))

# Sections

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

# Properties

ep = Properties(name='ep_plate',
                material='mat_alu',
                section='sec_plate',
                elsets='elset_mesh')
mdl.add_element_properties(ep)

# Displacements
Example #20
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
Example #21
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
Example #22
0
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_corners'])

# Materials

mdl.add_material(
    ElasticIsotropic(name='mat_elastic', E=100 * 10**9, v=0.3, p=1000))

# Sections

mdl.add_section(ShellSection(name='sec_plate', t=0.010))

# Properties

ep = Properties(name='ep_plate',
                material='mat_elastic',
                section='sec_plate',
                elsets='elset_mesh')
mdl.add_element_properties(ep)

# Displacements
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
Example #24
0
# Elements

blender.add_nodes_elements_from_layers(mdl,
                                       line_type='TrussElement',
                                       layers=[0])

# Sets

blender.add_elset_from_bmeshes(mdl, layer=0, name='elset_struts')
blender.add_nset_from_objects(mdl, layer=1, name='nset_pins')
blender.add_nset_from_objects(mdl, layer=2, name='nset_top')

# Materials

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

# Sections

mdl.add_section(TrussSection(name='sec_truss', A=0.00010))

# Properties

ep = Properties(name='ep_strut',
                material='mat_elastic',
                section='sec_truss',
                elsets='elset_struts')
mdl.add_element_properties(ep)

# Displacements