The total solar eclipse that occurred on 21 August 2017 across the United States provided an opportunity to test a magnetohydrodynamic model of the solar corona driven by measured magnetic fields. We used a new heating model based on the dissipation of Alfvén waves, and a new energization mechanism to twist the magnetic field in filament channels. We predicted what the corona would look like one week before the eclipse. Here, we describe how this prediction was accomplished, and show that it compared favourably with observations of the eclipse in white light and extreme ultraviolet. The model allows us to understand the relationship of observed features, including streamers, coronal holes, prominences, polar plumes and thin rays, to the magnetic field. We show that the discrepancies between the model and observations arise from limitations in our ability to observe the Sun's magnetic field. Predictions of this kind provide opportunities to improve the models, forging the path to improved space weather prediction.