Degenerate Conic

Algorithms • Modern Fortran Programming • Orbital Mechanics

Oct 24, 2021

Atmosphere Models

us-standard-atmosphere

The drag force magnitude on a spacecraft can be computed using the following equation:

$$ d = \frac{1}{2} \rho v^2 A C_D$$

Which can be easily implemented in the following Fortran function:

pure function drag(density, v, area, cd)

    use iso_fortran_env, only: wp => real64

    implicit none

    real(wp) :: drag !! drag force magnitude (N)
    real(wp), intent(in) :: density !! atmospheric density (kg/m^3)
    real(wp), intent(in) :: v       !! relative velocity magnitude (m/s)
    real(wp), intent(in) :: area    !! spacecraft cross-sectional area (m^2)
    real(wp), intent(in) :: cd      !! spacecraft drag coefficient

    drag = 0.5_wp * density * v**2 * area * cd

end function drag

The density \(\rho\) is computed using an atmosphere model. Here is a listing of some atmosphere model codes available in Fortran:

See also