  The magnetic fields in heavy-ion collisions are important ingredients for
many interesting phenomena, such as the Chiral Magnetic Effect, Chiral Magnetic
Wave, the directed flow $v_1$ of $D^0$ mesons and the splitting of the spin
polarization of the $\Lambda$/$\bar{\Lambda}$. Quantitative studies of these
phenomena however suffer from limited understanding on the dynamical evolution
of these fields in the medium created by the collisions, which remains a
critical and challenging problem. The initial magnetic fields from the
colliding nuclei decay very fast in the vacuum but their lifetime could be
extended through medium response due to electrically conducting quarks and
antiquarks. Here we perform a detailed analysis of such medium effect on the
dynamical magnetic fields by numerically solving the Maxwell's equations
concurrently with the expanding medium described by viscous hydrodynamics,
under the assumption of negligible back reaction of the fields on the fluid
evolution. Our results suggest a considerable enhancement of late time magnetic
fields, the magnitude of which depends sensitively on the fireball expansion as
well as the medium electric conductivity both before and during hydrodynamic
stage.
