Beispiel #1
0
def harmonic_pressure(mesh, pts, freq_list, path, name, damping):
    # add shell elements from mesh ---------------------------------------------
    s = structure.Structure()
    s.add_nodes_elements_from_mesh(mesh, element_type='ShellElement')
    s.add_set(name='all_elements', type='element', selection=s.elements.keys())

    # add virtual elements -----------------------------------------------------

    for fkey in list(mesh.faces()):
        face = [
            s.check_node_exists(mesh.vertex_coordinates(i))
            for i in mesh.face[fkey]
        ]
        s.add_virtual_element(nodes=face, type='FaceElement')

    # add displacements --------------------------------------------------------
    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(name='shell_props',
                             material='MAT_CONCRETE',
                             section='SEC_CONCRETE',
                             elsets=['all_elements'])
    s.add_element_properties(prop)

    # add loads ----------------------------------------------------------------

    load = HarmonicPressureLoad(name='pressureload',
                                elements=['virtual_elements'],
                                pressure=3.,
                                phase=math.pi / 2.)
    s.add_load(load)

    # add modal step -----------------------------------------------------------
    step = HarmonicStep(name='harmonic_analysis',
                        displacements=['supports'],
                        loads=['pressureload'],
                        freq_list=freq_list,
                        damping=damping)
    s.add_step(step)
    s.set_steps_order(['harmonic_analysis'])

    # analysis -----------------------------------------------------------------
    s.path = path
    s.name = name
    fields = ['all']
    s.write_input_file('ansys', fields=fields)
    s.analyse(software='ansys', cpus=4)
    s.extract_data(software='ansys', fields=fields, steps='last')
    return s
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
Beispiel #3
0
def harmonic(geom_file, freq_range, freq_steps, damping):
    # 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 loads ----------------------------------------------------------------
    f_pts = geom_data['f_pts']
    nodes = [s.check_node_exists(pt) for pt in f_pts]
    s.add_set(name='load_nodes', type='NODE', selection=nodes)
    load = PointLoad(name='hload',
                     nodes='load_nodes',
                     x=0,
                     y=0,
                     z=1,
                     xx=0,
                     yy=0,
                     zz=0)
    s.add_load(load)

    # add modal step -----------------------------------------------------------
    step = HarmonicStep(name='harmonic_analysis',
                        displacements=['supports'],
                        loads=['hload'],
                        freq_range=freq_range,
                        freq_steps=freq_steps,
                        damping=damping)
    s.add_step(step)
    fnm = path + 'harmonic.inp'
    ansys.inp_generate(s, filename=fnm)
    # temp = path+'_Temp/'
    s.analyse(path=path, name='harmonic.inp', temp=None, software='ansys')
    return s
Beispiel #4
0
#-------------------------------------------------------------------------------

# Sections
mdl.add(CircularSection(name='sec_beam', r=0.2))
#-------------------------------------------------------------------------------

# Properties
mdl.add(
    Properties(name='ep_beam',
               material='mat_elastic',
               section='sec_beam',
               elset='elset_beams'))
#-------------------------------------------------------------------------------

# Displacements
mdl.add(FixedDisplacement(name='disp_fixed', nodes='nset_support'))
#-------------------------------------------------------------------------------

# Loads
mdl.add(PointLoad(name='load_point', nodes='nset_load', z=-1100.99))
#-------------------------------------------------------------------------------

# Steps
mdl.add([
    GeneralStep(name='step_bc', displacements=['disp_fixed']),
    GeneralStep(name='step_load', loads=['load_point']),
])
mdl.steps_order = ['step_bc', 'step_load']
#-------------------------------------------------------------------------------

# Summary
# 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',
                         material=matname,
                         section='concrete_sec',
Beispiel #6
0
reb_wall = {
    'w_u1': {'pos': +0.055, 'spacing': 0.100, 'material': 'mat_rebar', 'dia': 0.010, 'angle': 0},
    'w_u2': {'pos': +0.045, 'spacing': 0.100, 'material': 'mat_rebar', 'dia': 0.010, 'angle': 90},
    'w_l2': {'pos': -0.045, 'spacing': 0.100, 'material': 'mat_rebar', 'dia': 0.010, 'angle': 90},
    'w_l1': {'pos': -0.055, 'spacing': 0.100, 'material': 'mat_rebar', 'dia': 0.010, 'angle': 0}}

mdl.add_element_properties([
    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']),
Beispiel #7
0
# Sections

mdl.add(ShellSection(name='sec_shell', t=0.01))

# Properties

mdl.add(
    Properties(name='ep_shell',
               material='mat_steel',
               section='sec_shell',
               elset='elset_shells'))

# Displacements

mdl.add(FixedDisplacement(name='disp_pins', nodes=[0, 2, 8, 6]))

# Loads

mdl.add(PointLoad(name='load_v', nodes=[4], z=-1000))

# Steps

mdl.add(
    GeneralStep(name='step_bc_loads',
                displacements=['disp_pins'],
                loads=['load_v'],
                nlgeom=False))
mdl.steps_order = ['step_bc_loads']

# Summary
                                        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([
    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']
Beispiel #9
0
# Materials

mdl.add(ElasticIsotropic(name='mat_1', E=20*10**9, v=0.3, p=1500))
mdl.add(ElasticIsotropic(name='mat_2', E=30*10**9, v=0.3, p=1500))

# Sections

mdl.add(RectangularSection(name='bsec', b=0.1, h=.2))
mdl.add(Properties(name='ep_1', material='mat_1', section='bsec', elsets=['beams']))

mdl.add(ShellSection(name='ssec', t=.1))
mdl.add(Properties(name='ep_2', material='mat_2', section='ssec', elsets=['shell']))

# Displacements

mdl.add([FixedDisplacement(name='supports', nodes='supports')])

# Loads

mdl.add(GravityLoad(name='load_gravity', elements=['beams', 'shell']))

# Steps

mdl.add([
    GeneralStep(name='step_bc', displacements=['supports']),
    GeneralStep(name='step_load', loads=['load_gravity']),
])
mdl.steps_order = ['step_bc', 'step_load']

# Summary