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 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]
def get_dTi(state): bal = sphere_balloon.Sphere_Balloon(5.79,0.8) atm = fluids.atmosphere.ATMOSPHERE_1976(state.el) q_int = bal.get_sum_q_int(state.Ts, state.Ti, state.el) tm_air = atm.rho*vol*Cp_air0 return q_int/tm_air