A magnetic "solar heartbeat" beats deep in the sun's interior, generating energy that leads to solar flares and sunspots, according to new research. A new supercomputer simulation, described in the April 4 edition of the journal Science, probes the sun's periodic magnetic field reversals. Every 40 years, according to the model, the sun's zonal magnetic field bands switch their orientation, or polarity. That cycle is about four times longer than the 11-year sunspot cycle that governs the level of solar activity. Being able to model such a regular, long-term process is remarkable, the scientists said. The new research, led by the University of Montreal's Paul Charbonneau, describes work from both his research group and other, independent coalitions simulating the sun's interior. Stunning Photos of Solar Flares Dissipating turbulence Modeling the sun has been a sticky problem for decades. The first attempts in the 1980s captured only a rough approximation of the turbulence inside of the sun. Turbulence, when it occurs, happens at both large and small scales. The large scales are easy to simulate, but in the sun, a small feature only about tens of miles across is just as important in understanding how fluid propagates. When energy from turbulence dissipates, the turbulence flows into smaller and smaller whirlpool shapes, called vortices. You can see this for yourself, Charbonneau said, when swirling your hand in a full bathtub. The movement will produce a vortex in the water that will gradually break up into tinier ones that dissipate the energy. On the sun, dissipation takes place at a scale of tens of yards. That's extremely minute, compared with the size of the sun, which is 1 million times larger than Earth. "There's no way we can capture that in a simulation," Charbonneau told SPACE.com. To approximate this process, scientists typically limit the resolution to about 6.2 miles (10 kilometers). This, however, creates an energy buildup in the simulation that will "blow up" the model before it can run for very long, Charbonneau said. Stopping the collapse Charbonneau's co-author Piotr Smolarkiewicz of the European Centre for Medium-Range Weather Forecasts, focuses his work on meteorology rather than astronomy. The same principles of turbulence apply to both fields, however, as air currents play a large role in weather forecasting. Charbonneau's team used supercomputers at the University of Montreal that are linked to Calcul Québec, a network of large computers used across the province of Quebec. Together, the researchers set up a model that would essentially dissipate the energy just at the point when the simulation was about to collapse. It's not easy to do in a fluid system like that. If you start removing energy too quick, you will affect the global dynamics of the system," Charbonneau said. The model isn't perfect, he acknowledged. Sunspots, solar flares and similar phenomena are just too small to be modeled with the computing power available today. When it comes to modeling the sun as a whole, though, the scientists are starting to see how energy transport and luminosity varies over decades. Studying the sun's brightness Several science groups are now trying to model brightness changes in the sun. It's been known for years that the sun is brighter when it's more active. The sun produces more dark sunspots during that time - which dim it somewhat - but it also creates small magnetic structures that brighten the surface. How these structures form is still under investigation. Charbonneau and his team are examining how the magnetic field on the sun affects the transport of energy from the inside to the outside. "There's a link between convective energy transport and the magnetic cycle, and you can measure that through going through the simulation and pulling out the flows, the primary variables," Charbonneau said. "Once you have a magnetic cycle that builds up and develops in the simulation," he added, "you can analyze how that affects convective transport and the sun's luminosity." Follow Elizabeth Howell @howellspace, or SPACE.com @Spacedotcom. We're also on Facebook and Google+. Original story on SPACE.com.