  Observations of the time-dependent cosmic-ray Sun shadow have been proven as
a valuable diagnostic for the assessment of solar magnetic field models. In
this paper, seven years of IceCube data are compared to solar activity and
solar magnetic field models. A quantitative comparison of solar magnetic field
models with IceCube data on the event rate level is performed for the first
time. Additionally, a first energy-dependent analysis is presented and compared
to recent predictions. We use seven years of IceCube data for the Moon and the
Sun and compare them to simulations on data rate level. The simulations are
performed for the geometrical shadow hypothesis for the Moon and the Sun and
for a cosmic-ray propagation model governed by the solar magnetic field for the
case of the Sun. We find that a linearly decreasing relationship between Sun
shadow strength and solar activity is preferred over a constant relationship at
the 6.4sigma level. We test two commonly used models of the coronal magnetic
field, both combined with a Parker spiral, by modeling cosmic-ray propagation
in the solar magnetic field. Both models predict a weakening of the shadow in
times of high solar activity as it is also visible in the data. We find
tensions with the data on the order of $3\sigma$ for both models, assuming only
statistical uncertainties. The magnetic field model CSSS fits the data slightly
better than the PFSS model. This is generally consistent with what is found
previously by the Tibet AS-gamma Experiment, a deviation of the data from the
two models is, however, not significant at this point. Regarding the energy
dependence of the Sun shadow, we find indications that the shadowing effect
increases with energy during times of high solar activity, in agreement with
theoretical predictions.
