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"

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)
Ejemplo n.º 2
0
    # vib = VibroStructure.from_mesh(model, mesh, frequencies=frequencies, tol='4f')
    # vib.compute_diffuse_field_loads(num_waves, uniform=False)
    # vib.plot_pressure_loads()

    # # from mesh --------------------------------------------------------------

    import json
    from compas_vibro.datastructures import VibroMesh
    from compas_vibro.vibro import make_velocities_pattern_mesh

    # model = 'shell_leuven.json'
    model = 'flat20x20.json'
    # model = 'flat10x10.json'
    # model = 'face_areas16x16.json'

    with open(compas_vibro.get(model), 'r') as fp:
        data = json.load(fp)
    vmesh = VibroMesh.from_data(data['mesh'])

    frequencies = [50]
    vib = VibroStructure.from_mesh(mesh=vmesh, frequencies=frequencies)

    for frkey in vib.frequencies:
        v = make_velocities_pattern_mesh(vmesh, 3, .5, complex=True)
        vib.set_node_velocities(frkey, v)

    vib.compute_radiation()
    # vib.plot_radiation(0)
    vib.plot_radiation_vtk(0)

    print(vib)
Ejemplo n.º 3
0
    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)
    waves = generate_uniform_waves_numpy()
    frequencies = range(20, 500, 10)
    c = 340.0
    fields = compute_pressure_fields_mesh(waves, mesh, frequencies, c, center=True)
    v = PressureFieldViewer(fields, mesh=mesh)
    v.real = True
    v.show()
Ejemplo n.º 4
0
    mesh = vibro.mesh
    for fk in vibro.frequencies:
        freq = 'loads' + str(vibro.frequencies[fk]) + 'Hz'
        loads = vibro.diffuse_field_loads[fk]
        if real:
            loads = [l.real for l in loads]
        else:
            loads = [l.imag for l in loads]
        maxl = max(loads)
        minl = min(loads)
        sloads = [(l - minl) / (maxl - minl) for l in loads]
        color = {i: i_to_rgb(l) for i, l in enumerate(sloads)}
        mesh_draw(mesh, facecolor=color, layer=freq, clear_layer=True)


if __name__ == '__main__':
    import rhinoscriptsyntax as rs
    import compas_vibro
    from compas_vibro.cad import rhino_plotter
    from compas_vibro.datastructures import VibroStructure

    for i in range(30):
        print ''
    rs.DeleteObjects(rs.ObjectsByLayer('Default'))

    model = 'diffuse_field_example.json'
    filepath = compas_vibro.get(model)

    vibro = VibroStructure.from_json(filepath)
    plot_diffuse_loads(vibro, real=True)