def get_Nu_free(self,T,el,Pr):
        m = mars_radiation.MarsRadiation()
        T_atm = m.get_T(el)
        p_atm = m.get_P(el)
        rho_atm = m.get_rho(el)
        g = m.get_g(el)

        Pr_atm = self.get_Pr_co2(T_atm)

        T_avg = 0.5*(T_atm + T)
        rho_avg = p_atm/(Mars_Sphere_Balloon.Rsp_co2*T_avg)
        Pr_avg = self.get_Pr_co2(T_avg)

        exp_coeff = 1./T_avg
        mu = self.get_dynamic_viscocity_co2(T_avg)

        Gr = (pow(rho_atm,2)*g*fabs(T-T_atm)*pow(self.d,3))/(T_atm*pow(mu,2))

        #print "Gr,", Gr, "Pr," , Pr
        try:
            Nu = 2 + .45*pow((Gr*Pr),.25)
        except:
            Nu = 2.45
        return Nu

        '''
Ejemplo n.º 2
0
    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
        """

        m = mars_radiation.MarsRadiation()
        T_atm = m.get_T(el)
        p_atm = m.get_P(el)
        rho_atm = p_atm/(189.*T_atm)
        g = m.get_g(el)

        rho_int = p_atm/(self.Rsp_co2*T_i)
        F_b = (rho_atm - rho_int)*self.vol*g # Force due to buyoancy
        Cd = .8 # Drag Coefficient
        F_d =  Cd*(0.5*rho_atm*math.fabs(v)*v)*self.cs_area # Force due to Drag
        vm = (self.massEnv + self.mp) + rho_atm*self.vol + self.vm_coeff*rho_atm*self.vol
        accel = (F_b  - F_d - (self.massEnv + self.mp)*g)/vm
        return accel
Ejemplo n.º 3
0
    def get_q_int(self, T_s, T_i, el):
        """Calculates sum of Internal Heat Transfer.

        .. note::

            Currently there are no initial heat sources. So this function returns the negative of *get_q_int()*

        :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: SUm of Internal Heat Transfer (W)
        :rtype: float
        """

        m = mars_radiation.MarsRadiation()
        T_atm = m.get_T(el)
        p_atm = m.get_P(el)
        rho_atm = m.get_rho(el)
        g = m.get_g(el)

        #print("rho",rho_atm)
        Pr = self.get_Pr_co2(T_i)
        mu = self.get_dynamic_viscocity_co2(T_i)
        k = self.get_k_co2(T_i)
        h = 0.13 * k * pow(
            (pow(rho_atm, 2) * g * fabs(T_s - T_i) * Pr) / (T_i * pow(mu, 2)),
            (1 / 3.))  #THE ERROR WAS HERE. AHHHH
        #print("h",h)
        #print ("Pr",Pr)
        q_int = h * self.surfArea * (T_s - T_i)
        #print("q_int",q_int)
        return q_int
Ejemplo n.º 4
0
    def get_acceleration(self,v,el,T_s,T_i,mp):
        m = mars_radiation.MarsRadiation()
        T_atm = m.get_T(el)
        p_atm = m.get_P(el)
        rho_atm = p_atm/(189*T_atm) #m.get_rho(el)
        g = m.get_g(el)

        rho_int = p_atm/(self.Rsp_co2*T_i)
        F_b = (rho_atm - rho_int)*self.vol*g
        Cd = .8
        F_d =  Cd*(0.5*rho_atm*math.fabs(v)*v)*self.cs_area
        vm = (self.massEnv + mp) + rho_atm*self.vol + self.vm_coeff*rho_atm*self.vol
        accel = (F_b  - F_d - (self.massEnv + mp)*g)/vm
        return accel
    def get_q_int(self,T_s, T_i, el):

        m = mars_radiation.MarsRadiation()
        T_atm = m.get_T(el)
        p_atm = m.get_P(el)
        rho_atm = m.get_rho(el)
        g = m.get_g(el)

        Pr = self.get_Pr_co2(T_i)

        mu = self.get_dynamic_viscocity_co2(T_i)
        k = self.get_k_co2(T_i)
        h = 0.13*k*pow((pow(rho_atm,2)*g*fabs(T_s-T_i)*Pr)/(T_i*pow(mu,2)),(1/3))
        q_int = h*self.surfArea*(T_s-T_i)
        return q_int
Ejemplo n.º 6
0
    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
        """

        m = mars_radiation.MarsRadiation()
        T_atm = m.get_T(el)
        Q_vent =  self.mdot*self.Cv_co2*(T_i-T_atm)
        return Q_vent
    def get_q_ext(self, T_s, el, v):
        """External Heat Transfer

        :param zen: Surface Temperature of Envelope (K)
        :type zen: float
        :param el: Elevation (m)
        :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
        """

        m = mars_radiation.MarsRadiation()
        T_atm = m.get_T(el)
        p_atm = m.get_P(el)
        rho_atm = m.get_rho(el)
        g = m.get_g(el)

        Pr_atm = self.get_Pr_co2(T_atm)

        T_avg = 0.5*(T_atm + T_s)
        rho_avg = p_atm/(Mars_Sphere_Balloon.Rsp_co2*T_avg)
        Pr_avg = self.get_Pr_co2(T_avg)

        exp_coeff = 1./T_avg
        kin_visc = self.get_dynamic_viscocity_co2(T_avg)/rho_avg

        k = self.get_k_co2(T_avg)
        alpha = k/(rho_avg*Mars_Sphere_Balloon.Cp_co2)
        Ra = g*exp_coeff*pow(self.d,3)/(kin_visc*alpha)*math.fabs(T_s-T_atm)
        # Reynolds number has to be positive, therefore convert negative velocities.
        Re = rho_atm*fabs(v)*self.d/self.get_dynamic_viscocity_co2(T_atm)

        Nu = self.get_Nu_free(T_s,el,Pr_avg)
        k = self.get_k_co2(T_avg)

        '''External Free Convection'''
        h = (Nu*k)/self.d
        '''External Forced Convection'''
        h_forced =  k/self.d*(2+.41*np.power(Re,0.55))
        #Take maximum value between free and forced
        h = np.fmax(h,h_forced)

        q_conv = h*self.surfArea*(T_s-T_atm)
        return q_conv
Ejemplo n.º 8
0
    def solve_states(self, T_s, T_i, el, v, mp, vent, timespace, alt_dz,
                     vel_dz):
        for i in range(0, len(timespace) - 1):
            bal = mars_sphere_balloon.Mars_Sphere_Balloon()
            rad = mars_radiation.MarsRadiation()
            q_rad = rad.get_rad_total(self.lat, self.Ls, el[i], timespace[i],
                                      self.d)

            rho_atm = rad.get_rho(el[i])

            p_atm = rad.get_P(el[i])
            rho_int = p_atm / (self.Rsp_co2 * T_i[i])
            tm_air = rho_int * self.vol * self.Cp_co2

            dT_sdt = (bal.get_sum_q_surf(q_rad, T_s[i], T_i[i], el[i],
                                         v[i])) / (bal.cf * self.massEnv)
            dT_idt = (bal.get_q_int(T_s[i], T_i[i], el[i]) -
                      self.get_convection_vent(T_i[i], el[i])) / tm_air
            T_s.append(T_s[i] + dT_sdt * self.dt)
            T_i.append(T_i[i] + dT_idt * self.dt)

            dzdotdt = self.get_acceleration(v[i], el[i], T_s[i], T_i[i], mp)
            zdot = v[i] + dzdotdt * self.dt
            z = el[i] + zdot * self.dt  #+dzdotdt*pow(dt,2)#*1000

            if z < 0:
                v.append(0)
                el.append(0)
            else:
                v.append(zdot)
                el.append(z)

            if el[i] > alt_dz:
                self.mdot = vent

            if v[i] < vel_dz:
                self.mdot = 0

            if i % 3600 == 0:
                print "t", timespace[i + 1] / 3600, "el", el[i + 1], "v", v[
                    i + 1], "accel", dzdotdt, "T_s", T_s[i + 1], "T_i", T_i[i +
                                                                            1]

        return [T_s, T_i, el, v]
Ejemplo n.º 9
0
    def get_Nu_free(self, T, el, Pr):
        """Calculates Free Nusselt Number


        :param T: Temperature (K)
        :type T: float
        :param el: Elevation (m)
        :type el: float
        :param Pr: Prandtl Number
        :type Pr: float
        :returns: Free Nusselt Number
        :rtype: float
        """
        m = mars_radiation.MarsRadiation()
        T_atm = m.get_T(el)
        p_atm = m.get_P(el)
        rho_atm = m.get_rho(el)
        g = m.get_g(el)

        Pr_atm = self.get_Pr_co2(T_atm)

        T_avg = 0.5 * (T_atm + T)
        rho_avg = p_atm / (Mars_Sphere_Balloon.Rsp_co2 * T_avg)
        Pr_avg = self.get_Pr_co2(T_avg)

        exp_coeff = 1. / T_avg
        mu = self.get_dynamic_viscocity_co2(T_avg)

        Gr = (pow(rho_atm, 2) * g * fabs(T - T_atm) *
              pow(self.d, 3)) / (T_atm * pow(mu, 2))

        try:
            Nu = 2 + .45 * pow((Gr * Pr), .25)
        except:
            Nu = 2.45
        return Nu
Ejemplo n.º 10
0
 def get_convection_vent(self, T_i, el):
     m = mars_radiation.MarsRadiation()
     T_atm = m.get_T(el)
     Q_vent = self.mdot * self.Cv_co2 * (T_i - T_atm)
     return Q_vent
Ejemplo n.º 11
0
def model(T_s,t):
    m = mars_radiation.MarsRadiation()
    Q_sun = m.get_rad_total(lat,Ls,el,t,d)

    dTdt = (Q_sun-Q_loss(T_s))/(cf*M)
    return dTdt
Ejemplo n.º 12
0
    def solve_states(self,T_s,T_i,el,v,timespace,alt_sp,vel_sp):
        """This function numerically integrates and solves for the change in Surface Temperature, Internal Temperature, and accelleration
        after a 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
        :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]
        """
        for i in range(0,len(timespace)-1):
            bal = mars_sphere_balloon.Mars_Sphere_Balloon()
            rad = mars_radiation.MarsRadiation()
            q_rad  = rad.get_rad_total(self.lat,self.Ls,el[i],timespace[i],self.d)

            rho_atm = rad.get_rho(el[i])

            p_atm = rad.get_P(el[i])
            rho_int = p_atm/(self.Rsp_co2*T_i[i])
            tm_air = rho_int*self.vol*self.Cp_co2

            dT_sdt = (bal.get_sum_q_surf(q_rad, T_s[i], T_i[i], el[i], v[i]))/(bal.cf*self.massEnv)
            dT_idt = (bal.get_q_int(T_s[i], T_i[i], el[i])-self.get_convection_vent(T_i[i],el[i]))/tm_air
            T_s.append(T_s[i]+dT_sdt*self.dt)
            T_i.append(T_i[i]+dT_idt*self.dt)

            dzdotdt = self.get_acceleration(v[i],el[i],T_s[i],T_i[i])
            zdot = v[i] + dzdotdt*self.dt
            z = el[i]+zdot*self.dt

            #if zdot < -800: #terminal velocity?
            #    zdot = -800.0

            if z<0:
                v.append(0)
                el.append(0)
            else:
                v.append(zdot)
                el.append(z)

            if el[i] > alt_sp:
                self.mdot = self.vent

            else:
                self.mdot = 0


            if i % 360 == 0 :
                print("t", timespace[i+1]/(3600),  "el", el[i+1], "v", v[i+1], "accel", dzdotdt, "T_s", T_s[i+1], "T_i", T_i[i+1])

        return [T_s,T_i,el,v]