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
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
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.sets['loads']) #print(mdl.sets['supports']) #print(mdl.sets['area']) mdl.add(Concrete(name='concrete', fck=50)) #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'])
zmin, zmax = mdl.node_bounds()[2] nodes_top = [i for i, node in mdl.nodes.items() if node.z > zmax - 0.010] 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)
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', elsets=['shell']) s.add_element_properties(prop) # add gravity load ------------------------------------------------------------- s.add_load(GravityLoad(name='load_gravity', elements=['shell'])) # add steps -------------------------------------------------------------------- step = GeneralStep(name='gravity_step', nlgeom=False, displacements=['supports'], loads=['load_gravity'], type='static')
# print(mdl.sets['trusses']) # print(mdl.sets['supports']) # print(mdl.sets['loads']) mdl.add(Steel(name='steel', fy=355)) # print(mdl.materials['steel']) mdl.add(TrussSection(name='section', A=0.001)) # print(mdl.sections['section']) mdl.add( ElementProperties(name='property', material='steel', section='section', elset='trusses')) # print(mdl.element_properties['property']) mdl.add(PinnedDisplacement(name='pinned', nodes='supports')) # print(mdl.displacements['pinned']) mdl.add([ PointLoad(name='pointloads', nodes='loads', y=-50000), GravityLoad(name='gravity', elements='trusses', z=0, y=1), ]) # print(mdl.loads['pointloads']) # print(mdl.loads['gravity'])