From 35098b3e3712021a0af8f41b6250fe611a7707d2 Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Sun, 30 Oct 2011 15:29:18 -0500 Subject: rid of deprecations --- .gitignore | 2 +- throw.py | 51 +-------------------------------------------------- 2 files changed, 2 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index 2f78cf5..f3d74a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ *.pyc - +*~ diff --git a/throw.py b/throw.py index 646dea9..deaea5b 100644 --- a/throw.py +++ b/throw.py @@ -60,23 +60,6 @@ def taylor_cos(a): ) return r -#### -# The interpolation is slower, uses more RAM, -# and is two orders of magnitude less accurate. -# -#scale = 300. -#angles = numpy.linspace(0, tau, scale) -#_cos = numpy.cos(angles) -#def floor_cos(a): -# return _cos[int((a % tau)/tau * scale)] -#def floor_sin(a): -# return floor_cos(a - tau/4) -# -#interpolate_cos = interp1d(angles, numpy.cos(angles)) -#interpolate_sin = interp1d(angles, numpy.sin(angles)) -#def interp_cos(a): return interpolate_cos(a % tau) -#def interp_sin(a): return interpolate_sin(a % tau) - ### trig approximations cos = taylor_cos sin = taylor_sin @@ -92,39 +75,13 @@ phi_max = 2 * (length - r0) / r_winch #rad r = lambda phi: r0 + r_winch*(phi - phi**2/(2*phi_max)) ### gravitational acceleration: -### the deprecated approximation g = 9.71 m/s^2 -### factoring in the r-phi-dependence geopotential = 3.987 * 10**14 #cubic meters per second^2 earth_radius = 6.3675 * 10**6 #meters balloon_height = 40*10**3 height = lambda phi: balloon_height + r(phi) * cos(phi) g = lambda phi: geopotential / (earth_radius + height(phi))**2 -### linear friction can be neglected due to: -### low viscosity -### high velocity => high Reynold's number -### the formulation below neglets pressure differences. -# for standard air: -#visc0 = .01827 # reference viscosity -#T0 = 291.15 # reference temperature -#suth_C = 120 # Sutherland's constant -# for pure diatomic hydrogen: -#visc0 = .00876 -#T0 = 293.85 -#suth_C = 72 -#a = 0.555 * T0 + suth_C -#b = lambda T: 0.555 * T + suth_C -#visc = lambda T: visc0 * (a/b(T)) * (T/T0)**(3/2) -#visc = visc(300) # standard temperature -- inaccurate -#lin_co = 3 * numpy.pi * visc * Diameter # for a sphere -# fric_lin = lin_co * r * phi1 - ### quadratic friction: -#molar_mass = .02897 #kg/mol -- for air up to -#ideal_gas_const = 8.314 #m^3 Pa / (mol K) -#pressure = 500 #Pa -#Temp = 300 #K -#density = pressure * molar_mass / (ideal_gas_const * Temp) #kg/m^3 density = .003 #kg/m^3 kappa = .25 # for a sphere radius = .1 #meters -- radius of the satellite cage @@ -135,8 +92,6 @@ quad_co = kappa * density * Area ### mass: global m, Mass m = 39.7 #kilograms -- mass of the satellite cage (overestimate) -#l = 0.2 #kilograms/meter -- density of the cable (20mm: 41.9 kN) -#l = 0.52 #kilograms/meter -- density of the cable (32mm: 105.0 kN) l = 0.16 #kilograms/meter -- density of Super Max cable, 16mm: 269.8kN max_tension = 269.8 #kN, given by choice of cable above. Mass = 670 #kilograms -- mass of /everything/ @@ -264,9 +219,7 @@ def opt_fun(guesses, f, func, init_vars): f.write("%s, " % tension_max) f.write("%s\n" % v_tan_max) - # If you want to add limits, you can do so by changing the return to: - #return 1/v_tan + Mass/600 + phi1.max() - # or + # If you want strict limits, you can change the return to: #return 1/v_tan + 1000*(Mass > Mass_limit) + 1000*(phi1.max() > phi1_limit) return 2/v_tan_max + Mass/600 + phi1.max() / tau @@ -322,5 +275,3 @@ if len(sys.argv) == 2: if func_name in dir(): exec(func_name + '()') -optimize() - -- cgit v1.2.3-54-g00ecf