Modeling The Energetics Of The Upper Atmosphere