trivial modification

This commit is contained in:
Chunxiao Li 2021-06-07 12:57:31 +08:00
parent 7bd791a32b
commit f3b4069d54
2 changed files with 17 additions and 12 deletions

View File

@ -12,6 +12,8 @@ from .ussa76 import ussa76
from ..utils import Const from ..utils import Const
from ..utils.utils import alt_conver,check_altitude from ..utils.utils import alt_conver,check_altitude
from ..class_atmos import ATMOS
def coesa76(alts, alt_type='geometric'): def coesa76(alts, alt_type='geometric'):
''' '''
Implements the U.S. Committee on Extension to the Standard Atmosphere(COESA 1976). Implements the U.S. Committee on Extension to the Standard Atmosphere(COESA 1976).
@ -27,7 +29,7 @@ def coesa76(alts, alt_type='geometric'):
Ts -> [float] temperatures ..., [K] Ts -> [float] temperatures ..., [K]
Ps -> [float] pressures ..., [Pa] Ps -> [float] pressures ..., [Pa]
Note: the geometric altitudes should be in [-0.610,1000] km, otherwise the output will be extrapolated for those input altitudes. Note: the geometric altitudes should be in [-0.611,1000] km, otherwise the output will be extrapolated for those input altitudes.
Reference: Reference:
U.S. Standard Atmosphere, 1976, U.S. Government Printing Office, Washington, D.C. U.S. Standard Atmosphere, 1976, U.S. Government Printing Office, Washington, D.C.
@ -43,7 +45,7 @@ def coesa76(alts, alt_type='geometric'):
data = np.load(data_path+'coesa76_coeffs.npz') data = np.load(data_path+'coesa76_coeffs.npz')
rho_coeffs,p_coeffs = data['rho'],data['p'] rho_coeffs,p_coeffs = data['rho'],data['p']
r0 = Const.r0 # volumetric radius for the Earth, [km] R0 = Const.R0 # volumetric radius for the Earth, [km]
# Get geometric and geopotential altitudes # Get geometric and geopotential altitudes
zs,hs = alt_conver(alts, alt_type) zs,hs = alt_conver(alts, alt_type)
@ -67,7 +69,7 @@ def coesa76(alts, alt_type='geometric'):
elif z > zb[3] and z <= zb[4]: elif z > zb[3] and z <= zb[4]:
T = 240 + 12 * (z - 110) T = 240 + 12 * (z - 110)
else: else:
epsilon = (z - 120) * (r0 + 120) / (r0 + z) epsilon = (z - 120) * (R0 + 120) / (R0 + z)
T = 1e3 - 640 * np.exp(-0.01875 * epsilon) T = 1e3 - 640 * np.exp(-0.01875 * epsilon)
ind = np.where((z - zb) >= 0)[0][-1] ind = np.where((z - zb) >= 0)[0][-1]
@ -82,4 +84,6 @@ def coesa76(alts, alt_type='geometric'):
rhos[j],Ts[j],Ps[j] = rho,T,P rhos[j],Ts[j],Ps[j] = rho,T,P
j += 1 j += 1
return rhos,Ts,Ps info = {'rho':rhos,'T':Ts,'P':Ps}
return ATMOS(info)

View File

@ -1,16 +1,15 @@
import numpy as np import numpy as np
from ..utils.utils import alt_conver,check_altitude from ..utils.utils import alt_conver,check_altitude
from ..class_atmos import ATMOS
def expo(alts,alt_type='geometric'): def expo(alts,alt_type='geometric'):
''' '''
Estimate the air densities at given geometric or geopotential altitudes Estimate the mass densities at given geometric or geopotential altitudes
above the sea level using a exponential atmosphere model from above the sea level using a exponential atmosphere model.
Vallado, D. A. (2013). Fundamentals of astrodynamics and applications (4th Edition). Microcosm Press.
Usage: Usage:
rhos = expo(alts) rhos = expo(alts)
or
rhos = expo(alts,'geopotential') rhos = expo(alts,'geopotential')
Inputs: Inputs:
@ -23,7 +22,7 @@ def expo(alts,alt_type='geometric'):
rhos -> [float array] densities at given altitudes, [kg/m^3] rhos -> [float array] densities at given altitudes, [kg/m^3]
Reference: Reference:
Vallado, D. A. (2013). Fundamentals of astrodynamics and applications (4th Edition). Microcosm Press.
''' '''
# Get geometric and geopotential altitudes # Get geometric and geopotential altitudes
@ -59,4 +58,6 @@ def expo(alts,alt_type='geometric'):
inds[i] = np.where((zs[i] - zb_expand) >= 0)[0][-1] inds[i] = np.where((zs[i] - zb_expand) >= 0)[0][-1]
rhos = rhob[inds]*np.exp(-(zs-zb[inds])/ZS[inds]) rhos = rhob[inds]*np.exp(-(zs-zb[inds])/ZS[inds])
return rhos info = {'rho':rhos}
return ATMOS(info)