Physics-Based Modeling of Space Weather in the Ionosphere and Thermosphere