|
@@ -4,6 +4,8 @@ import pyansys
|
|
|
import numpy as np
|
|
|
import os
|
|
|
import time
|
|
|
+from scipy import sparse
|
|
|
+from scipy.sparse import linalg
|
|
|
|
|
|
|
|
|
def sim_rotor(materials, angles, outer_diameter=0.250, inner_diameter=0.050, thickness=0.005, omega=1):
|
|
@@ -118,6 +120,7 @@ def sim_rotor(materials, angles, outer_diameter=0.250, inner_diameter=0.050, thi
|
|
|
|
|
|
mapdl.esel("ALL")
|
|
|
|
|
|
+ # Read Stress
|
|
|
mapdl.run("/SOLU")
|
|
|
mapdl.csys(1)
|
|
|
mapdl.omega("", "", omega)
|
|
@@ -134,124 +137,50 @@ def sim_rotor(materials, angles, outer_diameter=0.250, inner_diameter=0.050, thi
|
|
|
mapdl.solve()
|
|
|
mapdl.finish()
|
|
|
|
|
|
- # """
|
|
|
- # mapdl.run("/INPUT, C:/Users/Willi/Documents/projects/gfk-plate/script/01_Modell.inp")
|
|
|
-
|
|
|
- # mapdl.solve()
|
|
|
- # mapdl.finish()
|
|
|
-
|
|
|
mapdl.run("/Post1")
|
|
|
|
|
|
result = mapdl.result
|
|
|
- # mapdl.aplot()
|
|
|
- # result.plot_principal_nodal_stress(0, '1', show_edges=True, show_axes=True)
|
|
|
- result.plot_nodal_solution(0, 'z', show_displacement=True)
|
|
|
- result.plot_principal_nodal_stress(0, 'S1', show_edges=True, show_axes=True)
|
|
|
+ # result.plot_nodal_solution(0, 'z', show_displacement=True)
|
|
|
+ # result.plot_principal_nodal_stress(0, 'S1', show_edges=True, show_axes=True)
|
|
|
|
|
|
# """
|
|
|
nodenump, stress = result.principal_nodal_stress(0)
|
|
|
-
|
|
|
- # von first principle stress is the first column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
-
|
|
|
- """
|
|
|
- mapdl.run('*GET, NODE_COUNT, NODE, ,COUNT')
|
|
|
- mapdl.run('*GET, ELEM_COUNT, ELEM, ,COUNT')
|
|
|
- mapdl.load_parameters()
|
|
|
- print(mapdl.parameters['NODE_COUNT'])
|
|
|
- print(mapdl.parameters['ELEM_COUNT'])
|
|
|
-
|
|
|
- s1max = angles
|
|
|
- s2max = angles
|
|
|
- srmax = angles
|
|
|
- stmax = angles
|
|
|
-
|
|
|
- for i in range(0, len(angles)):
|
|
|
- mapdl.run("LAYER, " + str(i + 1)) #
|
|
|
- mapdl.run("*DIM, DIM_TEST, ARRAY, ELEM_COUNT, 2")
|
|
|
- mapdl.run("ETABLE, TEST, S, 1, MAX")
|
|
|
- mapdl.run("*VGET, DIM_TEST(1,1), ETAB, TEST")
|
|
|
-
|
|
|
- mapdl.run("*DIM, OUT_STRESS, ARRAY, NODE_COUNT, 4")
|
|
|
- mapdl.run("*VGET, OUT_STRESS(1, 1), NODE,, S, 1")
|
|
|
- mapdl.run("*VGET, OUT_STRESS(1, 2), NODE,, S, 2")
|
|
|
- mapdl.run("*VGET, OUT_STRESS(1, 3), NODE,, S, X")
|
|
|
- mapdl.run("*VGET, OUT_STRESS(1, 4), NODE,, S, Y")
|
|
|
- params, arrays = mapdl.load_parameters()
|
|
|
- print(arrays['TEST'][0])
|
|
|
- s1max[i] = np.nanmax(arrays['OUT_STRESS'][:, 0])
|
|
|
- s2max[i] = np.nanmax(arrays['OUT_STRESS'][:, 1])
|
|
|
- srmax[i] = np.nanmax(arrays['OUT_STRESS'][:, 2])
|
|
|
- stmax[i] = np.nanmax(arrays['OUT_STRESS'][:, 3])
|
|
|
-
|
|
|
- # print(str(element_stress[0]))
|
|
|
- # s1max = np.nanmax(stresses)
|
|
|
- # nodenump, stress = result.principal_nodal_stress(0)
|
|
|
- # s1max[i] = np.nanmax(element_stress[:, -5])
|
|
|
-
|
|
|
- s1max = np.nanmax(s1max)
|
|
|
- s2max = np.nanmax(s2max)
|
|
|
- srmax = np.nanmax(srmax)
|
|
|
- stmax = np.nanmax(stmax)
|
|
|
- # """
|
|
|
- nodenump, stress = result.principal_nodal_stress(0)
|
|
|
-
|
|
|
- # von first principle stress is the first column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
s1max = np.nanmax(stress[:, -5])
|
|
|
-
|
|
|
- # von second principle stress is the first column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
s2max = np.nanmax(stress[:, -4])
|
|
|
|
|
|
nodenum, stress = result.nodal_stress(0)
|
|
|
- # von Mises stress is the last column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
srmax = np.nanmax(stress[:, -6])
|
|
|
stmax = np.nanmax(stress[:, -5])
|
|
|
- # von second principle stress is the first column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
- #s2max = np.nanmax(stress[:, -4])
|
|
|
-
|
|
|
- #nodenum, stress = result.nodal_stress(0)
|
|
|
- # von Mises stress is the last column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
- #srmax = np.nanmax(stress[:, -6])
|
|
|
- #stmax = np.nanmax(stress[:, -5])
|
|
|
-
|
|
|
- print(str(s1max))
|
|
|
|
|
|
+ # Modual-Analysis
|
|
|
# """
|
|
|
+ mapdl.run("/SOLU")
|
|
|
+ mapdl.csys(1)
|
|
|
+ mapdl.omega("", "", omega)
|
|
|
+ mapdl.nsel("S", "LOC", "X", inner_diameter / 2)
|
|
|
+ mapdl.d("ALL", "UX", 0)
|
|
|
+ mapdl.d("ALL", "UY", 0)
|
|
|
+ mapdl.nsel("R", "LOC", "Z", 0)
|
|
|
+ mapdl.d("ALL", "UZ", 0)
|
|
|
+ mapdl.run("ALLS")
|
|
|
+ mapdl.outres("ALL", "ALL")
|
|
|
|
|
|
- """
|
|
|
- # access results using ANSYS object
|
|
|
- resultfile = os.getcwd() + '\\ws\\file.rst'
|
|
|
- result = pyansys.read_binary(resultfile)
|
|
|
-
|
|
|
- # plot_nodal_solution doesnt work
|
|
|
- nodenump, stress = result.principal_nodal_stress(0)
|
|
|
-
|
|
|
- # von first principle stress is the first column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
- s1max = np.nanmax(stress[:, -5])
|
|
|
+ mapdl.antype("MODAL")
|
|
|
+ mapdl.modopt("lanb", 3)
|
|
|
+ mapdl.mxpand("", "", "", "yes")
|
|
|
|
|
|
- # von second principle stress is the first column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
- s2max = np.nanmax(stress[:, -4])
|
|
|
+ mapdl.solve()
|
|
|
+ mapdl.finish()
|
|
|
+
|
|
|
+ mapdl.run("/Post1")
|
|
|
|
|
|
- nodenum, stress = result.nodal_stress(0)
|
|
|
- # von Mises stress is the last column
|
|
|
- # must be nanmax as the shell element stress is not recorded
|
|
|
- srmax = np.nanmax(stress[:, -6])
|
|
|
- stmax = np.nanmax(stress[:, -5])
|
|
|
+ result = mapdl.result
|
|
|
+ f = result.time_values
|
|
|
|
|
|
- print(str(s1max))
|
|
|
- # result.plot_nodal_solution(0)
|
|
|
- # """
|
|
|
mapdl.exit()
|
|
|
time.sleep(0.5)
|
|
|
|
|
|
- return s1max, s2max, srmax, stmax
|
|
|
+ return s1max, s2max, srmax, stmax, f[0], f[1], f[2]
|
|
|
|
|
|
|
|
|
print(sim_rotor(
|