mesh = mesh_from_guid(Mesh, rs.ObjectsByLayer('mesh')[0]) # add shell elements from mesh ------------------------------------------------- name = 'shell_example' s = Structure(name=name, path=compas_fea.TEMP) shell_keys = s.add_nodes_elements_from_mesh(mesh, element_type='ShellElement') s.add_set('shell', 'element', shell_keys) # add supports from rhino layer------------------------------------------------- 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',
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), ]) # Steps mdl.add([ GeneralStep(name='step_bc', displacements=['disp_pin', 'disp_roller']), GeneralStep(name='step_prestress', loads=['load_prestress']), GeneralStep(name='step_load', loads=['load_points']), ])
RollerDisplacementY(name='disp_bot', nodes='nset_bot'), ]) # Loads mdl.add(GravityLoad(name='load_gravity', elements='elset_mesh')) mesh = mesh_from_guid(Mesh(), rs.ObjectsByLayer('elset_mesh')[0]) point_loads = {} for key in mesh.vertices(): xyz = mesh.vertex_coordinates(key) pt = rs.ProjectPointToSurface([xyz], rs.ObjectsByLayer('surface')[0], [0, 0, 1])[0] pz = mesh.vertex_area(key) * distance_point_point(xyz, pt) * 2400 * 9.81 point_loads[mdl.check_node_exists(xyz)] = {'z': -pz} mdl.add(PointLoads(name='load_points', components=point_loads)) # Steps displacements = ['disp_top', 'disp_bot'] loads = ['load_gravity', 'load_points'] mdl.add([ GeneralStep(name='step_bc', displacements=displacements), GeneralStep(name='step_loads', loads=loads, factor=1.35), BucklingStep(name='step_buckle', loads=loads, displacements=displacements, modes=5), ])
Properties(name='ep_plinth', material='mat_concrete', section='sec_plinth', elsets='elset_plinth', reinforcement=reb_plinth), Properties(name='ep_wall', material='mat_concrete', section='sec_wall', elsets='elset_wall', reinforcement=reb_wall)]) # Displacements mdl.add_displacement(FixedDisplacement(name='disp_fixed', nodes='nset_fixed')) # Loads mdl.add_load(GravityLoad(name='load_gravity', elements=['elset_wall', 'elset_plinth'])) components = {} for guid in rs.ObjectsByLayer('nset_loads'): px, py, pz = rs.ObjectName(guid).split(' ') components[mdl.check_node_exists(rs.PointCoordinates(guid))] = {'z': float(pz)*100} mdl.add_load(PointLoads(name='load_points', components=components)) loads = ['load_gravity', 'load_points'] # Steps mdl.add_steps([ GeneralStep(name='step_bc', nlgeom=False, displacements=['disp_fixed']), GeneralStep(name='step_loads', nlgeom=False, loads=loads)]) mdl.steps_order = ['step_bc', 'step_loads'] # Summary mdl.summary() # Run (Abaqus)
# Structure mdl = Structure(name='beam_grid', path='C:/Temp/') # Beams beams = [i for i in rs.LayerNames() if i[:2] in ['BX', 'BY']] for beam in beams: network = rhino.network_from_lines(rs.ObjectsByLayer(beam)) axes = {'ex': [0, 1, 0]} if 'X' in beam else {'ex': [1, 0, 0]} mdl.add_nodes_elements_from_network(network=network, element_type='BeamElement', elset=beam, axes=axes) xyzs = [network.vertex_coordinates(i) for i in network.leaves()] ends = [mdl.check_node_exists(i) for i in xyzs] mdl.add_set('{0}_ends'.format(beam), type='node', selection=ends) # Sets rhino.add_sets_from_layers(mdl, layers=['lift_points'] + beams) # Materials mdl.add_material( ElasticIsotropic(name='mat_elastic', E=5 * 10**9, v=0.3, p=1000)) # Sections mdl.add_section(RectangularSection(name='sec_rectangular', h=0.005, b=0.005))
mdl = Structure(name='block_deepbeam', path='/home/al/temp/') # Mesh ds = 0.05 Lx = 1 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(
elsets='elset_wall', reinforcement=reb_wall) ]) # Displacements mdl.add_displacement(FixedDisplacement(name='disp_fixed', nodes='nset_fixed')) # Loads mdl.add_load( GravityLoad(name='load_gravity', elements=['elset_wall', 'elset_plinth'])) components = {} for object in get_objects(layer=2): px, py, pz, _ = object.name.split(' ') components[mdl.check_node_exists(list(object.location))] = { 'z': float(pz) * 100 } mdl.add_load(PointLoads(name='load_points', components=components)) loads = ['load_gravity', 'load_points'] # Steps mdl.add_steps([ GeneralStep(name='step_bc', nlgeom=False, displacements=['disp_fixed']), GeneralStep(name='step_loads', nlgeom=False, loads=loads) ]) mdl.steps_order = ['step_bc', 'step_loads'] # Summary
mdl = Structure(name='block_deepbeam', path='C:/Temp/') # Mesh ds = 0.05 Lx = 1 Ly = 2 Lz = 1 mesh = get_object_by_name(name='plane') blender.mesh_extrude(mdl, mesh=mesh, 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]] mdl.add_set(name='nset_supports', type='node', selection=[mdl.check_node_exists(i) for i in pins]) mdl.add_set(name='nset_load', type='node', selection=[mdl.check_node_exists([Lx * 0.5, Ly * 0.5, Lz])]) # 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
]) displacements = ['disp_top', 'disp_bot'] # Loads mdl.add_load(GravityLoad(name='load_gravity', elements='elset_mesh')) loads = ['load_gravity', 'load_points'] Gc = 2400 * 9.81 mesh = mesh_from_guid(Mesh(), rs.ObjectsByLayer('elset_mesh')[0]) surface = rs.ObjectsByLayer('surface')[0] point_loads = {} for key in mesh.vertices(): xyz = mesh.vertex_coordinates(key) node = mdl.check_node_exists(xyz) pt = rs.ProjectPointToSurface([xyz], surface, [0, 0, 1])[0] pz = mesh.vertex_area(key) * distance_point_point(xyz, pt) * Gc point_loads[node] = {'z': -pz} mdl.add_load(PointLoads(name='load_points', components=point_loads)) # Steps mdl.add_steps([ GeneralStep(name='step_bc', displacements=displacements), GeneralStep(name='step_loads', loads=loads, increments=300, factor=1.35), BucklingStep(name='step_buckle', loads=loads, displacements=displacements, modes=1) ])