def get_dTs(state,h): bal = sphere_balloon.Sphere_Balloon(5.79,0.8) rad = radiation.Radiation(doy,lat,h,state.el) q_rad = rad.get_rad_total(lat, state.el, h,5.79) q_surf = bal.get_sum_q_surf(q_rad, state.Ts, state.el, state.v) q_int = bal.get_sum_q_int(state.Ts, state.Ti, state.el) dT_sdt = (q_surf-q_int)/k #print "q_rad: ", q_rad, "q_surf: ", q_surf, "q_int: ", q_int #print "dT_sdt:", dT_sdt, "\n" return dT_sdt
def vectorfield(w,t): #zdot = q1 #T_Sdot = q2 #T_idot = q3 doy = 306 #temporary day of year lat = math.radians(35.106766) # rad #q1 = Elevation #q2 = velocity q1, q2, T_s, T_i, h = w h = math.radians(t*15) #if q2<132.2: # q2 = 132.2 #T_i = T_s bal = sphere_balloon.Sphere_Balloon(5.79,0.8) rad = radiation.Radiation(doy,lat,h,q1) q_rad = rad.get_rad_total(lat, q1, h,5.79) #q_surf = bal.get_sum_q_surf(q_rad, Ts, el, v) #q_int = bal.get_sum_q_int(state.Ts, state.Ti, state.el) #dT_sdt = (q_surf-q_int)/k atm = fluids.atmosphere.ATMOSPHERE_1976(q1) #q_int = bal.get_sum_q_int(Ts, Ti, el) tm_air = atm.rho*vol*Cp_air0 #return q_int/tm_air ''' if q1 < 132.6: q2= 0 ''' f = [1,#q2, 0,#get_acceleration(q2,q1,T_s,T_i), (bal.get_sum_q_surf(q_rad, T_s, q1, q2)-bal.get_sum_q_int(T_s, T_i, q1))/k, (bal.get_sum_q_surf(q_rad, T_s, q1, q2)-bal.get_sum_q_int(T_s, T_i, q1))/k,#bal.get_sum_q_int(T_s, T_i, q1)/tm_air, .45] return f
def get_convection_vent(self, T_i, el): """Calculates the heat lost to the atmosphere due to venting :param T_i: Internal Temperature (K) :type T_i: float :param el: Elevation (m) :type el: float :returns: Convection due to Venting (unit?) :rtype: float """ rad = radiation.Radiation() T_atm = rad.getTemp(el) Q_vent = self.mdot * self.Cp_air0 * ( T_i - T_atm) # Convection due to released air return Q_vent
def get_q_int(self, T_s, T_i, el): """Calculates Internal Heat Transfer :param T_s: Surface Temperature of Envelope (K) :type T_s: float :param el: Elevation (m) :type el: float :param v: velocity (m/s) :type v: float :returns: Internal Heat Transfer (W) :rtype: float """ rad = radiation.Radiation() T_atm = rad.getTemp(el) p_atm = rad.getPressure(el) rho_atm = rad.getDensity(el) g = rad.getGravity(el) ''' T_avg = 0.5*(T_s+T_i) rho_avg = p_atm/(Sphere_Balloon.Rsp_air*T_avg) Pr = self.get_Pr(T_avg) exp_coeff = 1./T_avg kin_visc = self.get_viscocity(T_avg)/rho_avg Ra = self.get_Pr(T_atm)*g*math.fabs(T_i-T_s)*pow(self.d,3)*exp_coeff/(kin_visc*kin_visc) Nu = self.get_Nu_int(Ra) k = self.get_conduction(T_avg) h = (Nu*k)/self.d q_int = h*self.surfArea*(T_s-T_i) ''' T_avg = 0.5 * (T_s + T_i) Pr = self.get_Pr(T_avg) rho_avg = p_atm / (Sphere_Balloon.Rsp_air * T_avg) mu = self.get_viscocity(T_avg) / rho_avg k = self.get_conduction(T_avg) inside = (np.power(rho_atm, 2) * g * math.fabs(T_s - T_i) * Pr) / (T_i * np.power(mu, 2)) h = 0.13 * k * np.sign(inside) * np.abs(inside)**(1 / 3.) q_int = h * self.surfArea * (T_s - T_i) return q_int
def get_acceleration(self, v, el, T_s, T_i): """Solves for the acceleration of the solar balloon after one timestep (dt). :param T_s: Surface Temperature (K) :type T_s: float :param T_i: Internal Temperature (K) :type T_i: float :param el: Elevation (m) :type el: float :param v: Velocity (m) :type v: float :returns: acceleration of balloon (m/s^2) :rtype: float """ rad = radiation.Radiation() T_atm = rad.getTemp(el) p_atm = rad.getPressure(el) rho_atm = rad.getDensity(el) g = rad.getGravity(el) rho_int = p_atm / (self.Rsp_air * T_i) # Internal air density Cd = .5 # Drag Coefficient F_b = (rho_atm - rho_int) * self.vol * g # Force due to buyoancy F_d = Cd * (0.5 * rho_atm * math.fabs(v) * v) * self.cs_area # Force due to Drag if F_d > 0: F_d = F_d * self.Upsilon vm = ( self.massEnv + self.mp ) + rho_atm * self.vol + self.vm_coeff * rho_atm * self.vol #Virtual Mass accel = ((F_b - F_d - (self.massEnv + self.mp) * g) / vm) return accel
def get_q_ext(self, T_s, el, v): """Calculate External Heat Transfer to balloon envelope :param zen: Surface Temperature of Envelope (K) :type zen: float :param el: Elevation (m)print fluids.atmosphere.solar_position(datetime.datetime(2018, 4, 15, 6, 43, 5), 51.0486, -114.07)[0] :type el: float :param el: velocity (m/s) :type el: float :returns: Power transferred from sphere to surrounding atmosphere due to convection(W) :rtype: float """ rad = radiation.Radiation() T_atm = rad.getTemp(el) p_atm = rad.getPressure(el) rho_atm = rad.getDensity(el) g = rad.getGravity(el) Pr_atm = self.get_Pr(T_atm) T_avg = 0.5 * (T_atm + T_s) rho_avg = p_atm / (Sphere_Balloon.Rsp_air * T_avg) Pr_avg = self.get_Pr(T_avg) exp_coeff = 1. / T_avg kin_visc = self.get_viscocity(T_avg) / rho_avg #Not sure if Raleighs number is the right equation here: Ra = Pr_avg * g * math.fabs(T_s - T_atm) * np.power( self.d, 3) * exp_coeff / (kin_visc * kin_visc) Re = rho_atm * v * self.d / self.get_viscocity(T_atm) Nu = self.get_Nu_ext(Ra, Re, Pr_atm) k = self.get_conduction(T_avg) h = Nu * k / self.d return h * self.surfArea * (T_s - T_atm)
if i % GFSrate == 0: lat_new, lon_new, x_wind_vel, y_wind_vel, bearing, nearest_lat, nearest_lon, nearest_alt = gfs.getNewCoord( coords[i], dt * GFSrate) #(coord["lat"],coord["lon"],0,0,0,0,0,0) coord_new = { "lat": lat_new, # (deg) Latitude "lon": lon_new, # (deg) Longitude "alt": el_new, # (m) Elevation "timestamp": t, # Timestamp } coords.append(coord_new) lat.append(lat_new) lon.append(lon_new) rad = radiation.Radiation() zen = rad.get_zenith(t, coord_new) if i % 360 * (1 / dt) == 0: print( str(t - pd.Timedelta(hours=GMT)) #Just for visualizing better + " el " + str("{:.4f}".format(el_new)) + " v " + str("{:.4f}".format(v_new)) #+ " accel " + str("{:.4f}".format(dzdotdt)) + " T_s " + str("{:.4f}".format(T_s_new)) + " T_i " + str("{:.4f}".format(T_i_new)) + " zen " + str(math.degrees(zen))) print( colored(("U wind speed: " + str(x_wind_vel) + " V wind speed: " + str(y_wind_vel) + " Bearing: " + str(bearing)), "yellow")) print(
def solveVerticalTrajectory(self, t, T_s, T_i, el, v, coord, alt_sp, v_sp): """This function numerically integrates and solves for the change in Surface Temperature, Internal Temperature, and accelleration after a timestep, dt. :param t: Datetime :type t: datetime :param T_s: Surface Temperature (K) :type T_s: float :param T_i: Internal Temperature (K) :type T_i: float :param el: Elevation (m) :type el: float :param v: Velocity (m) :type v: float :param alt_sp: Altitude Setpoint (m) :type alt_sp: float :param v_sp: Velocity Setpoint (m/s) :type v_sp: float :returns: Updated parameters after dt (seconds) :rtype: float [T_s,T_i,el,v] """ bal = sphere_balloon.Sphere_Balloon() rad = radiation.Radiation() T_atm = rad.getTemp(el) p_atm = rad.getPressure(el) rho_atm = rad.getDensity(el) rho_int = p_atm / (self.Rsp_air * T_i) tm_air = rho_int * self.vol * self.Cp_air0 #Numerically integrate change in Surface Temperature coord["alt"] = el q_rad = rad.get_rad_total(t, coord) q_surf = bal.get_sum_q_surf(q_rad, T_s, el, v) q_int = bal.get_sum_q_int(T_s, T_i, el) dT_sdt = (q_surf - q_int) / self.k #Numerically integrate change in Surface Temperature tm_air = rho_atm * self.vol * self.Cp_air0 dT_idt = (q_int - self.get_convection_vent(T_i, el)) / tm_air #Add the new surface and internal Temperatures T_s_new = T_s + dT_sdt * self.dt T_i_new = T_i + dT_idt * self.dt #solve for accellration, position, and velocity dzdotdt = self.get_acceleration(v, el, T_s, T_i) zdot = v + dzdotdt * self.dt z = el + zdot * self.dt #Add the new velocity and position if z < self.min_alt: v_new = 0 el_new = self.min_alt else: v_new = zdot el_new = z # Venting commands for an altitude setpoint. Vent is either on or off. if el_new > alt_sp: self.mdot = self.vent if el_new < alt_sp: self.mdot = 0 return [T_s_new, T_i_new, T_atm, el_new, v_new, q_rad, q_surf, q_int]
if(cd_arr[i].Re>Re) break; } if(i==0) return cd_arr[0].Cd; double Cd = (cd_arr[i].Cd - cd_arr[i-1].Cd)/(cd_arr[i].Re - cd_arr[i-1].Re); Cd *= (Re - cd_arr[i-1].Re); Cd += cd_arr[i-1].Cd; return Cd; ''' doy = 306 #temporary day of year lat = math.radians(35.106766) # rad h_ang = 0 el = 0 #elevation (m) r = radiation.Radiation(doy, lat, h_ang, el) T_s = 0 el = 0 v = 0 atm = fluids.atmosphere.ATMOSPHERE_1976(el) T_atm = atm.T d = 5.79 emissEnv = 0.8 s = Sphere_Balloon(5.79, emissEnv) h_ang = np.arange(start=-90, stop=90, step=.1) h_ang2 = [] T_s = []