@@ -1077,12 +1077,11 @@ def calculate_stress(self, N=0, Vx=0, Vy=0, Mxx=0, Myy=0, M11=0, M22=0, Mzz=0):
10771077 self .section_props .area ,
10781078 self .section_props .ixx_c ,
10791079 self .section_props .cx ,
1080- self .section_props .j ,
10811080 ]:
10821081 err = "Perform a geometric analysis before carrying out a stress analysis."
10831082 raise RuntimeError (err )
10841083
1085- if self .section_props .omega is None and (Vx == 0 or Vy == 0 or Mzz = = 0 ):
1084+ if self .section_props .omega is None and (Vx != 0 or Vy != 0 or Mzz ! = 0 ):
10861085 err = "Perform a warping analysis before carrying out a stress analysis "
10871086 err += "with non-zero shear forces or torsion moment."
10881087 raise RuntimeError (err )
@@ -1118,6 +1117,16 @@ def calc_stress(progress=None):
11181117
11191118 # loop through all elements in the material group
11201119 for el in group .elements :
1120+ # get element omega and psi
1121+ if self .section_props .omega is None :
1122+ omega_el = None
1123+ psi_shear_el = None
1124+ phi_shear_el = None
1125+ else :
1126+ omega_el = self .section_props .omega [el .node_ids ]
1127+ psi_shear_el = self .section_props .psi_shear [el .node_ids ]
1128+ phi_shear_el = self .section_props .phi_shear [el .node_ids ]
1129+
11211130 (
11221131 sig_zz_n_el ,
11231132 sig_zz_mxx_el ,
@@ -1151,9 +1160,9 @@ def calc_stress(progress=None):
11511160 phi ,
11521161 j ,
11531162 nu ,
1154- self . section_props . omega [ el . node_ids ] ,
1155- self . section_props . psi_shear [ el . node_ids ] ,
1156- self . section_props . phi_shear [ el . node_ids ] ,
1163+ omega_el ,
1164+ psi_shear_el ,
1165+ phi_shear_el ,
11571166 Delta_s ,
11581167 )
11591168
@@ -2217,6 +2226,12 @@ def get_stress_at_points(
22172226 :rtype: List[Union[Tuple[float, float, float], None]]
22182227 """
22192228
2229+ # ensure warping analysis completed for shear and torsion
2230+ if self .section_props .omega is None and (Vx != 0 or Vy != 0 or Mzz != 0 ):
2231+ err = "Perform a warping analysis before carrying out a stress analysis "
2232+ err += "with non-zero shear forces or torsion moment."
2233+ raise RuntimeError (err )
2234+
22202235 action = {
22212236 "N" : N ,
22222237 "Mxx" : Mxx ,
@@ -2254,26 +2269,46 @@ def get_stress_at_points(
22542269 sig = None
22552270 elif len (tri_ids ) == 1 :
22562271 tri = self .elements [tri_ids [0 ]]
2272+
2273+ if self .section_props .omega is None :
2274+ omega_el = None
2275+ psi_shear_el = None
2276+ phi_shear_el = None
2277+ else :
2278+ omega_el = self .section_props .omega [tri .node_ids ]
2279+ psi_shear_el = self .section_props .psi_shear [tri .node_ids ]
2280+ phi_shear_el = self .section_props .phi_shear [tri .node_ids ]
2281+
22572282 sig = tri .local_element_stress (
22582283 p = pt ,
22592284 ** action ,
22602285 ** sect_prop ,
2261- omega = self . section_props . omega [ tri . node_ids ] ,
2262- psi_shear = self . section_props . psi_shear [ tri . node_ids ] ,
2263- phi_shear = self . section_props . phi_shear [ tri . node_ids ] ,
2286+ omega = omega_el ,
2287+ psi_shear = psi_shear_el ,
2288+ phi_shear = phi_shear_el ,
22642289 )
22652290 else :
22662291 sigs = []
22672292 for idx in tri_ids :
22682293 tri = self .elements [idx ]
2294+
2295+ if self .section_props .omega is None :
2296+ omega_el = None
2297+ psi_shear_el = None
2298+ phi_shear_el = None
2299+ else :
2300+ omega_el = self .section_props .omega [tri .node_ids ]
2301+ psi_shear_el = self .section_props .psi_shear [tri .node_ids ]
2302+ phi_shear_el = self .section_props .phi_shear [tri .node_ids ]
2303+
22692304 sigs .append (
22702305 tri .local_element_stress (
22712306 p = pt ,
22722307 ** action ,
22732308 ** sect_prop ,
2274- omega = self . section_props . omega [ tri . node_ids ] ,
2275- psi_shear = self . section_props . psi_shear [ tri . node_ids ] ,
2276- phi_shear = self . section_props . phi_shear [ tri . node_ids ] ,
2309+ omega = omega_el ,
2310+ psi_shear = psi_shear_el ,
2311+ phi_shear = phi_shear_el ,
22772312 )
22782313 )
22792314 sig = (
0 commit comments