p_dict['y'] = y rh = cp.r_trap(p_dict) tao = gamma * y * s u_star = (p_dict['g'] * rh * s)**0.5 ratio = u_star/u_c_star if ratio <= 1.0: a,b = 0.15,1.85 elif ratio > 1.0 and ratio <= 1.5: a,b = 0.2,2.7 elif ratio > 1.5 and ratio <=2.5: a,b = 0.28,3.08 else: a,b = 0.29,3.5 k = avg_hgt * 0.14 * (((mei/tao)**0.25)/avg_hgt)**1.59 n_term1 = kn /((8.0*p_dict['g'])**0.5) n_term2 = ((rh/k)**(1.0/6.0)/(a + (b * math.log10(rh/k)))) n = n_term1 * n_term2 * k**(1.0/6.0) #print n rhs = (n * p_dict['Q']) / (kn * (s**0.5)) lhs = (cp.area_trap(p_dict)**(5.0/3.0)) / (cp.p_trap(p_dict)**(2.0/3.0)) this_r = abs(lhs-rhs) if this_r < r: r = this_r correct_y1 = y correct_n = n correct_tao = tao print 'y',correct_y1 print 'n',correct_n tao_bot_max = gamma * correct_y1 * s print 'tao_perm,tao_max',tao_perm,correct_tao
p_dict['m'] = 1.0 / (3.0)**0.5 p_dict['Q'] = 1500.0 #nm_2_lbft = 47.9 n = 0.015 kn = 1.49 s = 0.0005 Y = np.arange(0.001, 20.0, 0.001) r = 1.0e+20 correct_y1 = -999 correct_n = -999 correct_b = -999 for y in Y: p_dict['y'] = y p_dict['b'] = (2.0 / 3.0) * y * (3.0)**0.5 rh = cp.r_trap(p_dict) rhs = (n * p_dict['Q']) / (kn * (s**0.5)) lhs = (cp.area_trap(p_dict)**(5.0 / 3.0)) / (cp.p_trap(p_dict) **(2.0 / 3.0)) this_r = abs(lhs - rhs) if this_r < r: r = this_r correct_y1 = y correct_n = n correct_b = p_dict['b'] print 'y', correct_y1 p_dict['y'] = correct_y1 print 'f', cp.f_trap(p_dict) print 'n', correct_n print 'b', correct_b