Solar activity is extremely complex and we do not fully understand the mechanics. There is heat moving out from inside forming convective cells, complicated by rotational Coriolis forces. Then there are magnetic forces arising from the movement of conductive fluids across magnetic field lines. The flowing currents further heat the fluid. The induced magnetic fields operate against the original fields. The fluid is ionized with some degree of charge separation, inducing electric forces. There are numerous feedback loops interacting with each other to produce a system that oscillates over a 22 year period, somewhat in synch with Jupiter's orbital period of 23.5 years.