def NAangle(span_position): M_x, M_y = internal_moments(z) I_xx, I_yy, I_xy = MOI(z) y = M_y * I_xx - M_x * I_xy x = M_x * I_yy - M_y * I_xy alpha = atan2(y, x) return alpha * 180 / pi
def Normalstress(span_position): M_x, M_y = internal_moments(z) I_xx, I_yy, I_xy = MOI(z) width, frontheight, rearheight = initial_values(z)[2:5] centroidx, centroidy = centroid(z) #x1, y1 = -0.5 * width - centroidx, 0.5 * rearheight - centroidy #x2, y2 = 0.5 * width - centroidx, 0.5 * frontheight - centroidy x3, y3 = 0.5 * width - centroidx, -0.5 * frontheight - centroidy x4, y4 = -0.5 * width - centroidx, -0.5 * rearheight - centroidy #sigma1 = ((M_x * I_yy - M_y * I_xy) * y1 + (M_y * I_xx - M_x * I_xy) * x1) / (I_xx * I_yy - I_xy ** 2) #sigma2 = ((M_x * I_yy - M_y * I_xy) * y2 + (M_y * I_xx - M_x * I_xy) * x2) / (I_xx * I_yy - I_xy ** 2) sigma3 = ((M_x * I_yy - M_y * I_xy) * y3 + (M_y * I_xx - M_x * I_xy) * x3) / (I_xx * I_yy - I_xy**2) sigma4 = ((M_x * I_yy - M_y * I_xy) * y4 + (M_y * I_xx - M_x * I_xy) * x4) / (I_xx * I_yy - I_xy**2) return -sigma3, -sigma4 #, -sigma3, -sigma4
b = 27.14 dz = 0.1 z = 0.1 k1c = 35.1 c = 0.0025 sigmastar = k1c / (sqrt(pi * c)) sigma1tab, sigma2tab, sigma3tab, sigma4tab = [], [], [], [] alphatab, ztab, ztab1, ztab2, ztab3, ztab4, M_xtab, M_ytab = [], [], [], [], [], [], [], [] I_xxtab, I_yytab, I_xytab = [], [], [] while z <= b: sigma1, sigma2, sigma3, sigma4 = Normalstress(z) M_x, M_y = internal_moments(z) I_xx, I_yy, I_xy = MOI(z) ztab.append(z) alphatab.append(NAangle(z)) sigma1margin = sigmastar / (sigma1 / 10**6) sigma2margin = sigmastar / (sigma2 / 10**6) sigma3margin = sigmastar / (sigma3 / 10**6) sigma4margin = sigmastar / (sigma4 / 10**6) if abs(sigma1 / 10**6) >= 1: sigma1tab.append(sigma1margin) ztab1.append(z) if abs(sigma2 / 10**6) >= 1: sigma2tab.append(sigma2margin) ztab2.append(z) if abs(sigma3 / 10**6) >= 1: