from compas_vibro.viewers import HarmonicViewer __author__ = ["Tomas Mendez Echenagucia"] __copyright__ = "Copyright 2020, Design Machine Group - University of Washington" __license__ = "MIT License" __email__ = "*****@*****.**" __version__ = "0.1.0" path = compas_vibro.TEMP geometry = 'clt_1_remeshed' name = '{0}_radiation'.format(geometry) mesh = Mesh.from_json(compas_vibro.get('{0}.json'.format(geometry))) # make an instance of the stucture object - - - - - - - - - - - - - - - - - - - s = Structure(path, name) # add nodes and elements from mesh - - - - - - - - - - - - - - - - - - - - - - - s.add_nodes_elements_from_mesh(mesh, 'ShellElement', elset='shell') # add displacements - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # d = FixedDisplacement('boundary', mesh.vertices_on_boundary()) # s.add(d) bv = { vk for fk in mesh.faces_where({'is_boundary': True}) for vk in mesh.face_vertices(fk) } d = FixedDisplacement('boundary', list(bv)) s.add(d)
__copyright__ = "Copyright 2020, Design Machine Group - University of Washington" __license__ = "MIT License" __email__ = "*****@*****.**" __version__ = "0.1.0" for i in range(60): print() path = compas_vibro.TEMP geometry = 'mesh_flat_20x20' name = 'ansys_{0}_harmonic_s'.format(geometry) mesh = Mesh.from_json(compas_vibro.get('{0}.json'.format(geometry))) # make an instance of the stucture object - - - - - - - - - - - - - - - - - - - s = Structure(path, name) # add nodes and elements from mesh - - - - - - - - - - - - - - - - - - - - - - - s.add_nodes_elements_from_mesh(mesh, 'ShellElement', elset='shell') # add displacements - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - d = FixedDisplacement('boundary', mesh.vertices_on_boundary()) s.add(d) # add loads - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - load = PointLoad(name='pload', nodes=[100], x=0, y=0, z=1, xx=0, yy=0, zz=0) s.add(load) # add sections - - - - - - - - - - - - section = ShellSection('shell_sec', t=.1) s.add(section)
__author__ = ["Tomas Mendez Echenagucia"] __copyright__ = "Copyright 2020, Design Machine Group - University of Washington" __license__ = "MIT License" __email__ = "*****@*****.**" __version__ = "0.1.0" for i in range(60): print('') path = compas_vibro.TEMP # geometry = 'pringle' geometry = 'mesh_flat_20x20' name = 'ansys_{0}_modal'.format(geometry) mesh = Mesh.from_json(compas_vibro.get('{0}.json'.format(geometry))) s = Structure(path, name) s.add_nodes_elements_from_mesh(mesh, 'ShellElement', elset='shell') d = FixedDisplacement('boundary', mesh.vertices_on_boundary()) s.add(d) section = ShellSection('shell_sec', t=.1) s.add(section) material = ElasticIsotropic('concrete', E=30e9, v=.2, p=2400) s.add(material) el_prop = ElementProperties('concrete_shell', material='concrete', section='shell_sec',
def node_xyz(self, node): """ Return the xyz co-ordinates of a node. Parameters ---------- node : int Node number. Returns ------- list [x, y, z] co-ordinates. """ return [getattr(self.nodes[node], i) for i in 'xyz'] if __name__ == "__main__": for i in range(60): print('') from compas_vibro.structure import Structure import compas_vibro path = compas_vibro.TEMP name = 'test_vibro' s = Structure(path, name) s.add_node([0, 0, 0]) print(s.node_index)
fields[f] = {ek: P[i] for i, ek in enumerate(eks)} return fields if __name__ == '__main__': import os import compas_vibro from compas.datastructures import Mesh from compas_vibro.viewers import PressureFieldViewer from compas_vibro.structure import Structure for i in range(50): print('') filepath = os.path.join(compas_vibro.DATA, 'clt_1_remeshed_radiation.obj') s = Structure.from_obj(filepath) frequencies = range(20, 500, 10) waves = generate_uniform_waves_numpy() fields = compute_pressure_fields_structure(waves, s, frequencies, center=True) v = PressureFieldViewer(fields, structure=s) v.real = True v.show() num_waves = 500 model = 'flat_mesh_20x20.json' # model = 'clt_2.json' mesh = Mesh.from_json(compas_vibro.get(model)) # waves = generate_random_waves_numpy(num_waves)
import os import compas_vibro from compas_vibro.structure import Structure for i in range(50): print('') name = 'mesh_flat_20x20_radiation.obj' s = Structure.from_obj(os.path.join(compas_vibro.DATA, name)) print(s.results['modal'][0].frequency)
elif elset: eks = structure.sets[elset].selection sec = structure.element_properties[ep].section t = structure.sections[sec].geometry['t'] for ek in eks: nodes = structure.elements[ek].nodes vert = [structure.nodes[nk].xyz() for nk in nodes] n = scale_vector(normalize_vector(normal_polygon(vert)), t / 2.) n_ = scale_vector(n, -1) v_out = [add_vectors(v, n) for v in vert] v_in = [add_vectors(v, n_) for v in vert] s1 = rs.AddSrfPt(v_out) s2 = rs.AddSrfPt(v_in) srfs = [s1, s2] for i in range(len(v_in)): srf = rs.AddSrfPt( [v_in[-i], v_in[-i - 1], v_out[-i - 1], v_out[-i]]) if srf: srfs.append(srf) rs.JoinSurfaces(srfs, delete_input=True) if __name__ == '__main__': import os import compas_vibro from compas_vibro.structure import Structure rs.DeleteObjects(rs.ObjectsByLayer('Default')) fpath = os.path.join(compas_vibro.TEMP, 'clt_1_remeshed_field.obj') s = Structure.from_obj(fpath) plot_structure(s)