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
示例#2
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
])

#print(mdl.loads['loads'])
#print(mdl.loads['gravity'])
#print(mdl.loads['pressure'])

mdl.add([
    GeneralStep(name='bc', displacements='pinned'),
    GeneralStep(name='loads',
                loads=['gravity', 'loads', 'pressure'],
                factor=1.5),
    BucklingStep(name='buckling',
                 modes=3,
                 loads=['gravity', 'loads', 'pressure'],
                 displacements='pinned'),
    ModalStep(name='modal', modes=3),
])
mdl.steps_order = ['bc', 'loads', 'buckling', 'modal']

#print(mdl.steps['bc'])
#print(mdl.steps['loads'])
#print(mdl.steps['buckling'])
#print(mdl.steps['modal'])

#mdl.summary()

# Run

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

rhino.plot_data(mdl, step='loads', field='um')
        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'))

# Steps

mdl.add([
    GeneralStep(name='step_bc', displacements=['disp_pinned']),
    ModalStep(name='step_modal', modes=5),
])
mdl.steps_order = ['step_bc', 'step_modal']

# Summary

mdl.summary()

# Run

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

rhino.plot_mode_shapes(mdl, step='step_modal', layer='mode-')

print(mdl.results['step_modal']['frequencies'])
print(mdl.results['step_modal']['masses'])