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
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.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']) mdl.add(PinnedDisplacement(name='pinned', nodes='supports')) #print(mdl.displacements['pinned']) mdl.add([ GravityLoad(name='gravity', elements='mesh'), PointLoad(name='loads', nodes='loads', z=-1000), AreaLoad(name='pressure', elements='area', z=7000), ]) #print(mdl.loads['loads']) #print(mdl.loads['gravity']) #print(mdl.loads['pressure']) mdl.add([ GeneralStep(name='bc', displacements='pinned'),
# 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 boundary = network.leaves() mdl.add(PinnedDisplacement(name='disp', nodes=boundary)) # Loads mdl.add(PointLoad(name='load_weights', nodes='load_pts', z=-100)) # Steps mdl.add([ GeneralStep(name='step_bc', displacements=['disp']), GeneralStep(name='step_load', loads='load_weights'), ]) mdl.steps_order = ['step_bc', 'step_load'] # Summary
# 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.add(PinnedDisplacement(name='disp_pinned', nodes='nset_base')) # Loads mdl.add(PointLoad(name='load_top', nodes='nset_top', y=100, z=100)) # Steps mdl.add([ GeneralStep(name='step_bc', displacements=['disp_pinned']), GeneralStep(name='step_load', loads=['load_top']), ]) mdl.steps_order = ['step_bc', 'step_load'] # Summary
# Sections mdl.add(SolidSection(name='sec_solid')) # Properties mdl.add( Properties(name='ep_solid', material='mat_elastic', section='sec_solid', elset='elset_blocks')) # Displacements mdl.add(PinnedDisplacement(name='disp_pinned', nodes='nset_supports')) # Loads mdl.add(PointLoad(name='load_point', nodes='nset_load', z=-1)) # Steps mdl.add([ GeneralStep(name='step_bc', displacements=['disp_pinned']), GeneralStep(name='step_load', loads=['load_point']), ]) mdl.steps_order = ['step_bc', 'step_load'] # Structure
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) # make an extract faces slice
section='sec_planar', elset='elset_mesh'), Properties(name='ep_plate', material='mat_steel', section='sec_planar', elset='elset_plates'), Properties(name='ep_tie', material='mat_steel', section='sec_tie', elset='elset_tie'), ]) # Displacements mdl.add([ PinnedDisplacement(name='disp_pin', nodes='nset_pin'), RollerDisplacementX(name='disp_roller', nodes='nset_roller'), ]) # Loads loads = {} for i in rs.ObjectsByLayer('loads'): loads[mdl.check_node_exists(rs.PointCoordinates(i))] = { 'y': float(rs.ObjectName(i)) } mdl.add([ PointLoads(name='load_points', components=loads), PrestressLoad(name='load_prestress', elements='elset_tie', sxx=50 * 10**6), ])
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, elements=[i])) # Displacements mdl.add([ PinnedDisplacement(name='disp_left', nodes='nset_left'), GeneralDisplacement(name='disp_right', nodes='nset_right', y=0, z=0, xx=0), GeneralDisplacement(name='disp_rotate', nodes='nset_left', yy=30 * pi / 180), ]) # Loads mdl.add(PointLoad(name='load_weights', nodes='nset_weights', z=-100)) # Steps mdl.add([ GeneralStep(name='step_bc', displacements=['disp_left', 'disp_right']), GeneralStep(name='step_load',
# Sections mdl.add_section(SolidSection(name='sec_solid')) # Properties mdl.add_element_properties( Properties(name='ep_tets', material='mat_elastic', section='sec_solid', elsets='elset_tets')) # Displacementss mdl.add_displacement(PinnedDisplacement(name='disp_pinned', nodes='base')) # Loads mdl.add_load(PointLoad(name='load_top', nodes='top', y=1000, z=1000)) # Steps mdl.add_steps([ GeneralStep(name='step_bc', displacements=['disp_pinned']), GeneralStep(name='step_load', loads=['load_top']) ]) mdl.steps_order = ['step_bc', 'step_load'] # Summary
section='sec_mushroom', elsets=s1), Properties(name='ep_bamboo', material='mat_bamboo', section='sec_bamboo', elsets=s2), Properties(name='ep_joints', material='mat_bamboo', section='sec_joints', elsets=s3) ]) # Displacements mdl.add_displacements([ PinnedDisplacement(name='disp_bot', nodes='supports_bot'), RollerDisplacementZ(name='disp_top', nodes='supports_top') ]) # Loads mdl.add_load(GravityLoad(name='load_gravity', elements=layers)) # Steps mdl.add_steps([ GeneralStep(name='step_bc', displacements=['disp_bot', 'disp_top']), GeneralStep(name='step_loads', loads=['load_gravity']) ]) mdl.steps_order = ['step_bc', 'step_loads']
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, elements=[i])) # Displacements mdl.add([ FixedDisplacement(name='disp_left', nodes='nset_left'), PinnedDisplacement(name='disp_right', nodes='nset_right'), ]) # Loads mdl.add(GravityLoad(name='gravity', elements='all')) mdl.add(PointLoad(name='load_weights', nodes='nset_weights', z=-1000)) # Steps mdl.add([ GeneralStep(name='step_bc', displacements=['disp_left', 'disp_right']), GeneralStep(name='step_load', loads=['load_weights', 'gravity']), ]) mdl.steps_order = ['step_bc', 'step_load']
mdl.add_sections([ ShellSection(name='sec_concrete', t=0.020), TrussSection(name='sec_ties', A=0.0004)]) # Properties mdl.add_element_properties([ Properties(name='ep_concrete', material='mat_concrete', section='sec_concrete', elsets='elset_concrete'), Properties(name='ep_steel', material='mat_steel', section='sec_ties', elsets='elset_ties')]) # Displacements mdl.add_displacements([ RollerDisplacementXY(name='disp_roller', nodes='nset_corners'), PinnedDisplacement(name='disp_pinned', nodes='nset_corner1'), GeneralDisplacement(name='disp_xdof', nodes='nset_corner2', x=0)]) # Loads mesh = mesh_from_guid(Mesh(), rs.ObjectsByLayer('load_mesh')[0]) mdl.add_loads([ GravityLoad(name='load_gravity', elements='elset_concrete'), PrestressLoad(name='load_prestress', elements='elset_ties', sxx=50*10**6), TributaryLoad(mdl, name='load_tributary', mesh=mesh, z=-2000)]) # Steps mdl.add_steps([ GeneralStep(name='step_bc', displacements=['disp_roller', 'disp_pinned', 'disp_xdof']), GeneralStep(name='step_prestress', loads=['load_prestress']),
# 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 mdl.add_load(PointLoad(name='load_top', nodes='nset_top', z=-100000)) # Steps mdl.add_steps([ GeneralStep(name='step_bc', displacements='disp_pinned'), GeneralStep(name='step_load', loads='load_top', nlmat=False) ]) mdl.steps_order = ['step_bc', 'step_load'] # Summary
Properties(name='ep_bl', section='spring_elastic', elsets='spring_bot_left'), Properties(name='ep_br', section='spring_soft', elsets='spring_bot_right'), Properties(name='ep_tl', section='spring_elastic', elsets='spring_top_left'), Properties(name='ep_tr', section='spring_elastic', elsets='spring_top_right') ]) # Displacements mdl.add_displacements([ PinnedDisplacement(name='disp_pins', nodes='pins'), RollerDisplacementXZ(name='disp_roller', nodes='middle') ]) # Loads mdl.add_load(PointLoad(name='load_middle', nodes='middle', z=-500)) # Steps mdl.add_steps([ GeneralStep(name='step_bc', displacements=['disp_pins', 'disp_roller']), GeneralStep(name='step_load', loads=['load_middle']) ]) mdl.steps_order = ['step_bc', 'step_load']