import numpy as np import calc_prism as cp y = 10.0 v = 10.0 ys = np.arange(0.001,10.0,0.001) p_circ = {} p_circ['y'] = 7.34 p_circ['g'] = 32.2 p_circ['Q'] = 262. p_circ['d'] = 9.18 a_circ = cp.area_circ(p_circ) print a_circ b_circ = cp.width_circ(p_circ) print b_circ p_circ['v'] = 262.0/a_circ f_circ = cp.f_circ(p_circ) print f_circ
import pylab import calc_prism as cp delta_z = 3.279 p_circ = {} p_circ["Q"] = 262.0 p_circ["d"] = 9.18 p_circ["y"] = 7.34 p_circ["g"] = 32.2 a = cp.area_circ(p_circ) b = cp.width_circ(p_circ) p_circ["v"] = p_circ["Q"] / a e = cp.e_circ(p_circ) f = cp.f_circ(p_circ) print a, b, e, f e2 = e - delta_z p_rect = {} p_rect["g"] = 32.3 p_rect["b"] = 6.56 p_rect["q"] = p_circ["Q"] / 6.56 yc2 = cp.yc_rect(p_rect) p_rect["y"] = yc2 ec2 = cp.e_rect(p_rect) print yc2, ec2 if e2 < ec2: print "choking downstream" new_e1 = ec2 + delta_z
import numpy as np import calc_prism as cp p_dict = {} p_dict['g'] = 9.81 p_dict['d'] = 1.8 p_dict['y'] = 0.7 p_dict['Q'] = 2.8 f = cp.f_circ(p_dict) m = cp.m_circ(p_dict) y = np.arange(0.0001,1.7,0.0001) conj_ys = cp.find_depths(m,y,p_dict,cp.m_circ) print f,conj_ys
#f = find_f(re) #lhs = (p_dict['Q'] * (f**0.5)) / ((8.0 * p_dict['g'] * s)**0.5) #rhs = cp.area_circ(p_dict) * cp.r_circ(p_dict)**0.5 lhs = (cp.area_circ(p_dict)**(5.0 / 3.0)) / (cp.p_circ(p_dict) **(2.0 / 3.0)) this_r = abs(lhs - rhs) if this_r < r: r = this_r correct_y1 = y print 'y,', correct_y1 p_dict['y'] = correct_y1 p_dict['v'] = p_dict['Q'] / cp.area_circ(p_dict) froude = cp.f_circ(p_dict) print 'v,fr', p_dict['v'], froude p_dict['Q'] = 0.2 rhs = (n * p_dict['Q']) / (kn * (s**0.5)) r = 1.0e+20 correct_y1 = -999 correct_f = -999 correct_re = -999 for y in Y: p_dict['y'] = y #re = cp.re_circ(p_dict) #f = find_f(re) #lhs = (p_dict['Q'] * (f**0.5)) / ((8.0 * p_dict['g'] * s)**0.5)
kn = 1.49 s = 0.005 tol = 1.0e+20 Y = np.arange(0.001,1.0,0.001) r = 1.0e+20 correct_y1 = -999 correct_f = -999 correct_re = -999 for y in Y: p_dict['y'] = y re = cp.re_circ(p_dict) f = find_f(re) lhs = (p_dict['Q'] * (f**0.5)) / ((8.0 * p_dict['g'] * s)**0.5) rhs = cp.area_circ(p_dict) * cp.r_circ(p_dict)**0.5 this_r = abs(lhs-rhs) if this_r < r: r = this_r correct_y1 = y correct_f = f correct_re = re print 'y,f,re',correct_y1,correct_f,correct_re p_dict['y'] = correct_y1 p_dict['v'] = p_dict['Q'] / cp.area_circ(p_dict) froude = cp.f_circ(p_dict) print 'v,fr',p_dict['v'],froude
import numpy as np import calc_prism as cp p_dict = {} p_dict['g'] = 9.81 p_dict['d'] = 1.8 p_dict['y'] = 0.7 p_dict['Q'] = 2.8 f = cp.f_circ(p_dict) m = cp.m_circ(p_dict) y = np.arange(0.0001, 1.7, 0.0001) conj_ys = cp.find_depths(m, y, p_dict, cp.m_circ) print f, conj_ys
rhs = (n * p_dict['Q']) / (kn * (s**0.5)) Y = np.arange(0.001,2.9,0.001) r = 1.0e+20 correct_y1 = -999 for y in Y: p_dict['y'] = y lhs = (cp.area_circ(p_dict)**(5.0/3.0)) / (cp.p_circ(p_dict)**(2.0/3.0)) this_r = abs(lhs-rhs) if this_r < r: r = this_r correct_y1 = y print 'y',correct_y1 p_dict['y'] = correct_y1 print 'f1',cp.f_circ(p_dict) p_dict['Y'] = Y yc1 = cp.yc_circ(p_dict) print 'yc1',yc1 p_dict['y'] = yc1 print 'fc1',cp.f_circ(p_dict) s = 0.02 rhs = (n * p_dict['Q']) / (kn * (s**0.5)) r = 1.0e+20 correct_y2 = -999 for y in Y: p_dict['y'] = y lhs = (cp.area_circ(p_dict)**(5.0/3.0)) / (cp.p_circ(p_dict)**(2.0/3.0)) this_r = abs(lhs-rhs)