Modeling the Evolution of Solar Magnetic Fields