| 
10 | 10 | 
  | 
11 | 11 | """  | 
12 | 12 | 
 
  | 
13 |  | -import os  | 
14 | 13 | from pyansys import examples  | 
15 | 14 | import pyansys  | 
16 | 15 | 
 
  | 
17 |  | -os.environ['I_MPI_SHM_LMT'] = 'shm'  # necessary on ubuntu  | 
18 |  | -mapdl = pyansys.launch_mapdl(override=True, additional_switches='-smp')  | 
 | 16 | + | 
 | 17 | +mapdl = pyansys.launch_mapdl(loglevel='ERROR')  | 
19 | 18 | 
 
  | 
20 | 19 | mapdl.cdread('db', examples.hexarchivefile)  | 
21 | 20 | mapdl.esel('s', 'ELEM', vmin=5, vmax=20)  | 
 | 
40 | 39 | 
 
  | 
41 | 40 | mapdl.mxpand(elcalc='YES')  | 
42 | 41 | mapdl.modal_analysis(nmode=6)  | 
43 |  | -mapdl.exit()  | 
44 | 42 | 
 
  | 
45 |  | -# view the results using pyansys's result viewer  | 
 | 43 | + | 
 | 44 | +###############################################################################  | 
 | 45 | +# View the results using the pyansys result object  | 
46 | 46 | result = mapdl.result  | 
47 |  | -result.animate_nodal_solution(0, show_edges=True, loop=False, displacement_factor=10,  | 
48 |  | -                              movie_filename='demo.gif')  | 
 | 47 | +print(result)  | 
 | 48 | + | 
 | 49 | + | 
 | 50 | +###############################################################################  | 
 | 51 | +# Access nodal displacement values  | 
 | 52 | +nnum, disp = result.nodal_displacement(0)  | 
 | 53 | + | 
 | 54 | +# print the nodes 50 - 59  | 
 | 55 | +for i in range(49, 59):  | 
 | 56 | +    print(nnum[i], disp[i])  | 
 | 57 | + | 
 | 58 | + | 
 | 59 | +###############################################################################  | 
 | 60 | +# Plot a modal result  | 
 | 61 | +result.plot_nodal_displacement(0, show_edges=True)  | 
 | 62 | + | 
 | 63 | + | 
 | 64 | +###############################################################################  | 
 | 65 | +# Animate a modal result  | 
 | 66 | +# result.animate_nodal_solution(0, show_edges=True, loop=False, displacement_factor=10,  | 
 | 67 | +                              # movie_filename='demo.gif')  | 
 | 68 | + | 
 | 69 | + | 
 | 70 | +###############################################################################  | 
 | 71 | +# Cleanup  | 
 | 72 | +# ~~~~~~~  | 
 | 73 | +# Close mapdl when complete  | 
 | 74 | +mapdl.exit()  | 
 | 75 | + | 
0 commit comments