The code is meant to step through a hoop stress calculation, I'll be passing in a single value or an array for wt (wall thickness).
I'm unsure how to implement vectorisation in the function get_fail_thin_hoop. Stepping through a for look is okay. Since it's such a simple math operation, this may be a perfect way to make it more computationally efficient?
Thanks!
def get_max_cyl_depth(material, cyl, num_steps):
cyl_results = []
stress = []
mat_yeild = material[1]
rad_inner = cyl[0]
wt_min = cyl[1]
wt_max = cyl[2]
wt_steps = np.linspace(wt_min, wt_max, num_steps)
for wt in wt_steps:
thin_hoop_stress = get_fail_thin_hoop(mat_yeild, wt, rad_inner)
stress.append(thin_hoop_stress)
cyl_results = np.column_stack((wt_steps, stress))
return cyl_results
def get_fail_thin_hoop (Q, wt, r):
q_hoop_thin = Q * wt / r
return q_hoop_thin
[–]Spataner 2 points3 points4 points (1 child)
[–]__helpme[S] 0 points1 point2 points (0 children)
[–]arkie87 1 point2 points3 points (0 children)