|
@@ -5,48 +5,18 @@ import numpy as np
|
|
|
import os
|
|
|
|
|
|
|
|
|
-def plot_rotor(ansys):
|
|
|
- ansys.run("/Post1")
|
|
|
- ansys.run("ALLS")
|
|
|
- ansys.run("/erase")
|
|
|
- ansys.run("/win,1,ltop $/win,2,rtop")
|
|
|
- ansys.run("/win,3,lbot $/win,4,rbot")
|
|
|
- ansys.run("/win,1,off")
|
|
|
- ansys.run("/win,2,off")
|
|
|
- ansys.run("/win,3,off")
|
|
|
- ansys.run("/win,4,off")
|
|
|
- ansys.run("/win,1,on")
|
|
|
- ansys.plnsol("S", "X") # Stress in Radialrichtung
|
|
|
- ansys.run("/noerase")
|
|
|
- ansys.run("/win,1,off")
|
|
|
- ansys.run("/win,2,on")
|
|
|
- ansys.run("/view,2,0,0,-1")
|
|
|
- ansys.plnsol("S", "X") # Stress in Radialrichtung, Sicht von hinten
|
|
|
- ansys.run("/noerase")
|
|
|
- ansys.run("/win,2,off")
|
|
|
- ansys.run("/win,3,on")
|
|
|
- ansys.plnsol("S", "Y") # Stress in Tangentialrichtung
|
|
|
- ansys.run("/noerase")
|
|
|
- ansys.run("/win,3,off")
|
|
|
- ansys.run("/win,4,on")
|
|
|
- ansys.plnsol("U", "SUM")
|
|
|
- ansys.run("/noerase")
|
|
|
- ansys.run("/win,4,off")
|
|
|
- ansys.run("/EOF")
|
|
|
-
|
|
|
-
|
|
|
def sim_rotor(materials, angles, outer_diameter=250, inner_diameter=50, thickness=5, omega=0.1):
|
|
|
layers = len(angles)
|
|
|
layer_thickness = thickness / layers
|
|
|
|
|
|
path = os.getcwd()+"\\ws"
|
|
|
- mapdl = pyansys.launch_mapdl(run_location=path, interactive_plotting=True)
|
|
|
+ mapdl = pyansys.launch_mapdl(run_location=path, interactive_plotting=True, loglevel='ERROR')
|
|
|
# clear existing geometry
|
|
|
mapdl.finish()
|
|
|
mapdl.clear()
|
|
|
|
|
|
th = 200 # [°C] Herstellungstemperatur
|
|
|
- tn = 20 # [°C] Nutzungstemperatur
|
|
|
+ tn = 20 # [°C] Nutzungstemperatur
|
|
|
|
|
|
mapdl.prep7()
|
|
|
# define Material
|
|
@@ -73,19 +43,19 @@ def sim_rotor(materials, angles, outer_diameter=250, inner_diameter=50, thicknes
|
|
|
mapdl.mpdata("ALPZ", i + 1, "", materials[i]["alp33"])
|
|
|
|
|
|
# Waermeleitfaehigk
|
|
|
- # mapdl.mpdata("KXX", i + 1, "", materials[i]["k11"])
|
|
|
- # mapdl.mpdata("KYY", i + 1, "", materials[i]["k22"])
|
|
|
- # mapdl.mpdata("KZZ", i + 1, "", materials[i]["k33"])
|
|
|
+ mapdl.mpdata("KXX", i + 1, "", materials[i]["k11"])
|
|
|
+ mapdl.mpdata("KYY", i + 1, "", materials[i]["k22"])
|
|
|
+ mapdl.mpdata("KZZ", i + 1, "", materials[i]["k33"])
|
|
|
|
|
|
# Quellkoeffizient
|
|
|
- # mapdl.mpdata("BETX", i + 1, "", materials[i]["bet11"])
|
|
|
- # mapdl.mpdata("BETY", i + 1, "", materials[i]["bet22"])
|
|
|
- # mapdl.mpdata("BETZ", i + 1, "", materials[i]["bet33"])
|
|
|
+ mapdl.mpdata("BETX", i + 1, "", materials[i]["bet11"])
|
|
|
+ mapdl.mpdata("BETY", i + 1, "", materials[i]["bet22"])
|
|
|
+ mapdl.mpdata("BETZ", i + 1, "", materials[i]["bet33"])
|
|
|
|
|
|
# Diffusionskoeffizient
|
|
|
- # mapdl.mpdata("DXX", i + 1, "", materials[i]["d11"])
|
|
|
- # mapdl.mpdata("DYY", i + 1, "", materials[i]["d22"])
|
|
|
- # mapdl.mpdata("DZZ", i + 1, "", materials[i]["d33"])
|
|
|
+ mapdl.mpdata("DXX", i + 1, "", materials[i]["d11"])
|
|
|
+ mapdl.mpdata("DYY", i + 1, "", materials[i]["d22"])
|
|
|
+ mapdl.mpdata("DZZ", i + 1, "", materials[i]["d33"])
|
|
|
|
|
|
# define Element
|
|
|
mapdl.et(1, "SHELL181")
|
|
@@ -122,11 +92,9 @@ def sim_rotor(materials, angles, outer_diameter=250, inner_diameter=50, thicknes
|
|
|
mapdl.lsel("S", "", "", 2, 4, 2)
|
|
|
mapdl.lesize("ALL", "", "", 20)
|
|
|
mapdl.lsel("ALL")
|
|
|
- # mapdl.aplot()
|
|
|
mapdl.mshape(0, "2D") # quadratic 2D Shapes
|
|
|
mapdl.mshkey(1) # 0-free meshing
|
|
|
mapdl.amesh("ALL")
|
|
|
- # mapdl.eplot()
|
|
|
|
|
|
mapdl.run("/SOLU")
|
|
|
mapdl.omega("", "", omega) # [rad/s] Winkelgeschwindigkeit(+: gegen Uhrzeigersinn))
|
|
@@ -155,20 +123,30 @@ def sim_rotor(materials, angles, outer_diameter=250, inner_diameter=50, thicknes
|
|
|
|
|
|
result = pyansys.read_binary(resultfile)
|
|
|
# result = mapdl.result
|
|
|
- result.plot_principal_nodal_stress(0, 'EQV')
|
|
|
+ #result.plot_nodal_solution(0, 'x')
|
|
|
|
|
|
# plot_nodal_solution doesnt work
|
|
|
- nodenum, stress = result.principal_nodal_stress(0)
|
|
|
+ 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
|
|
|
- maxstress = np.nanmax(stress[:, -1])
|
|
|
+ srmax = np.nanmax(stress[:, -6])
|
|
|
+ stmax = np.nanmax(stress[:, -5])
|
|
|
|
|
|
mapdl.exit()
|
|
|
|
|
|
- return maxstress
|
|
|
-
|
|
|
+ return s1max, s2max, srmax, stmax
|
|
|
|
|
|
+"""
|
|
|
print(sim_rotor(
|
|
|
[{
|
|
|
"e11": 42.5,
|
|
@@ -194,3 +172,4 @@ print(sim_rotor(
|
|
|
"d22": 3.1E3,
|
|
|
"d33": 3.1E3
|
|
|
}], [90, 0, 0, 0, 0, 0]))
|
|
|
+"""
|