Simulations of Solar and Stellar Dynamos and Their Theoretical Interpretation

We review the state of the art of three dimensional numerical simulations of solar and stellar dynamos. We summarize fundamental constraints of numerical modelling and the techniques to alleviate these restrictions. Brief summary of the relevant observations that the simulations seek to capture is given. We survey the current progress of simulations of solar convection and the resulting large-scale dynamo. We continue to studies that model the Sun at different ages and to studies of stars of different masses and evolutionary stages. Both simulations and observations indicate that rotation, measured by the Rossby number which is the ratio of rotation period and convective turnover time, is a key ingredient in setting the overall level and characteristics of magnetic activity. Finally, efforts to understand global 3D simulations in terms of mean-field dynamo theory are discussed.


Introduction
The intriguing coherence of the solar magnetic cycle has fascinated researchers for more than a century starting from Hale's discovery of magnetic field in sunspots (Hale, 1908;Hale et al, 1919), and early attempts to build simple models (Larmor, 1919;Cowling, 1933). The first successful models of the solar cycle made use of mean-field approximations yielding equations where only the large-scale contributions were explicitly computed, whereas the small scales were characterised by physically plausible parameterizations (Parker, 1955;Steenbeck and Krause, 1969). Mean-field models opened up new avenues in studying solar and stellar magnetism but their Achilles' heel is the parameterizations of the small scales which are in general untractable analytically in parameter regimes relevant to stars. This is due to the closure problem of turbulence rendering such models susceptible to fine-tuning. A review of modern mean-field theory is presented elsewhere in this volume (Brandenburg et al, 2023).
Rapidly increasing computing power allowed for the first direct solutions of the equations of (magneto)hydrodynamics in spherical shells in the late 1970s and early 1980s (Gilman, 1977;Gilman and Miller, 1981;Gilman, 1983;Glatzmaier, 1985). Prior to the these simulations and the discovery of the internal rotation profile of the Sun, the angular velocity was generally assumed to decrease as a function of radius, in which case the propagation of the dynamo wave from a mean-field αΩ dynamo is predicted to be equatorward given typical assumptions regarding the influence of the Coriolis force on convective eddies (Parker, 1955;Steenbeck and Krause, 1969;Yoshimura, 1975); see, however, Roberts and Stix (1972). This changed definitively when helioseismology revealed that the angular velocity is actually increasing with radius in the bulk of the solar convection zone (e.g. Duvall et al, 1984;Schou et al, 1998) which lead to the "dynamo dilemma" (Parker, 1987). This dilemma was also captured by the early 3D simulations where solar-like differential rotation with fast equator and slow poles was qualitatively reproduced, but where the dynamo waves propagated toward the poles, contrary to the Sun (Gilman, 1983;Glatzmaier, 1985).
After this, the interest in 3D simulations of solar and stellar dynamos waned and was not rekindled until the early 2000s, starting with the development of the ASH (Anelastic Spherical Harmonic) code (e.g. Miesch et al, 2000;Elliott et al, 2000;Brun and Toomre, 2002). While many of the early studies concentrated on the Sun (e.g. Brun et al, 2004;Browning et al, 2006;Miesch et al, 2008), a proliferation of models from various groups using different codes occurred in the 2010s when simulations of more rapidly rotating Suns started to yield cycles and equatorward migration more or less routinely (e.g. Ghizaru et al, 2010;Käpylä et al, 2010;Brown et al, 2011;Käpylä et al, 2012;Nelson et al, 2013;Augustson et al, 2015;Mabuchi et al, 2015;Simitev et al, 2015). Furthermore, simulations of main-sequence stars other than the Sun also started to appear covering the mass range from fully convective M dwarfs (e.g. Dobler et al, 2006;Browning, 2008;Yadav et al, 2015a;Bice and Toomre, 2020;Käpylä, 2021) to F stars with thin surface convection zones (Augustson et al, 2013;Breton et al, 2022), as well as core convection, dynamos, and interaction with fossil fields in more massive A, B and O stars (e.g. Featherstone et al, 2009;Augustson et al, 2016). Models exploring stellar magnetism outside of the main sequence have also started to appear, including pre-main sequence stars (e.g. Emeriau-Viard and , red giants (e.g. Dorch, 2004;Brun and Palacios, 2009), and newly born neutron stars (e.g. Raynaud et al, 2020;Masada et al, 2022).
Parallel to the developments in simulations, observational data and knowledge regarding stellar magnetism has also experienced explosive growth. We now have dozens of stars with observed cycles from long-term observing campaigns monitoring chromospheric emission (e.g. Baliunas et al, 1995). However, the systematics of these cycles as a function of stellar rotation are still under debate (e.g. Brandenburg et al, 2017;Boro Saikia et al, 2018b;Olspert et al, 2018;Bonanno and Corsaro, 2022). Zeeman-Doppler imaging has also revealed polarity reversals (e.g. Kochukhov et al, 2013;Boro Saikia et al, 2018a), as well as large-scale non-axisymmetric and dipole-dominated magnetic fields in rapidly rotating late-type stars (e.g. Kochukhov, 2021). Finally, magnetic activity saturates when the stellar Rossby number Ro ⋆ = P rot /τ conv , which is the ratio of the rotation period and the convective turnover time, is less than about 0.1, such that for lower Ro the activity and magnetic field strength is roughly constant (e.g. Wright et al, 2018;Reiners et al, 2022). These basic observations are crucial constraints for the numerical simulations. Nevertheless, the Sun still poses the stringest constraints to simulations due its proximity and access to its interior structure through helioseismology. Somewhat surprisingly the current 3D simulations struggle to reproduce not only the dynamo, but also the convective amplitudes and the differential rotation of the Sun, often yielding anti-solar (slow equator, fast poles) solutions with nominally solar luminosity and rotation rate (e.g. Matt et al, 2011;Käpylä et al, 2014;Gastine et al, 2014;Hotta et al, 2015;. This issue has been dubbed the convective conundrum (O'Mara et al, 2016) and poses arguably the greatest challenge in the field of stellar dynamo simulations today.
It has also been suggested that that the Sun is close to a transition where its dynamo efficiency diminishes (e.g. van Saders et al, 2016), possibly due to a shift from solar-like to anti-solar differential rotation, making it difficult to capture by simulations (e.g. Käpylä et al, 2014;Brun et al, 2022). Our aim in the following is to review the current successes and shortcomings of current simulations in capturing the relevant observations.
The remainder of the review is organised as follows: the basic equations and physics are discussed in Section 2 and the limitations of the numerical approach are reviewed in Section 3. The relevant observations and the main results of current 3D simulations of various types of stars are reviewed in Section 4 and Section 5, respectively. Section 6 gives an overview of the comparisons between mean-field models and global simulations. Finally, we conclude in Section 7 with an overview of the state of the field, current challenges, and possible future directions.

Relevant physics and equations
Stellar convection zones are described by the equations of magnetohydrodynamics (MHD), describing the time evolution of the magnetic field and conservation of mass, momentum, and energy: ρT ∂s ∂t = −∇ · (ρsu) + ∇ · F + H, where B is the magnetic field, u the velocity, η is the magnetic diffusivity, µ 0 the permeability of vacuum, J = µ −1 0 ∇ × B is the current density, ρ is the fluid density, g = −∇ϕ is the acceleration due to gravity, where ϕ is the gravitational potential, p is the gas pressure, Ω 0 is the rotation rate of the star, F visc is the viscous force, s is the specific entropy, and F = F rad + F SGS describes radiative and any subgrid-scale (SGS) fluxes that are present. H describes additional cooling and heating that is sometimes used instead of, or in addition to, the radiative flux (e.g. Ghizaru et al, 2010;Guerrero et al, 2019;Matilsky et al, 2019), or to take into account heating due to nuclear reactions in the core of the star (e.g. Dobler et al, 2006;Käpylä, 2021;Brun et al, 2022). Most often the gas is assumed to be fully ionised and to obey the ideal gas equation p = RρT , where R = c P − c V is the gas constant and c P and c V are the specific heat capacities in constant pressure and volume, respectively (see, however, e.g. Hotta et al, 2015;Strugarek et al, 2016, for other approaches).
The viscous force is given by where ν is the kinematic viscosity and is the traceless rate of strain tensor where where the semicolons denote covariant derivatives (cf. Mitra et al, 2009). In principle ν is a function of density and temperature according to Spitzer (1962), but in practice the current simulations adapt various explicit or implicit large-eddy simulation (LES) formulations that are geared toward minimizing diffusion and maximising numerical stability on a given grid resolution (for a review, see e.g. Miesch et al, 2015). Due to the short mean-free path of photons in stellar interiors, radiation is typically modeled via the diffusion approximation with where K is the radiative conductivity which is related to the opacity κ of the matter via where σ SB is the Stefan-Boltzmann constant. The radiative conductivity is often taken to be a fixed function of radius resulting either from a stellar evolution model (e.g. Brun et al, 2011;Hotta et al, 2022), or a simpler fixed analytic prescription producing a qualitatively similar behavior (e.g. Käpylä et al, 2013;Warnecke, 2018). Alternatively, K can also be taken to be dependent on the ambient thermodynamic state via the Kramers opacity law (e.g. Käpylä et al, 2020;Viviani and Käpylä, 2021) with which allows a non-linear back-reaction of, for example, rotation and magnetic fields (e.g. Käpylä et al, 2019). Radiative cooling and heating can also be included via the heating/cooling term, as is often done in the simulations with the Rayleigh code (e.g. Featherstone and Hindman, 2016b;Bice and Toomre, 2022). Yet another approach is to relax the thermodynamics toward a fixed reference state using a Newtonian cooling term as is done in the Eulag simulations (e.g. Ghizaru et al, 2010;Passos and Charbonneau, 2014;Strugarek et al, 2018;Guerrero et al, 2019). Typical numerical methods need to include some form of subgrid-scale (SGS) diffusion in the entropy equation to ensure numerical stability. In some methods, such as those used in the ASH, Rayleigh, and Pencil Code, this is explicitly included in a term that is proportional to the entropy gradient (e.g. Brun et al, 2004;Käpylä et al, 2013;Matilsky and Toomre, 2020) where χ SGS is the SGS thermal diffusivity that is responsible for turbulent diffusion at unresolved scales. This definition implicitly assumes that ds/dr < 0, that is, that the turbulent diffusion is due to unresolved Schwarzschild unstable convection, and the SGS term contributes to a positive (outward) energy flux. Often it is advantageous to decouple the SGS diffusion from the mean stratification such that the SGS diffusion is applied not on the total entropy s but, for example, to deviations from the spherically symmetric mean state s ′ = s − s, where the overbar denotes suitable averaging, typically over the horizontal directions. This leads to a vanishing mean SGS flux, F SGS ≈ 0.
This is advantageous if part of the convection zone is weakly stably stratified, or a stably stratified radiative layer is taken into account below the convection zone (e.g. Brun et al, 2011;Käpylä et al, 2020). An alternative approach is to include SGS effects implicitly such that the effective diffusion at small scales is determined by the numerical scheme itself. This is done in, for example, the Eulag (e.g. Ghizaru et al, 2010) and R2D2 codes (e.g. Hotta et al, 2014).
In practice, all of the diffusion coefficients in the simulations are much larger than their counterparts in stars, e.g. such that ν ≫ ν ⋆ , η ≫ η ⋆ , where the subscript ⋆ refers to stellar values. Furthermore, the radiative diffusivity χ = K/(c P ρ) is also practically always much smaller than χ SGS (see Appendix A of Käpylä et al, 2017a). Therefore all of the current simulations need to be understood as large-eddy simulations (LES). Yet, most of them do not consider the non-dissipative contribution of the unresolved small scales. Furthermore, some models (e.g. Strugarek et al, 2016;Hotta et al, 2022) dispense with the physical diffusion terms completely in order to minimize the diffusion on resolved scales while exerting diffusion only at scales near the grid scale.

Dimensionless parameters and diagnostics
A number of non-dimensional parameters arise in the analysis of the MHD equations and which define the simulations. These include the Rayleigh number which describes the efficiency of convection where d is a length scale; typically taken to be the shell thickness, the thermal and magnetic Prandtl numbers describe the relative importance of various diffusion terms: and the Taylor number which measures the strength of rotation. The latter is related to the Ekman number via Ek = 2Ta −1/2 . Most often the relevant thermal Prandtl number is based on the SGS diffusion because χ SGS ≫ χ. For completeness, the viscosity ν used in simulations is also an effective or SGS viscosity because it is always much larger than the real physical value. However, it has the same functional form as the physical viscosity whereas a term corresponding to the SGS entropy diffusion does not appear in the original equations. Additionally the geometry and the resulting density stratification are input parameters of the models, along with the boundary conditions applied to the various quantities. The most common diagnostic parameters used to describe the simulations include the Reynolds and Péclet numbers where u rms is the rms-velocity and ℓ is a length scale, both of which are outcomes of the simulations. The magnetic Reynolds number is of particular interest for dynamo simulations due to the bifurcations related to the excitation of large-scale and small-scale dynamos (SSD) (e.g. Brandenburg and Subramanian, 2005;Rempel et al, 2023). The rotational effect on the flow is measured by the Rossby (inverse Coriolis) number An alternative way to define the Rossby number, which automatically takes the changing length scale into account is where ω rms is the rms-vorticity with ω = ∇×u. Order of magnitude estimates for some of these parameters in the deep parts of the solar convection zone and in a core convection zone of a 20M ⊙ O star in comparison to current simulations are listed in Table 1. Our discussion above has assumed that the dimensional MHD equations are being solved, in which case these non-dimensional parameters are diagnostic outputs of the simulations. An alternative approach, also employed by many authors (see, e.g. Gastine et al, 2016;Brown et al, 2020) is to non-dimensionalize the governing equations at the beginning; in this case the various non-dimensional parameters discussed here appear directly in the equations, and serve as input parameters that specify the problem. To illustrate the procedure, suppose we choose to measure lengths in units of a characteristic length ℓ c , times in units of some time τ c , velocities in units of u c , and temperatures in units of T c . That is, we assume x = ℓ c x nd , t = τ c t nd , and so forth, where the "nd" subscript denotes non-dimensional variables. Then, to take a simple example, the dimensional Boussinesq momentum equation in the absence of rotation or magnetism in a plane layer, where ϖ ∼ P/ρ is a reduced pressure and other symbols take their usual meanings, would be rewritten as where we have retained nd subscripts on all non-dimensional quantities (including the spatial and temporal derivatives), and whereẑ is the vertical unit vector. Many choices of the characteristic scales τ c , ℓ c , etc., are possible, and in general these will each yield slightly different forms of the non-dimensional equations. A common choice is to measure lengths in units of the convection zone thickness (≡ L), times in units of a thermal diffusion time across that length (τ c = L 2 /χ), and to take u c = L/τ c for consistency; upon substitution (and simplification) we then find now involving Ma 2 = (P c /ρ c )/u 2 c , Pr = ν/χ, and Ra = gαT c L 3 /(νχ) (versions of the Mach, Prandtl, and Rayleigh numbers) as input parameters.
An advantage of this approach is that it is easier to avoid inadvertently "running the same simulation twice" -that is, conducting calculations with different luminosities, rotation rates, etc., that are nonetheless functionally equivalent (because they have the same governing non-dimensional parameters). On the other hand, it is sometimes difficult to "re-dimensionalize" such Table 1 Orders of magnitude of some dimensionless parameters in the main sequence phase of the Sun in the bulk of convection zone and in a core convection zone of a 20M ⊙ O9 star. Typical values from current global 3D simulations of stellar convection and dynamos are listed in the last column.
calculations and so make contact with any given astrophysical object; for illustrations of the procedure and its ambiguities, see discussions in Jones et al (2011) andYadav et al (2016a). We generally adopt the "dimensional" view throughout the remainder of this review.

Relevant time and length scales in stars
The structure of a star is determined by its mass M , luminosity L, chemical composition µ, and rotation rate Ω 0 , the latter corresponding to its age. This information, along with material properties such as viscosity, opacity, equation of state, and nuclear energy production rate is in principle enough to construct a time-dependent model of the evolution of the star (e.g. Kippenhahn et al, 2012). However, in practice the evolution of main-sequence stars occurs over the nuclear timescale τ n which is of the order of τ n ≈ 10 10 yr for the Sun, which is much longer than what can be covered in any 3D dynamo simulation. Chemical evolution due to nuclear reactions occurs also in this timescale and therefore the solar and stellar dynamo simulations assume that the stellar structure is given and fixed in the course of the simulations (see, however Emeriau-Viard and . By the same token, the gravitational potential is assumed to be fixed and spherically symmetric. Rotational evolution of stars also happens on timescales of 10 8 to 10 9 years (e.g. Skumanich, 1972;Barnes, 2003;Gallet and Bouvier, 2013) such that in 3D simulations the rotation rate of the star is assumed to be fixed. There is an ongoing debate based observational results suggesting magnetic braking slows down around the solar age which might be due to a transition to anti-solar differential rotation and a corresponding change in the dynamo (e.g. van Saders et al, 2016).
In general, the thermal evolution of the star in 3D simulations still occurs on a Kelvin-Helmholtz timescale where G is the gravitational constant. The Kelvin-Helmholtz time for the solar convection zone is of the order of 10 5 years which is still about two orders of magnitude longer than the longest global 3D simulations to date (Passos and Charbonneau, 2014;Käpylä et al, 2016). Various ways to overcome or circumvent this issue are discussed below in Section 3.1. The final timescale related to stellar structure is the free-fall or acoustic timescale τ ac = R 3 /GM , which is of the order of 30 minutes for the Sun.
In terms of global dynamos the most important timescales are the rotation period P rot and the convective turnover time, where ℓ is the convective length scale and u conv a suitably averaged convective velocity. The convective turnover time τ conv can be estimated from solar surface observation where granules overturn on a timescale of a few minutes. Knowledge of τ conv in deeper layers relies heavily on theoretical estimates, for example, from mixing length models (e.g. Böhm-Vitense, 1958). These assume that the length scale is proportional to the pressure scale height. At the same time, convective velocities decrease such that τ conv is of the order of a month near the base of the solar convection zone (e.g. Stix, 2002). Stellar observations indicate that dynamo efficiency of stars is related to the Rossby number (see, Section 5.2) The Rossby number is the only non-dimensional diagnostic that the simulations can capture relatively accurately; see Table 1 and Section 3.1. Another timescale that the simulations need to capture is the activity cycle period τ cyc which is 22 years for the Sun, and which varies between years to decades for stars other than the Sun (e.g. Baliunas et al, 1995;Hall et al, 2009;Olspert et al, 2018). It is, however, practically always necessary to run simulations considerably longer because establishing the global dynamo and reaching the final saturated dynamo mode takes typically significantly longer (e.g. Käpylä et al, 2013;Matilsky and Toomre, 2020). Taking the thermal relaxation also into account, the integration times are typically at least an order of magnitude longer than the cycles established. The necessity to run such long times is one of the major limiting factors in the quest to reach astrophysically relevant parameter regimes.
In principle the relevant length scales vary between the depth of the convection zone ∆R (or the radius of the star R for fully convective stars), and the Kolmogorov length scale ℓ ν where kinetic energy is dissipated into heat due to viscosity (or to the magnetic dissipation scale ℓ η in cases where Pr M > 1). According to the Kolmogorov turbulence phenomenology (e.g. Frisch, 1995), ℓ ν can be estimated from the Reynolds numbers at the integral (L) and Kolmogorov scales, For the Sun, L = ∆R = 2 · 10 8 m and Re L ≳ 10 12 (e.g. Ossendrijver, 2003;Jermyn et al, 2022) and Re ℓν = 1 by definition. These estimates yield an upper limit of order of magnitude ℓ ν ≈ 0.1 m near the base of the solar convection zone. More detailed calculations yield values between 0.01 m (Kupka and Muthsam, 2017) and 0.06 m (Schumacher and Sreenivasan, 2020). Furthermore, the dissipation scales of magnetic fields and temperature fluctuations can be estimated from ℓ η = ℓ ν Pr −3/4 M , and ℓ χ = ℓ ν Pr −3/4 , respectively. Even though Pr M , Pr ≪ 1, these scales are also very small in comparison to the depth of the convection zone or the radius of the star. As will be discussed below, all of the scales where physical diffusion occurs are several orders of magnitude smaller than what can be achieved in any current or foreseeable simulations (see also Kupka and Muthsam, 2017).
Another length scale that plays an important role is the pressure scale height H P = −dr/d ln p which is related to the vertical scale of convection cells. Near the surface H P is of the order of 100 km in the photosphere of the Sun. On the other hand, at the base of the convection zone H P ≈ 5 · 10 4 km. This reflects the fact that near the surface the pressure and density decrease very rapidly and that capturing both the deep and photospheric convection in a single model is therefore very challenging. In total the solar convection zone encompasses more than 20 pressure scale heights. This translates to a density difference of 10 6 between the photosphere and the base of the convection zone. Estimates of the relevant temporal and length scales in the deep parts of the solar convection zone are summarized in Figure 1.
3 Numerical approach to stellar dynamos

Simulation strategy
The main difficulty in solar and stellar dynamo simulations is that it is not feasible to match the dimensionless parameters with those of real stars as seen from the comparison of stellar and simulation parameters in Table 1. The only general exception to this is the Rossby number but even there we face the situation that only some of the convective scales in stars are strongly affected by rotation. For example, in the Sun the near-surface layers are practically unaffected by rotation whereas at the base of the convection zone the Rossby number is of the order of 0.1 (e.g. Ossendrijver, 2003). This is to be contrasted with the Earth's dynamo where the magnetic Reynolds number is Re M ≈ 10 3 , which is within reach of current simulations (e.g. Aubert and Gillet, 2021) and where all convective scales are strongly rotationally constrained (Ro ≈ 10 −6 ); see, e.g., Roberts and King (2013).
A path that stellar dynamo simulations often follow to approach physically relevant regimes is to assume a fixed convective Rossby number (Gilman, 1977), given by Here, the stellar luminosity fixes the level of driving through the Rayleigh number, and the stellar rotation rate is fixed by observations. Using typical estimates for Ra, Pr, and Ta for the Sun (Ossendrijver, 2003, see also Table 1) we arrive at Ro c ≈ 0.1 . . . 1. In simulations, the (SGS) Prandtl number Pr SGS = ν/χ SGS is often fixed and changing the diffusivities ν and χ SGS leads to Ra ∝ ν −2 , Ta ∝ ν −2 and Ro c = const. An obvious limitation is that the Prandtl number in simulations is typically close to unity whereas in stars Pr ≪ 1 (e.g. Augustson et al, 2019;Schumacher and Sreenivasan, 2020;Jermyn et al, 2022). A similar argument applies to Pr M in late-type stars whereas in the core convection zones of massive O and B stars Pr M ≫ 1 (e.g. Augustson et al, 2016). Furthermore, in iLES models the values of the dimensionless parameters are typically unknown and not precisely controllable, although it is often possible to determine these a posteriori (e.g. Strugarek et al, 2016;Hotta et al, 2022). Nevertheless, the strategy in both LES and iLES models is to try to capture the stellar Rossby number with unrealistic Prandtl numbers and to resolve enough scales in an effort to reach sufficiently high Re, Re M , and Pe such that the large scale results are no longer affected. However, it is still questionable whether such a regime has been reached even in the highest resolution simulations to date (e.g. Hotta et al, 2022;Guerrero et al, 2022).

Limitations of current numerical simulations
The challenge of doing direct numerical simulations (DNS) of stars is illustrated by considering the solar convection zone where the fluid Reynolds number is of the order of at least 10 12 (e.g. Ossendrijver, 2003;Jermyn et al, 2022). With this estimate and Eq. (25), the ratio of the system scale L, here taken to be the depth of the solar convection zone or 200 Mm, to the Kolmogorov scale ℓ ν , is With Re ℓν = 1, we obtain L/ℓ ν = 10 9 . This ratio gives the order of magnitude of grid points that is required to capture all of the physically relevant scales in the solar convection zone. Thus a direct 3D simulation requires 10 27 grid points. A somewhat lower, but still unattainable, number was reported in Chan and Sofia (1986). Current state-of-the-art global simulations have of the order of 10 10 grid points and are run on a few times 10 4 CPU cores. Assuming ideal weak scaling, where the computation time remains constant when the number of CPUs is increased proportional to the grid size, a DNS of the solar convection zone requires 10 21 CPU cores. Using a current 96-core AMD Epyc™ 9654 CPU with 360 W thermal design power as a reference 1 , gives a total power consumption of 3.8 · 10 21 W, corresponding roughly to a M9V main-sequence red dwarf. It is clear that such power is neither available nor meaningful to be spent. Although reaching an asymptotic regime where the large-scale dynamics are unaffected by the addition of further small scales is very likely possible at a significantly lower resolution, it is clear that even the highest resolution current simulations are not there yet (e.g. Käpylä et al, 2017a;Hotta et al, 2022).
Furthermore, the timestep in such hypothetical DNS of the solar convection zone is of the order of δt ≈ ℓ ν /max(c max sig ), where c max sig is the maximum signal propagation speed. In anelastic models this is set by the maximum flow velocity which is of the order of 1 km s −1 , whereas in the fully compressible case this is the sound speed c s , which at the base of the convection zone is around 200 km s −1 . This gives δt = δt dyn ≈ 2 × 10 −4 s for anelastic and δt = δt ac ≈ 10 −6 s for fully compressible models. In practice, the resolution is much lower and corresponding estimates for a high-resolution global simulation with 500 uniformly spaced grid points in radius gives δt ac ≈ 2 s and δt dyn ≈ 10 minutes. The latter is still longer than the convective turnover time near the surface of the Sun, where τ r=R⊙ conv ≈ 1 minute. The surface of the Sun is extremely challenging to be taken into account in a global model due to a combination of very small length scales and short time scales and the Mach number approaching unity. Therefore a full Sun simulation requires a numerical scheme capable of dealing with practically all Mach numbers and multiscale convection. Furthermore, the boundary region where radiative cooling takes place near the surface is extremely thin, around 10 km, in comparison to the depth of the convection zone (Kupka and Muthsam, 2017). Typically simulations either do not reach all the way to the photosphere, or consider a shell reaching to R = R ⊙ but with a much lower density stratification than in the Sun, and the boundary layer near the surface is made artificially thicker to resolve it numerically.
Another constraint arises due to a widening discrepancy of the timescales involved when resolution is increased: as was discussed earlier, a simulation of the Sun needs to cover at least a solar cycle or preferably several cycles to be considered viable such that the simulated time τ sim ≳ τ cyc . For the sake of argument, an acceptable maximum wall-clock time that a simulation is permitted to run to is taken to be a year. This requires that the star in the simulation has to evolve at least 22 times faster than in real time. However, when the grid resolution is increased, the timestep in explicit time-stepping methods decreases in proportion with the grid spacing δx, and the computational cost of simulation increases with δx 4 . Even if the numerical scheme has ideal weak scaling, the time to solution doubles every time the resolution is doubled, which typically cannot be avoided. This poses stringent constraints on either the length, or the grid resolution, of simulations targeting global stellar dynamos. The timestep constraints can, to a certain degree, be alleviated by the use of implicit time stepping methods (e.g. Viallet et al, 2011) or by the use of local subgrids and timesteps (e.g. Popovas et al, 2022).
A futher complication arises due to the thermal relaxation. In anelastic models, where the real stellar luminosity is often used, the Kelvin-Helmholtz time is much longer than the integration times of simulations. However, this is a worst-case scenario because deep stellar convection zones are nearly adiabatic which is exploited in the simulation setups. Thermal relaxation can still take a prohibitively long time if a stably stratified radiative layer is retained below the convection zone. This issue is sometimes alleviated by adjusting the radiative conductivity in the overshoot layer below the convection zone; see e.g. . However, this can lead to over-or underestimation of convective overshooting depending when and how such adjustments are made (Käpylä, 2019). Another possibility is to adjust the thermodynamic state and fluctuations recursively toward an equilibrium solution Anders et al (2018,2020), although this method has yet to gain widespread adoption in compressible or global 3D simulations.
In fully compressible simulations the timestep would be very short because it is determined by the sound speed at the base of the convection zone. This has been circumvented by the reduced sound speed technique (RSST) where the sound speed is artificially lowered such that the timestep issue is alleviated (e.g. Hotta et al, 2014). Another approach is the enhanced luminosity method (ELM) where a luminosity that is much higher than in real stars is used (e.g. Käpylä et al, 2013Käpylä et al, , 2020, leading to a higher Mach number and therefore a diminished gap between the acoustic and dynamical timescales, as well as a correspondingly shorter Kelvin-Helmholtz time. Given that the luminosity enhancement is sufficiently large, it is possible to resolve the Kelvin-Helmholtz timescale using fully compressible MHD equations (e.g. Käpylä, 2023). The cost of this method is that in addition to higher flow velocities, also the thermodynamic fluctuations are enhanced, and a direct comparison with observations requires the use of scaling relations. Furthermore, to achieve the same Rossby number as in a real star with realistic luminosity, the rotation rate has to be increased in proportion to the Mach number, which would lead to unrealistically large centrifugal force (e.g. Navarrete et al, 2022).

Numerical methods and codes
There are a variety of codes solving the MHD equations in spherical shells and targeting solar and stellar global dynamos. The first and still popular approach is to adopt the anelastic approximation where the sound waves are filtered out by neglecting the time derivative in continuity equation. Then it is convenient to use spherical harmonics to solve for the horizontal dynamics whereas the vertical discretisation is often done with finite differences or Chebychev polynomials. Codes using this approach include ASH (e.g. Clune et al, 1999;Brun et al, 2004;Jones et al, 2011;Brun et al, 2022), Rayleigh , and MagIC (e.g. . Eulag is another anelastic code but instead of spherical harmonics, it relies on a second-order accurate multidimensional positive-definite advection transport algorithm (MPDATA) and implicit time stepping (e.g. Smolarkiewicz and Charbonneau, 2013).
Another popular technique is to use the fully compressible formulation and using some flavour of finite difference methods. This typically leads to coordinate singularities at the axis and at the centre of the star, which are circumvented by either omitting regions near the axis (spherical wedge, cf. Käpylä et al, 2012;Mabuchi et al, 2015), using partially overlapping grids (yin-yang grid cf. Hotta et al, 2015), or embedding a spherical star into a Cartesian cube (star-in-a-box model, cf. Dobler et al, 2006;Käpylä, 2021). The Mach number issue of fully compressible simulations is dealt with by RSST and ELM methods that were discussed above. Codes using fully compressible formulation include the Pencil Code (Pencil Code Collaboration et al, 2021), R2D2 (Hotta et al, 2015), and the code used in Mabuchi et al (2015). Further methods include the Dedalus framework which uses spectral methods and is capable of solving incompressible, anelastic, and fully compressible equations in varying geometries (Brown et al, 2020;Burns et al, 2020;Anders et al, 2022a), and the Dispatch framework where various solver for compressible flows are possible and which uses local subdomains and timesteps (Nordlund et al, 2018;Popovas et al, 2022).

Relevant solar and stellar observations
The dynamo simulations discussed in this review aim, ultimately, to capture the flows and magnetism occurring in real stars. Here, we briefly describe some of the most pertinent observational constraints on these processes, which also serve to motivate and guide our work. Perhaps the most obvious characteristics that any dynamo simulation would hope to match are the Sun's observed differential rotation and its periodic cycle of magnetic activity.
In Figure 2, we sample the solar interior rotation profile as revealed by helioseismology (e.g. Schou et al, 1998). The Sun's surface differential rotation -with a fast equator and a slow pole -imprints through the convection zone, with nearly solid-body rotation in the portions of the radiative zone below that are accessible to these global-scale inversions. There are two prominent shear layers -the tachocline near the base of the convection zone and the nearsurface shear layer (NSSL) in the upper portions of the convection zone. The apparent width of the tachocline in this representation reflects the width of the inversion kernels used; its true width is thought to be narrower. Note, too, that although the shear within the convection zone has not spread through the radiative interior, the average rotation rate of the interior is commensurate with the average rate of the envelope; since the Sun is continuously losing angular momentum via its magnetized wind, and so spun more rapidly in the past, this observation implies some level of coupling between the two regions (Gilman et al, 1989;MacGregor and Brenner, 1991;Spiegel and Zahn, 1992;Gough and McIntyre, 1998;Brun et al, 2011;Matt et al, 2015). Ideally, a simulation would self-consistently capture at least a few key attributes of this profile: e.g., the overall pole-to-equator shear within the convection zone; the fact that isocontours of Ω are more nearly aligned with radius than they are with the rotation axis, in evident tension with the Taylor-Proudman theorem (e.g. Miesch et al, 2006); and the existence and properties of both the NSSL and the tachocline. In practice each of these remain a challenge, though as discussed later in this review (Section 5.1), the latest 3D MHD global simulations of solar interior dynamics and angular momentum transport do manage to capture many of these elements without undue tinkering.
The most striking observational constraints on the magnetism involve its systematic evolution with space and time, as sampled in the famous "butterfly diagram." An example is provided in Figure 3, which shows the longitudinallyaveraged line of sight component of the magnetic field for every Carrington rotation since 1975 (based on Wilcox, GONG and Solis synoptic map data; Brun et al, 2020). Strong fields emerge at mid-latitudes and then, over the course of roughly 11 years, appear progressively nearer the equator; the polarity of these emergent fields is the same for most of the low-latitude events in the Northern hemisphere, and opposite to that in the Southern; the overall polarity of the field flips at the end of each 11-year period. There is also a prominent polar branch of activity, which is at its strongest when the equatorial branch is at its ebb; the polarity of this polar branch matches that of the following equatorward branch. The polarity of the poloidal field thus reverses when active region emergence is at its maximum. The overall number On the whole, the Sun's ordered field exhibits dipole parity throughout most of the cycle (it is antisymmetric about the equator), but there are periods near cycle maximum during which the parity is mostly quadrupolar. The relative amplitudes of the dipolar and quadrupolar modes are shown in Figure 4 over the past few cycles Brun et al (2020). These relations constitute another powerful constraint on dynamo models. For example, there is evidence that around the pronounced period of low surface activity known as the Maunder minimum, the Sun's observed surface activity was predominantly confined to one hemisphere, indicating different parity relations; the implications of this finding for dynamos generally (and grand minima in particular) have been considered by, e.g., Sokoloff and Nesme-Ribes (1994) and many subsequent papers.
Very recently, new constraints have begun to emerge from the study of inertial and Rossby wave modes that propagate within the convection zone. These toroidal modes have recently been observed in helioseismic maps of nearsurface horizontal flows obtained by HMI aboard SDO (Gizon et al, 2021); see also Hanson et al (2022) for another recent detection of solar inertial modes. Though modeling of these modes is still in its infancy (Bekki et al, 2022;Triana et al, 2022) they appear to hold great promise for constraining aspects of the convection that would be difficult or impossible to estimate by other means. As a first application, Gizon et al (2021) illustrate that these modes constrain the superadiabaticity and turbulent diffusivity of the deep solar convection zone.
Finally, we turn briefly to observations of other stars. Many aspects of observational stellar magnetism are treated elsewhere in this volume, and in other reviews (e.g. Reiners, 2012;Brun and Browning, 2017) so we note only a few key constraints that must eventually be matched by simulations. The most celebrated of such constraint is the "rotation-activity correlation," sampled in Figure 5. In stars with convective envelopes, surface measurements of magnetic activity first increase with rotation rate, then plateau ("saturate") at a certain point. Here we show examples in which activity is measured by coronal emission (Wright et al, 2018) Typically in these studies the influence of rotation is characterized via a simple estimate of the Rossby number where the convective turnover time is typically based on simple empirical relations that work well for main-sequence stars (e.g. Noyes et al, 1984). When viewed in this way, many different types of stars -including those with and without a stable radiative region -appear to exhibit the same basic relationships. Comparisons of young and evolved main-sequence stars also suggest a similar level of activity as function of Ro in terms of Ca II H&K emission, provided that the convective turnover time is an outcome of 1D stellar models (Lehtinen et al, 2020).
The rotational velocity of a solar-like star changes systematically over time, as it loses angular momentum through a magnetised wind, so over the course of its life it will trace a variety of positions on this rotation-activity correlation. Indeed, measurements of rotation rate are used in "gyrochronology" as proxies for age, because many stars are found to exhibit a common, tight relation between spin rate and time -the so-called Skumanich law; see discussions in Skumanich (1972), Soderblom (1983), and Barnes (2003). Lately there have been some indications that this relationship may break down at late ages (e.g. van Saders et al, 2016), which may provide additional constraints on the dynamo for old stars (e.g. Metcalfe and van Saders, 2017). In a related vein, there is some evidence for enhanced stellar activity in a subset of slowly-rotating stars, which some authors have suggested may be linked to the presence of strong anti-solar differential rotation (Brandenburg and Giampapa, 2018). Global dynamo simulations seem to capture this effect; see Karak et al (2015), Warnecke and Käpylä (2020), and Brun et al (2022).
Together, these observations of the Sun and other stars constitute powerful constraints that models would hope to satisfy. In the following sections, we will examine the extent to which they actually do so. 5 Simulations of solar and stellar dynamos

Convection and dynamo in the current Sun
In addition to the fundamental numerical restrictions discussed above, simulations of the current Sun are challenging due to the possible proximity of the transition from solar-like to anti-solar differential rotation. This transition occurs around Ro ≈ 1 (e.g. Käpylä et al, 2011a;Gastine et al, 2014; and current simulations of the Sun appear to lie close to this in parameter space. Simulations with the nominal solar luminosity and rotation rate land predominantly in the anti-solar regime (e.g. Käpylä et al, 2014), which is one of the manifestations of the convective conundrum (O'Mara et al, 2016), or the lower than expected velocity amplitudes and Rossby number in the Sun in comparison to theoretical estimates and simulations, which is discussed in more detail elsewhere (e.g. Hanasoge et al, 2016). Therefore simulations targeting the Sun often resort to lowering the Rossby number artificially to obtain a solar-like differential rotation profile. This is most often done by suppressing the convective velocity by enhancing radiative diffusion (e.g. Käpylä et al, 2014;Fan and Fang, 2014;Hotta et al, 2016;Noraz, 2022), lowering the luminosity (e.g. Hotta et al, 2015;Guerrero et al, 2022), or by increasing the rotation rate.
The importance of reproducing the solar interior rotation lies in the fact that the dynamo process crucially relies on flows of various scales to maintain the observed magnetic field. At the very least, the large-scale flows are employed by all of the currently predominant solar dynamo models (Charbonneau, 2020). Furthermore, it is also likely that turbulent effects, such as an α effect due to helical convection-driven turbulence, are important in the dynamo process. This highlights the importance of accurate modelling of convection, essentially necessitating that the solar velocity field has to be sufficiently well reproduced first before one should expect success in reproducing the dynamo. An important step in this is the identification of the relevant force balances that need to be reproduced in simulations. Following such an approach, a path in parameter space may be found that leads to solar-like results with feasible numerical cost. Such "path approach" is quite commonly used now in geodynamo modelling (Aubert et al, 2017;Aubert and Gillet, 2021).
The convective conundrum is arguably the greatest obstacle in achieving the goal of simulating the solar dynamo successfully. Several ideas have recently been invoked to alleviate the discrepancy between models and reality. One of these ideas is that this is a manifestation of rotationally constrained convection in the interior of the Sun. In this scenario the maximum scale of convection in the deep parts of the solar convection zone is not giant cells, as is expected from mixing length models, but it matches instead that of the supergranulation, which is also detected from surface observations (Featherstone and Hindman, 2016a;Vasil et al, 2021). While simulations of rotationally constrained convection do produce smaller convective scales that become smaller as rotation becomes more rapid (e.g. Viviani et al, 2018), the main contribution to differential rotation in such models is still due to giant cell convection (e.g. Käpylä, 2023) or thermal Rossby waves that have not yet been detected in the Sun.
Another idea that has gained popularity recently is that the deep parts of the solar convection zone can be weakly stably stratified. This is thought to result from strong driving of convection in the near-surface layers, whence plumes of cool low entropy material plough through the whole convection zone and deep into the stably stratified layers below. Such idea of cool entropy rain was put forward by Spruit (1997) and later incorporated into a modified mixing length model by Brandenburg (2016). In the extreme versions of these models only a very thin layer (down to a few Mm) near the surface of the convection zone is Schwarzschild unstable and the rest of the convection zone is weakly subadiabatic and mixed by the entropy rain. Such effects were explored in 3D simulations by Nelson et al (2018) by means of a boundary condition consisting of localised cooling patches. Although non-rotating simulations often find relatively deep subadiabatic layers (e.g. Tremblay et al, 2015;Hotta, 2017;Käpylä et al, 2017b), their effect in global simulations appears to be weak Viviani and Käpylä, 2021). This could also be due to the modest resolutions and supercriticality of convection in those studies.
Furthermore, the influence of the thermal Prandtl number has also recently been studied. In particular, several studies have concentrated on cases where the effective Prandtl number is greater than unity (e.g. O'Mara et al, 2016;Bekki et al, 2017;Karak et al, 2018). This was motivated by the observation that the overall velocities are decreased in high-Pr convection. However, this also coincides with more effective downward flux of angular momentum, exacerbating the problems related to anti-solar differential rotation Karak et al (2018). Another recent study Käpylä (2023) confirmed these ideas and showed that the Prandtl number dependence is relevant in the regime Pr ≳ 1, whereas for Pr ≲ 1, the parameter regime relevant for the Sun, no statistically significant dependence was detected.
Finally, the role of magnetism in shaping the solar rotation profile is also a viable option to explain the convective conundrum. Whereas early forays into this field yielded somewhat contradictory results with some studies finding essentially no dependence on magnetic fields (Karak et al, 2015), others reported a flip from anti-solar to solar-like differential rotation (Fan and Fang, 2014;Simitev et al, 2015). All of these simulations were made at relatively modest magnetic Reynolds numbers, and it is likely that a SSD was not excited in these models. The recent high-resolution implicit large-eddy simulations (iLES) (Hotta and Kusano, 2021;Hotta et al, 2022), have reached a regime where small-scale magnetic fields are generated throughout the convection zone and turn a hydrodynamically anti-solar run to a solar-like solution at the highest resolution. Somewhat worryingly, these simulations have yet to show convergence as a function of resolution such that the flows at large scales changes significantly even between the two largest resolutions. Recently, Käpylä (2023) reported that it is easier to excite solar-like differential rotation for higher Re M from simulations with explicit diffusivities where Re M exceeded the threshold for SSD. However, this effect is much less drastic than in the iLES simulations.
The radial shear in the solar convection zone occurs predominantly in the boundary layers which are difficult to incorporate in global simulations. The near-surface shear layer is thought to be generated in the weakly rotationally constrained small-scale convection in the outermost parts of the solar convection zone (e.g. Kitchatinov, 2016) or due to gyroscopic pumping effects (e.g. Miesch and Hindman, 2011). Capturing this in global simulations is challenging because a very high resolution is required to capture the near-surface smallscale convection resulting from a steep decrease of fluid density. First such simulations were presented by Hotta et al (2015), who were able to capture some aspects of the NSSL. However, these simulations were hydrodynamic and no corresponding dynamo solutions have been presented so far. The NSSL has also been suggested to shape the global solar dynamo Brandenburg (2005), but no direct evidence supporting or refuting this theory is currently available.
The other boundary layer at the interface of the convective and radiative layers, the tachocline, is perhaps even more challenging to capture in simulations. The main challenge is that the solar tachocline is very thin (certainly less than five per cent of solar radius, but likely much less), and it has been confined now for five billion years. Estimates of radiative spreading for the Sun suggest that the tachocline should be much thicker at the current age of the Sun so there has to be a mechanims preventing this. Several magnetic scenarios have been invoked to explain this, including a dipolar fossil field in the radiative core or a cyclic dynamo in the convection zone. Some current simulations do exhibit tachocline-like features, but they are spreading into the radiative core at rates that are much higher than expected for the Sun (e.g. Brun et al, 2011. Furthermore, iLES models also produce tachoclines at relatively low resolutions, although their confinement mechanism is yet to be understood (Guerrero et al, 2013(Guerrero et al, , 2016. In all of the aforementioned simulations the diffusivities in the radiative interior were either explicitly or implicitly greatly reduced. In apparent contradiction to these models, Matilsky et al (2022) were able to obtain a relatively thin tachocline and essentially rigidly rotating radiative core in a simulation where the diffusivities were not decreased but which housed a cycling non-axissymmetric dynamo in the convection zone. Furthermore, this model has also strong horizontal flows in the radiative interior. The actual process of tachocline confinement is still unclear in this case, although it does share some characteristics with the cyclic dynamo confinement process suggested by Forgács-dajka and Petrovay (2001); see also Barnabé et al (2017).
Given the difficulties in reproducing the solar flows, it is then hardly surprising that dynamo simulations have had a hard time reproducing the solar large-scale magnetism. The most severe issue is the difficulty in obtaining solar-like equatorward migration of activity belts in simulations with solar-like differential rotation. Nevertheless, several simulations have appeared showing equatorward migration and which capture many aspects of solar observations. For example, Käpylä et al (2012) reported equatorward migration from spherical wedge simulations that were later shown to be in accordance with a Parker-Yoshimura dynamo wave resulting from a mid-latitude minimum of angular velocity which is not present in the Sun (Warnecke et al, 2014. A similar mid-latitude dip is seen also in the equatorward migrating solutions of Augustson et al (2015). Further examples of equatorward propagating solutions have been reported by Duarte et al (2016), Matilsky and Toomre (2020), Strugarek et al (2017Strugarek et al ( , 2018, and Brun et al (2022); see also Figure 6. The latter authors argued that a non-linear interplay between the magnetic fields and differential rotation can lead to solar-like long period cyclic dynamos. Another recent example shows equatorward migration near the surface but poleward migration at depth in a star-in-a-box model (Käpylä, 2022), where a spherical star is embedded into a Cartesian cube. In such models the boundary of the star is immersed into the domain and, in theory, allows for a more realistic magnetic boundary condition. This was shown to be important in that if the exterior was made a poor conductor, the global dynamo solution changed from oscillatory to quasi-static. This confirms earlier results of (Warnecke et al, 2013(Warnecke et al, , 2016, where the influence of a simplified coronal layer as upper boundary on the flow and magnetic field evolution was studied. These simulation results and their interpretation add to the ongoing debate regarding the location and dominant physical mechanisms of the solar global dynamo. The current state of affairs is particularly clearly manifested by the wide variety of mean-field models that have been put forward to explain the solar cycle. A popular class of models include flux-transport (e.g. Dikpati and Charbonneau, 1999) and Babcock-Leighton (e.g. Cameron and Schüssler, 2017) dynamos where a minimal set of physically plausible ingredients, such as differential rotation and meridional circulation and the decay of active regions near the solar surface are taken into account. These models typically rely on buoyantly rising flux ropes (e.g. Caligari et al, 1995) that are the result of strong shear in the tachocline, and the turbulent flows in the convection zone play only the role of turbulent diffusion. On the other hand, distributed turbulent dynamos take into acount a variety of effects that arise in mean-field electrodynamics and assume magnetic field generation throughout the convection zone (e.g. Brandenburg et al, 1992;Käpylä et al, 2006;Pipin and Kosovichev, 2013). The obvious drawback of mean-field models is that the individual effects can be adjusted which leads to a great temptation to finetune the models. The main advantage of 3D simulations is that this freedom is greatly reduced (although by no means completely eliminated). A major part of the debate regarding the solar dynamo revolves around the relevance of the tachocline.
Unfortunately the advent of 3D simulations with and without tachoclines has not provided conclusive evidence one way or the other. For example, Guerrero et al (2016) studied both cases with Eulag simulations and found that dynamos operating solely in the convection zone had shorter cycles and intermittent turns-off of activity. On the other hand, dynamos operating at tachocline levels result in long, coherent, magnetic cycles. Whereas the dynamos operating in the convection zone are understood as distributed αΩ dynamos, those operating at the tachocline may be of α 2 Ω type, with the α effect generated by instabilities that extract energy from the magnetic field (e.g., Tayler or buoyancy instabilities; see Guerrero et al, 2019). Furthermore, simulations with (Käpylä, 2022) and without (Käpylä et al, 2012;Warnecke, 2018) tachoclines from other models produce cyclic dynamos that share some characteristics of the solar cycle. A general conclusion is that long cycles appear to be generated at depth while shorter ones have their origin near the surface (e.g. Käpylä et al, 2016).
Apart from the non-linear dynamo invoked by Strugarek et al (2017) and Brun et al (2022), another physical mechanism proposed to be responsible for the equatorward migration include helicity inversion in the deep parts of the convection zone. This is typically encountered in overshoot regions below the convection zone (e.g. Ossendrijver et al, 2001). However, a much deeper helicity inversion was obtained in simulations by Duarte et al (2016), and which resulted in a change of the propagation direction of the dynamo wave in accordance with the Parker-Yoshimura rule. In these simulations convection was, however, inefficient in the bulk of the convection zone which is not the situation in the solar convection zone. Such reversed helicity configuration can perhaps arise if much of the convection zone is stably stratified as in the proposed entropy rain scenario, but there is currently no simulation that has produced this.
A yet further possibility is that the solar dynamo is driven predominantly by the kinetic helicity as in classical α 2 dynamos that can lead to equatorward migration if the α effect has a sign change at the equator (Baryshnikova and Shukurov, 1987;Rädler and Bräuer, 1987). Such helicity profile is expected due to symmetry arguments theoretically, and is a standard outcome in convection simulations (e.g. Brun et al, 2004). The equatorward migrating dynamo wave has been demonstrated by three-dimensional forced turbulence simulations (e.g. Mitra et al, 2010;Warnecke et al, 2011), but no definitive evidence from convection exists.
There have also been attempts to capture the long term modulations in dynamo cycles from simulations. These studies have extended the simulations to cover several tens of cycles corresponding to up to a millenium in solar time (e.g. Passos and Charbonneau, 2014;Augustson et al, 2015;Käpylä et al, 2016). These simulations revealed modulation of activity and occasional periods of low activity reminiscent of grand minima (Augustson et al, 2015;Käpylä et al, 2016). Such grand minima states can arise due to an interplay of symmetric and anti-symmetric dynamo modes (e.g. Tobias, 1997) or stochastic fluctuations in the buoyancy driving or in the conventional α effect (e.g. Ossendrijver, 2000;Brandenburg and Spiegel, 2008). However, the modulations and minima in simulations are clearly weaker compared to the solar observations. This is perhaps not too surprising because to run these simulations sufficiently long they need to be done at modest resolutions and cannot therefore be highly supercritical.

The Sun at different ages
During its 4.5 billion years of evolution, the Sun has experienced various changes in its internal constitution, and therefore, the extent of its convection zones and resulting large-scale flows and magnetic fields. In this section we describe numerical simulations of the Sun, or Sun-like stars, corresponding to these evolutionary stages from the formation to the current age.

The pre-main sequence phase
Significant structural changes occurred early in the solar evolution during the pre-main sequence (PMS) stage, as the newly formed object is still contracting. Objects at this stage, with masses similar to the solar mass, are called TTauri stars. While the temperature at the center of the protostar is still increasing, the opacity of the gas is high and the transport of energy occurs entirely due to convection. The actual rotation rate of the Sun in the TTauri phase is unknown, but models can be constructed to characterise it (e.g. Ahuir et al, 2020). Moreover, observations of open clusters have found distributions of rotational periods between roughly 1 and 10 days for solar-like stars with ages around 3 Myrs (see e.g., Gallet and Bouvier, 2013).
The large-scale magnetic fields of TTauri stars are predominantly dipolar with field strengths of the order of kG (e.g. Johns-Krull, 2007). Fields with a similar topology are also often observed in low mass, fully convective and rapidly rotating M dwarfs (e.g. Kochukhov, 2021). Therefore, despite the difference in mass, simulations of TTauri stars and low-mass M dwarfs are, to some extent, comparable. However, the latter will be discussed in detail in Section 5.3.3. Following the evolution further, the protoplanetary disc disappears after about 10 6 − 10 7 years since the beginning of the collapse. The protostar continues to contract, and therefore its angular velocity increases. Simultaneously, the star starts to develop a radiative core. Both, the angular velocity and the radiative zone increase before the star reaches the zero age main sequence (ZAMS) after about 5 × 10 7 years. As mentioned above, during the TTauri phase the magnetic field of a solar-like star is mainly dipolar. Observations suggest increasing complexity of the magnetic topology once the star develops a radiative zone (Gregory et al, 2012).
There are currently only a few simulation studies that specifically target dynamos in the TTauri and PMS phases of stellar evolution. One such example is the study of Zaire et al (2017) who considered models in the fully and partially convective phases of PMS evolution. While the differential rotation was more pronounced in the latter evolutionary phase, the resulting quasi-steady predominantly quadrupolar magnetic field configurations were quite similar. A more complete study was performed by Emeriau-Viard and Brun (2017), where five epochs between the TTauri stage and the ZAMS were studied for a 1M ⊙ star. Each epoch is characterised by a diffrent internal structure and rotation period. The sequence of simulations shows a decreasing dipole contribution to the magnetic field as a function of age. However, even in the early fully convective phase, the dipole constitutes only about ten per cent of the total magnetic energy. In this case the azimuthally averaged large-scale magnetic field is cyclic with with poleward migration, reminiscent of the simulations of fully convective M dwarfs (e.g. Brown et al, 2020;Käpylä, 2021). The transition between dipole-dominated and multipolar dynamos is discussed in more detail from the perspective of simulations in Section 5.3.3.

Main sequence Sun-like stars: rotational evolution of differential rotation and dynamos
On the main sequence, the rotation rate of stars decreases following the observational Skumanich (1972) law, associated to the loss of angular momentum due to magnetized stellar winds. There have been some speculative ideas about the origin of the non-saturated and saturated regimes of the rotation-activity relationship of stars (e.g. Kawaler, 1988;Matt et al, 2015). For instance, Wright et al (2011) suggested that a turbulent (interface) dynamo is at work in rapidly (slowly) rotating stars. However, the fact that fully convective stars also follow the power law for slow rotation (Wright and Drake, 2016) suggests the possibility of a general dynamo theory for all main sequence stars. Nevertheless, to the date, there is no agreement about this theory. One of the main hindrances is the difficulty in observing differential rotation as a function of Ro (e.g. Reinhold and Arlt, 2015;Benomar et al, 2018), but a new approach has been recently proposed by Noraz et al (2022) using Kepler data. Equally difficult is obtaining unambiguous measurements of dynamo cycle periods and systematics as a function of rotation as already discussed. Numerical simulations, on the other hand, can be performed at arbitrary rotation rates corresponding to different ages of the star. Below, we summarize the relevant findings for the differential rotation and dynamos for a solar mass star from its youth to the present age and beyond. The Rossby number dependence of large-scale mean flows has been studied in various papers (e.g. Ballot et al, 2007;Käpylä et al, 2011b,a;Guerrero et al, 2013;Gastine et al, 2014;Featherstone and Miesch, 2015;. These studies considered different rotation rates for roughly the same structural model resembling the solar interior. Irrespective of the numerical scheme, the results confirmed that the relative radial differential rotation ∆Ω/Ω changes from positive (solar-like differential rotation), for small Ro, to negative (anti-solar) for large Ro (see left panel of Figure 7, adapted from Gastine et al, 2014), with the transition happening near Ro = 1. In Viviani et al (2018), the modulus of the absolute differential rotation was also found to decrease rapidly with the rotation rate for Ro ≲ 0.1; see right panel of Figure 7 and Figure 8 of Brun et al (2022). This decrease, however, can be due to low supercriticality of convection at such low Ro. General consensus from simulations is that for sufficiently rapid rotation the differential rotation is negligibly small. This has implications on the theoretical interpretation of dynamos in the classical mean-field dynamo framework; see Section 6. Another characteristic is the appearance of non-axisymmetric convective modes, or active nests, in the rapidly rotating regime, Ro ≪ 1 (Brown et al, 2008). Such non-axisymmetric convection has recently been suggested to be the origin of stellar active longitudes (Bice and Toomre, 2022). Regarding the structure of convection, it is evident from all simulations that rotation breaks the broad convective cells observed in non-rotating or slowly rotating simulations. Quantitatively, Featherstone and Hindman (2016a) found that the harmonic degree where the spectrum has a maximum, ℓ peak , scales with the Rossby number as ℓ peak ∼ Ro −1/2 (see also Viviani et al, 2018). This means that the faster the rotation, the smaller the scales where most of the kinetic energy is contained. This applies to regions of the convection zone where Ro ≲ 1; in the nearsurface layers Ro ≫ 1 even in the most rapidly rotating stars, and the size of photospheric convection cells is likely independent of stellar rotation.
As discussed in Section 4, the rotation of stars slows down due to magnetic braking as they age. The young Sun was therefore a much faster rotator than what it is today. Simulations of rapidly rotating (Ro ≲ 0.1) young solar-like stars have been performed by several groups using various numerical methods. Quite surprisingly, the results in this parameter regime are rather inhomogeneous: there are three distinct dynamo modes that have been reported from such studies. First, there is the large-scale dipole-dominated solutions (e.g. Yadav et al, 2015b;Zaire et al, 2022) that are reminiscent of the geodynamo and those of Saturn and Jupiter. Another outcome is that the large-scale magnetic fields are dominated by a non-axisymmetric m = 1 mode that often propagates either in retro-or prograde fashion (e.g. Cole et al, 2014;Yadav et al, 2015b;Viviani et al, 2018;Viviani and Käpylä, Fig. 7 Left: Measure of the radial differential rotation at the equator for several studies in the literature. Adapted from Gastine et al (2014). Right: Modulus of the absolute latitudinal differential rotation from simulations of a solar-like star Viviani et al (2018), whereΩ is the rotation rate normalized by the solar rotation (©ESO. Reproduced with permission). The dotted line corresponds to the transition of anti-solar to solar-like differential rotation at Ro ≈ 0.35 and the dashed line separates the two regimes of differential rotation dependence at Ro ≈ 0.08. 2021; Navarrete et al, 2022). Finally, some simulations produce predominantly axisymmetric but multipolar large-scale fields in such rapidly rotating setting (e.g. Strugarek et al, 2018). It is unclear why there is such a variety in magnetic field topologies in this regime. A possible cause is that the dynamo is sensitive to relatively minor differences in the boundary conditions (see, e.g. Warnecke et al, 2016) and/or other details of the simulation setups (Orvedahl et al, 2021).
Two further regimes of dynamos can be distinguished on either side of transition between solar-like to anti-solar differential rotation. When rotation is rapid enough such that a solar-like differential rotation is produced, the largescale fields are predominantly axisymmetric and often cyclic (e.g. Brown et al, 2010;Ghizaru et al, 2010;Käpylä et al, 2012;Nelson et al, 2013;Augustson et al, 2015;Warnecke, 2018;Matilsky and Toomre, 2020). As mentioned above, in some cases this behavior continues to much more rapid rotation whereas in others non-axisymmetric or dipolar dynamos modes take over. When rotation is slow enough and the differential rotation is anti-solar, the magnetic fields are predominantly axisymmetric and quasi-steady (e.g. Käpylä et al, 2017a;Strugarek et al, 2018;Warnecke, 2018). In the transition between the two regimes, the dynamo may excite the two modes simultaneously . The appearance of cycles appears to be related to the strength of the differential rotation such that long decadal cycles, such as in the Sun, appear in a relatively narrow range of Rossby numbers where the differential rotation is strong (Warnecke and Käpylä, 2020;Brun et al, 2022, see the left panel of Figure 8).
Regardless of the commonalities between different modeling approaches, the simulated magnetic cycle seem to be sensitive to the subtleties of the models, and there is no clear agreement regarding the scaling of cycle periods as a function of rotation as can be seen in the right panel of Figure 8 compiling the results of Strugarek et al (2018), Warnecke (2018), Guerrero et al (2019), and Käpylä (2022). Furthermore, none of the scaling laws from simulations seem to unambiguously agree with the observed cycles that are sometime grouped in activity branches with P rot /P cyc ∝ Co α , where α > 0 (e.g. Saar and Brandenburg, 1999;Brandenburg et al, 2017). It is worth mentioning, however, that the observational results may also present problems and, depending on the used analysis techniques, the distinct activity branches may not even exist (e.g. Bonanno and Corsaro, 2022).
As shown in Figure 7 (left), the amplitude of the differential rotation has maxima on either side of the solar-like to anti-solar transition. The strong shear in the anti-solar regime has been speculated to lead to enhanced magnetic activity (Brandenburg and Giampapa, 2018). While this has not been systematically studied, some evidence of enhanced magnetic energy for antisolar differential rotation has been found in simulations (e.g. Karak et al, 2015;Warnecke and Käpylä, 2020;Brun et al, 2022). A much more unambiguous observational fact is that the stellar magnetic activity and magnetic fields saturate for Ro ≲ 0.1 (e.g. Reiners et al, 2022, see also Section 4). This does not appear to happen in simulations, where the magnetic energy typically increases with rotation even for the fastest rotation considered so far (e.g. Warnecke and Käpylä, 2020). Furthermore, the ratio of magnetic to kinetic energy increases roughly proportional to Ro −1 (Augustson et al, 2019;Warnecke and Käpylä, 2020) in accordance with Magneto-Archimedean-Coriolis (MAC) balance. Brun et al (2022) showed that the large-scale surface fields follow even a steeper increasing trend ∝ Ro −1.4 with decreasing Rossby number. However, this is consistent with stellar observation in the magnetically nonsaturated regime (See et al, 2019;Brun et al, 2022). Nevertheless, it is unclear why the simulations deviate from observations in that they do not show indications of saturation when the Rossby number is decreased. It is plausible that missing surface physics, such as the lack of spot formation in the simulations contributes to this issue.

Stars other than the Sun
Most stars are not like the Sun. A large majority (in our galaxy, anyway) are M dwarfs, which are less massive than the Sun, considerably less luminous (ranging down to about 10 −3 L ⊙ ), and in some cases convective throughout their interiors. At the other end of the H-R diagram, stars more massive than the Sun have convective cores and predominantly stable (radiative) envelopes, accompanied in some cases by thin near-surface convection zones. These highmass stars can be thousands of times more luminous than the Sun; thus across the main sequence, luminosities vary by a factor of more than a million. These enormous variations in luminosity, and in the geometry and stratification as well, must influence the convection and dynamo action occurring in these stars. In this section, we therefore briefly describe our current understanding of dynamo action in main-sequence stars at lower and higher masses. Our focus here is on what has been revealed by basic theory and by simulations.  (2019), and Käpylä (2022). Estimated location of the Sun is indicated by the symbol ⊙. Adapted from Käpylä (2022).
From the standpoint of dynamo theory, stars vary not just in their luminosity but also their rotation rate, their geometry, their stratification, and their microphysics. For example the core of a massive star is only weakly stratified, whereas an M dwarf (or the convective envelope of a Sun-like stars) is much more strongly stratified. The microscopic diffusivities vary in such a way that Pr M is very small in many stellar convection zones but greater than unity in some (e.g. Augustson et al, 2019;Jermyn et al, 2022). Many of these variations are intertwined. For example, the influence rotation has on the convection is typically encapsulated by some version of the Rossby number Ro ∼ P rot /τ conv ; because τ conv depends on the flow velocity, the rotational influence can vary from star to star (and with radius within a given star) even if the rotation period is constant.
Faced with the bewildering array of possible variations in all of these parameters, would-be simulators tend to try one of two different approaches. One is to focus on a particular physical effect -stratification, for example -and try to elucidate how this affects convection, differential rotation, and magnetism, typically in an idealized setting (e.g., a Cartesian layer). Another is to attempt to model a given astrophysical object in some detail, adopting (e.g.) spherical coordinate systems and stratifications (of density, temperature, or entropy) that mimic those in a 1D stellar model. In neither approach is it possible for simulations to approach the actual parameter regimes attained in real stars, although some balances can be recovered that help in understanding, e.g. the type of differential rotation that occur in real stars. Before diving into a "by object" discussion, we turn first to a high-level overview of the effects of rotation, stratification, and geometry on dynamo action in general. Then we turn to summaries of how these effects play out in specific types of stars.

Effects of rotation, stratification, and geometry in stellar models
All stars rotate, all have some level of density stratification, and all convect in a spherical geometry. Here we provide a very brief overview of how each of these effects likely influence the flows and magnetism. Perhaps the clearest message from the last few decades of research on convection and dynamo action is, "rotation matters a lot." It affects the convective flows, it affects their transport of heat and angular momentum, and it affects the magnetism these flows can build. Some of these effects (e.g., how rotation affects magnetic field morphology) are understood only qualitatively, whereas for others (e.g., how it affects heat transport) there is now a more quantitative picture.
To begin, consider the influence of rotation on the convective flows in the absence of magnetism. It is well-known that rotation tends to stabilise a system against convection, increasing the critical Rayleigh number for onset (Ra c ∝ Ek −4/3 , with Ek the Ekman number defined previously), while the most unstable wavenumber shifts to higher wavenumber (k) with more rapid rotation rate (lower Ek) (e.g. Chandrasekhar, 1961). (Less obviously, consider a numerical simulation not too far from onset -more specifically, one for which "diffusion free" scalings do not yet apply -with, for example, a fixed heat flux or temperature contrast, and also some fixed rotation rate. In this system changing the numerical diffusivities -or in an implicit LES simulation changing the resolution -will also affect the rotational influence, via changing Ek, and so also the flows.) In a global spherical geometry, whenever rotation plays a major role in the dynamics the most prominent convective modes close to onset are wave-like convective rolls, aligned with the rotation axis and arising from the conservation of potential vorticity, variously called "thermal Rossby waves," "Busse columns," or "banana cells" depending on the community (see, e.g. Busse, 1970;Gilman, 1977;Busse, 1983;Featherstone and Hindman, 2016a;Bekki et al, 2022). The systematic prograde tilt of these cells, and the associated Reynolds stress, plays a major role in redistributing angular momentum in most global-scale simulations of stellar convection; the differential rotation is then also a strong function of rotation rate (Rossby number), as summarized elsewhere (e.g. Gastine et al, 2014).
The heat transport by the convection is also strongly influenced by rotation: for a given fixed heat flux, the convection tends to become "less efficient" as the rotation rate increases -that is, it requires a larger entropy gradient to carry the same flux (see, e.g., discussions in Stevenson, 1979;Aurnou et al, 2020). Quantitatively, several theoretical approaches supported by numerical simulations -including appeals to a balance between Coriolis, inertial, and buoyancy forces (so-called "CIA balance") (e.g Vasil et al, 2021), "rotating mixing length" theory (Stevenson, 1979;Barker et al, 2014;Currie et al, 2020) asymptotic theory at low Rossby number (Julien et al, 2012) -yield the same diffusion-free dependence of key quantities, like the temperature gradient, when rotation is rapid enough. In these models the amplitude of the convective motions goes down at higher rotation rates, the temperature gradient goes up, and the typical wavenumber of the flow increases, with important consequences for the dynamo.
The dependence of dynamo action itself on rotation is less quantitatively understood, though it is still possible to make some broad statements that are supported by theory and simulation. When rotation is dynamically significant, it is widely thought to affect the strength and morphology of dynamo-generated magnetic fields as discussed in more detail in Section 5.2.2. (see also, e.g., Schrinner, 2013;Augustson et al, 2019;Orvedahl et al, 2021). Furthermore, because the envelope convection zones of low-mass stars are strongly stratified (in density and temperature), many authors have also sought to understand what role this stratification plays in determining various properties of the flows and magnetism. We mention here only a few. Broadly, the presence of density stratification breaks the up-down symmetry in Boussinesq systems, so it changes the convective dynamics -and also presumably the magnetism -in a variety of ways. Strongly stratified systems tend to have strong, narrow downflows and broader, weaker upflows (e.g. Hurlburt et al, 1984;Cattaneo et al, 1991); their energy dissipation budget is very different (e.g., Hewitt et al, 1975;Currie and Browning, 2017); they can establish different profiles of kinetic helicty (Duarte et al, 2016) and may drive different types of zonal flows (e.g., Glatzmaier et al, 2009). If diffusion-free scalings (like mixing-length theory) apply, or simply on dimensional grounds, the velocity of the convective flows is expected to vary in amplitude across a stratified convection zone, in a way not found in Boussinesq systems. This basic fact has profound consequences for the convective dynamics in a star like the Sun, since we then expect regions near the photosphere (which are very low-density) to undergo such rapid convective motions that their Rossby number is enormous (i.e., the influence of rotation is negligible there); meanwhile the deeper flows must be influenced by rotation, at least within some finite distance of the transition to the radiative interior. The presence of density stratification may make it harder to sustain a strong global-scale dipole in some regimes (e.g., , but it is also clear that highly ordered fields are still realizable even when the stratification is strong (see discussions in Raynaud et al 2015;Menu et al 2020;Zaire et al 2022).
Relatively little work has directly addressed the influence of the geometry of the convection zone, while keeping other factors constant. We briefly note only a few specific results. Goudard and Dormy (2008) showed that, in rotating Boussinesq MHD simulations with fixed temperature boundaries, changing the aspect ratio of the domain (i.e., changing the depth of the convection zone) had a strong effect on the nature of their dynamo solutions. In deep domains, they found steady "Earth-like" dipolar solutions; if the convection zone was gradually made thinner, they found a transition to "Sun-like" dynamo wave solutions. Separately, Camisassa and Featherstone (2022) have recently investigated the role of geometry in determining the Reynolds stresses -and hence the differential rotation -in anelastic simulations of rotating convective envelopes. They argue that the well-known transition from solar to anti-solar differential rotation occurred when columnar convective structures attained a diameter roughly equivalent to the shell depth. In the sections that follow, we explore how these different dynamical trends play out in models of specific stars.

Dynamo action in high-mass stars: convective cores and radiative envelopes
Massive stars on the main sequence possess convective cores, with a predominantly stable radiative envelope above this. The high luminosities established by nuclear fusion in these stars mean that we expect the convection to be vigorous; the accompanying high temperatures mean that we expect these convection motions should generally act as magnetic dynamos, since all plausible estimates of the magnetic Reynolds number Re M are very high; see Table 1. It may well be that dynamo action is occurring in the radiative layers as well, as discussed below. Both the flows and fields have lately been targets of intense scrutiny -partly because asteroseismology has begun to provide powerful new constraints on this topic, particularly for evolved stars (see, e.g., Stello et al 2016;Ji et al 2023) and also because of the implications these hold for later stages of stellar evolution (e.g., Fuller and Ma, 2019). In this section, we briefly review what has been learned by simulations focusing on these types of stars. A more thorough description can be found in Brun and Browning (2017). Early global simulations covering some aspects of the problem include Kuhlen et al (2003), Browning et al (2004), andBrun et al (2005). Taken together, these papers provided the first numerical estimates of the flows and magnetism that might be generated in 3D massive star cores. They also gave some estimates of the overshooting and penetration from the convective zone into the surrounding stable envelope, the gravity wave response there, and the differential rotation arising from the interplay of convection, magnetism, and rotation. Later work has pushed towards more realistic (turbulent) flows, has examined a variety of initial states (e.g., strong magnetic "fossil" fields) and srutinized each facet of this complicated problem more systematically. We refer the interested reader to Meakin and Arnett (2007) There has lately also been sustained interest in the topic of magnetism generated by dynamo action in the radiative envelope, typically as a result of the interaction between shear and magnetic instabilities (e.g., Spruit, 1999). Numerical work -beginning with Braithwaite (2006) and followed by many others since (e.g., Zahn et al 2007, Duez et al 2010, Jouve et al 2015, Petitdemange et al 2023, Ji et al 2023 -has examined the circumstances under which such dynamo action could occur, and the strength of the resulting fields. Taken as a whole, these simulations are unequivocal about a few points. Very strong fields can plausibly be established by dynamo action in the cores of some massive stars, whether rotation is dynamically significant or not; for example, because the convection is rapid, even the "equipartition-scale" field (equating ρu 2 conv with B 2 /(4π) and assuming MLT scalings for the convective velocity u conv ) would suggest B ≥ 10 6 G in the interior of a B-type star. Some of these stars rotate very rapidly, and the saturation strength of the field in this case is less clear (see, e.g., discussions in Augustson et al 2019), but it seems likely that strong fields are the norm rather than the exception. The differential rotation established within the core is less certain, because it is surely influenced by the strength of the magnetism -which is likewise influenced by the shear -but broadly these simulations appear to obey trends similar to those in simulations of convective envelopes. "Solar-like" differential rotation (i.e., with a prograde equator) is established when rotation is dynamically significant and the magnetism is not too strong; "anti-solar" profiles arise when the influence of rotation is weaker; magnetism reduces the shear and may yield solid-body rotation if it grows strong enough. Convective motions overshoot into the radiative envelope, though the extent of this effect is still being actively investigated (e.g., Anders et al 2022b, Baraffe et al 2023), and excite a substantial gravity-wave response that may be detectable even in main-sequence stars (e.g., Breton et al 2022).
Within the radiative zone itself, the latest simulations (Petitdemange et al 2023, Ji et al 2023 now appear to be capturing some aspects of the longenvisioned "Tayler-Spruit" dynamo. This differs in some important respects from the picture originally envisioned by Spruit and debated in Zahn et al (2007); for example, in the Petitdemange et al (2023) simulations only subcritical dynamo action is found, alongside some other dynamo instability. The saturation amplitude of the field is still very much under debate; see discussions in Spruit (1999), Fuller et al (2019, and Ji et al (2023).

Low-mass stars and the transition to full convection
Main-sequence stars less massive than the Sun have deeper convective envelopes (as a fraction of the total stellar radius). Below a mass of about 0.35 M ⊙ stars are -in standard 1D models -convective throughout their interiors. This transition occurs at a spectral type of around M3, so "M dwarfs" in general hold special interest theoretically, as probes of the various roles that rotation and stratification play in the dynamo. They are also interesting astronomically: the large majority of stars in our galaxy are M dwarfs, and they are popular targets in the quest to find and characterise exoplanets (e.g., Trifonov et al 2018).
Here, we briefly review attempts to model these stars numerically. In terms of fundamental fluid dynamics, these stars have many similarities with premain sequence stars (which are also fully convective, but can have different internal heating profiles and rotational constraints), so in places our discussion parallels that in Section 5.2.1. In some other respects the flows in these objects resemble those in giant gaseous planets, so we also draw comparisons to the extensive literature on planetary dynamos. Finally, there are also many similarities with the flow in massive-star cores, which share the same geometry (i.e., a full sphere of convection) but are much less strongly stratified than a main-sequence M dwarf; see Table 1.
The first 3D MHD simulations that aimed specifically to model low-mass fully convective stars were reported in Dobler et al (2006). They used the Pencil Code, solving the fully compressible equations to model a spherical star (established via volumetric heating and cooling terms) embedded in a Cartesian grid. These first models included only a fairly weak density stratification (with ρ at the center of the star about a factor of three greater than at its photosphere). Later, Browning (2008) conducted the first anelastic simulations (with the ASH code) that mimicked low-mass M dwarfs, including a stronger density stratification (about a factor of 100 across the deep spherical shell) and more complex flows. Subsequent work has sampled much lower diffusivities, more extreme density stratifications, and varying rotational influences. We note in particular the simulations of  and Yadav et al (2015aYadav et al ( , 2016b, modelling anelastic dynamos in a deep spherical shell with the MagIC code; Brown et al (2020), who considered a full spherical geometry (i.e., in spherical coordinates but with no singularity at r = 0) using the Dedalus framework; Käpylä (2021), who considered "star-in-a-box" models akin to those of Dobler et al (2006) but in a substantially different parameter regime; and Toomre (2020, 2022), modelling deep (anelastic) shells of convection with the Rayleigh code.
Although there are many differences between these models, some broad trends are now reasonably clear, and largely parallel those realised in other objects and geometries (as discussed elsewhere in this review). When magnetism is weak or absent, both "solar" and "anti-solar" differential rotation can be realised, depending upon the rotational influence (i.e., some version of the Rossby number). When magnetism is strong, it reduces this differential rotation and -if the field gets strong enough -can essentially eliminate it, leading to solid-body rotation. The spatial structure of the field -e.g., the fraction of the magnetism in axisymmetric components, or the strength of the dipole or quadrupole moment -is intertwined with rotation, shear, and density stratification in a complex manner.
When rotation is strong and shear is weak, the field tends to develop a large-scale dipolar component; see discussions in, e.g., Schrinner et al (2012);Yadav et al (2015a), and an array of related works modeling planetary dynamos with weak stratifications (e.g., Aubert 2006, Schwaiger et al 2021). In real stars, presumably any large-scale field generation is accompanied by vigorous SSD, so the overall field likely consists of a very wide range of scales. The dipolar solutions are, at least in some parameter regimes, more difficult to realise when the density stratification is strong and when the convective supercriticality is high (e.g., ; but there are now multiple examples of highly-stratified, vigorous convection that exhibit strong dipoles (e.g., Yadav et al 2015a), including some at surprisingly modest rotational constraints (e.g., up to Ro ∼ 0.4 in Zaire et al 2022). The question of what exactly delineates these states from one another is a topic of very active investigation (see, e.g., discussions in Menu et al 2020, Tassin et al 2021, Zaire et al 2022. When shear is also present, a variety of solutions are possible, including propagating dynamo waves. Examples abound; see, for example, Yadav et al (2016b), Käpylä (2021), and Bice and Toomre (2022). Again, it seems reasonably clear that the rotational influence is the most crucial control parameter, but many details remain unclear. Other topics of active interest include the prevalence of non-axisymmetric features in the field (e.g., Bice and Toomre 2022;Käpylä 2021), or modes in which the bulk of the magnetism is confined to one hemisphere (e.g., Gallet and Pétrélis 2009;Brown et al 2020). Furthermore, Käpylä (2021) reported that the qualitative succession of dynamo modes as a function of rotation appears to be the same in simulations of fully and partially convective stars: when rotation increases, the predominantly axisymmetric steady and cyclic solutions at slow rotation give way to non-axisymmetric dynamos at rapid rotation. In these models a similar succession happens with the cycles, so that for moderate rotation the dynamo waves typically propagate in latitude; when rotation is more rapid, the large-scale magnetic structure drifts in longitude.

Connections to mean-field dynamo theory
Finding out which physical processes lead to the observed magnetic field evolution in 3D convective dynamo simulations is very challenging. An often-used approach is to interpret the outcome of the simulations in terms of meanfield dynamo theory. Mean-field theory provides a well-established theoretical foundation, which can be used to analyses the complex 3D simulation in a simplified way (e.g. Krause and Rädler, 1980;Brandenburg and Subramanian, 2005); see also Brandenburg et al (2023). Technically this is done by computing mean-field transport coefficient from 3D simulations and using them in a corresponding mean-field model. This approach has been successfully used to pinpoint the cause of magnetic field evolution in many simulations. In meanfield theory the magnetic and velocity fields are divided into a mean or averaged part and a fluctuation, e.g. B = B + B ′ . Only the mean fields are explicitly solved for, whereas the (correlations of) fluctuations are parameterized in terms of the mean. Azimuthal averages are often used for solar and stellar dynamos such that the resulting mean field is axissymmetric. However, such an average is not well suited for rapidly rotating stars, where non-axisymmetric m = 1, 2 modes often dominate (Viviani et al, 2018). Applying the mean-field approach to the induction equation leads to the emergence of an additional term, the electromotive force E = u ′ × B ′ . In mean-field dynamo theory this term is parameterized in terms of the B and its gradients, assuming that the mean fields vary slowly in space and time (Krause and Rädler, 1980), where the dots represent higher order derivatives that are most often neglected.
The tensors a and b can then be further divided into symmetric and antisymmetric parts (e.g. Rädler, 1980), yielding an equivalent representation where (∇B) (s) is the symmetric part of the magnetic field gradient tensor. The coefficients α and β are rank two tensors, γ and δ are vectors, and κ is a rank three tensor. These coefficients can be associated with different turbulent effects important for the magnetic field evolution: the α effect (Steenbeck et al, 1966) leads to field amplification via helical flows; γ describes the turbulent pumping, which acts like mean flow (e.g. Rädler, 1968;Roberts and Soward, 1975); β describes turbulent diffusion; and the δ effect, also known as the Rädler effect (Rädler, 1969) or the shear-current effect (e.g. Rogachevskii and Kleeorin, 2003), can lead to dynamo action in non-helical turbulence in the presence of shear; and finally, the κ effect, whose physical interpretation is currently unclear. The main challenge is to determine these coefficients from a 3D global convective dynamo simulation. The ultimate goal is to be able to reproduce the magnetic field solution with a mean-field model using the obtained coefficients.

Using proxies based on flow and magnetic field properties
The simplest approach to compare 3D convection simulations with mean-field theory is to use approximate proxies of turbulent transport coefficients based on the flow and magnetic field properties. Assuming isotropy and homogeneity and applying the second order correlation approximation (SOCA), the turbulent transport tensors reduce to scalars α K and β, (e.g. Krause and Rädler, 1980;Brandenburg et al, 2023) where τ is the correlation time of the flow, ω ′ = ∇ × u ′ . The expressions of α K and β are valid in the kinematic regime where the back-reaction of the magnetic field on the flow is neglected. In a more general approach, the minimal tauapproximation, this backreaction is retained and this leads to an additional magnetic contribution to the α effect (Pouquet et al, 1976;Blackman and Field, 2002) where J ′ = µ −1 0 ∇ × B ′ . α M can be interpreted as a consequence of magnetic helicity conservation (see, e.g. Brandenburg et al, 2023). This approach has been used in many simulation studies to interpret the magnetic field evolution (Charbonneau, 2020). For example, Warnecke et al (2014) used the α proxy to conclude that the equatorward migration found in their, and in previous work, is due to an αΩ Parker dynamo wave driven by a region of negative radial shear. Similarly, Duarte et al (2016), explained the equatorward migration in their simulations by the inversion of α and positive radial shear. Guerrero et al (2016Guerrero et al ( , 2019 concluded that the dynamos in their simulations with tachoclines were driven by α M below the convection zone. However, it is necessary to bear in mind the approximate nature of analyses based on proxies: often the agreement between the simulation and the behavior suggested by the proxy is qualitative at best and the 3D simulations contain a rich variety of non-linear interactions that are omitted in such analyses.

Direct measurements of coefficients
The alternative is to measure the coefficients in Eq. (29) directly from simulations. There are currently two commonly used methods for this. First, B and E from the 3D dynamo simulation can be used to fit for the turbulent transport coefficients in Eq. (29) using, e.g., multidimensional regression method or singular value decomposition (SVD) (Brandenburg and Sokoloff, 2002;Racine et al, 2011). On the other hand, the test field (TF) method uses a sufficiently large number of linearly independent test fields, that do not back-react on the solution, and evolves the corresponding B ′ and E for each. Then it is possible to unambiguously invert for the coefficients in Eq. (29) (Schrinner et al, 2005(Schrinner et al, , 2007. Both of these methods are, at best, only as good as the approximate equation Eq. (29). The validity of the results needs to be tested be inserting the derived coefficients back into Eq. (29) and to mean-field models to determine how faithfully they capture the E and time evolution of the mean field in the 3D simulation.
The SVD method has the issue that Eq. (29) is underdetermined: there are 27 unknown parameters and only three components of B and E. This is typically overcome by considering the time dependence of B and E leading to an overdetermined system. Furthermore, if B does not vary in time the SVD method has problems to converge. Despite these difficulties this method has been used to explain the dynamos in several simulations (e.g. Racine et al, 2011;Augustson et al, 2013Augustson et al, , 2015. Simard et al (2016) found that the coefficients related the gradients of B (β, δ, κ) are much less important than α and γ. Furthermore, Simard et al (2013) could reproduce the mean-field evolution of 3D global simulation using α and γ determined with the SVD method, basically assuming it is an α 2 Ω dynamo. However they had to assume a higher turbulent diffusivity than what was measured. In follow-up studies the authors could explain and reproduce a dual dynamo action  and generate Grand Minima-like events by including α quenching (Simard and Charbonneau, 2020). Recently, Shimada et al (2022) analysed the simulations of Hotta et al (2016) with the SVD method and found that the turbulent diffusion decreases with increasing Re M . However, it is unlikely that Eq. (29), and hence the SVD method, is valid at high Re M where a SSD is excited.
In the TF method, a set of 9 linearly independent test fields are used to uniquely determine the 27 unknowns. First developed for the geodynamo (Schrinner et al, 2005(Schrinner et al, , 2007(Schrinner et al, , 2012Schrinner, 2011), it has subsequently been used for many solar and stellar dynamo simulations (Gent et al, 2017;Warnecke et al, 2018;Warnecke, 2018;Viviani et al, 2019;Warnecke and Käpylä, 2020). An important result is that the turbulent pumping is typically larger than the meridional circulation in global convective dynamo simulations, rendering the flux-transport dynamo scenario unlikely in those cases . The conclusion of Warnecke et al (2014) that the equatorward migration in these kind of simulation is explained by a Parker dynamo wave was confirmed with the α effect from the TF method (Warnecke et al, , 2021. This was later used to explain the cycle period dependence on rotation in 3D dynamo simulations (Warnecke, 2018). Gent et al (2017) analyzed the simulations of Käpylä et al (2016) and found that the turbulent transport coefficients -particularly γ -vary significantly during long-term modulation of the cyclic mean magnetic field. In the work of Viviani et al (2019), the first cyclic dynamo in the anti-solar differential rotation regime was explained to be of α 2 Ω type using test-field coefficients. Furthermore, Warnecke and Käpylä (2020) studied the transport coefficients as functions of rotation rate and found that αΩ dynamos, appear to be possible in a relative narrow range in Ro. The trace of α with α K agree in pattern and amplitude in a Rossby number range spanning three orders of magnitude (Warnecke and Käpylä, 2020). As a result of the test-field analysis (Warnecke and Käpylä, 2020) a magnetic influence on α as described in Eq. (31) could be ruled out in their simulations. Putting all the turbulent transport coefficients into a mean-field model, the evolution of the mean magnetic field of the 3D simulation was reproduced in terms of period and pattern (Warnecke et al, 2021); see Figure 9. Notably the full spectrum of coefficients was needed to fully reproduce the field evolution. This suggests that all of the turbulent mean-field effects play important roles in this simulation which is a good representation of current global dynamo simulations. Furthermore, the authors concluded that the assumptions of Eq. (29) are reasonably well justified in the simulations (Warnecke et al, 2021) given that the E is also reproduced reasonably satisfactorily Viviani et al, 2019).

Remaining issues
One of the important issues is that the results of the two methods, SVD and TF, do not fully agree with each other. The SVD method seems to produce satisfactory results for EULAG-MHD simulation (Simard et al, 2013;Beaudoin et al, 2016;Simard and Charbonneau, 2020). However, Warnecke et al (2018) showed that the coefficients determined with the TF and SVD methods give quite different results and that the SVD coefficients related to the derivative of B are indeed less important. This discrepancy raises questions regarding the overlap of the validity ranges and the underlying assumptions of both methods. A possible reason for the discrepancy is that non-locality (in space and/or time), which is neglected in Eq. (29), plays a role: the SVD uses the actual field whereas in TF only very large-scale gradients of test fields are retained. On the other hand, the actual magnetic fields the SVD uses are not necessarily linearly independent, leading to errors in the inversion.
SVD and TF methods reveal that turbulent transport effects play an important role in the dynamic and evolution of the large-scale magnetic field. Warnecke et al (2021) showed that it is necessary to include practically all of the possible turbulent effects to reproduce the 3D simulation results in detail. This makes the corresponding mean-field models quite complex which to a certain extent defeats the purpose of mean-field modelling where the hope has been to capture the large-scale behavior of complicated 3D systems by a much simpler lower-dimensional model. However, the complexity of dynamos operating in these simulation also hints in the direction that the Sun and other stars are more complex than simple mean-field models including the Babcock-Leighton model can describe.
Another issue is related to the appearance of the SSD instability when global simulations reach more realistic high-Re M regimes. In this case Eq. (29) is no longer valid, because a contribution to E that is independent of B is possible, and non-linearity due to B ′ becomes important. If small-scale magnetic fields due to the SSD are dynamically important, neither the SVD nor TF method will work in their current form. Efforts to generalize the TF method to incorporate the effect of the SSD have been taken by Käpylä et al (2022), leading to four flavours of the method in that regime. Although these flavours should in principle agree, this is not always the case, especially for high Re M . Hence, it is of great importance to extend the SVD and TF methods to more realistic parameter regimes to incorporate effects such as the SSD.

Conclusions and future prospects
A central challenge in simulating Solar or stellar dynamos is that, as discussed above, the interiors of real stars are characterised by extremely low diffusivities (of momentum, heat, and magnetism), and possess motion and magnetism over an extraordinarily broad range of spatial and temporal scales. No simulation, now or in the near future, can capture all these scales simultaneously. The hope of many modelers, though, is that at least some aspects of the dynamics, particularly on the largest scales, may become independent of the small-scale details at high enough resolution (low enough diffusivity). There is considerable debate -even amongst the authors of this review! -about the extent to which present-day simulations are nearing this diffusion-free, resolutionindependent regime, and reasons for both optimism and pessimism. Here, we briefly highlight a few of these.
Current global dynamo simulations of stars routinely capture solar-like differential rotation and cyclic magnetism. Sometimes these models also reproduce equatorward migrating activity akin to the Sun. This occurs at a Rossby number regime where differential rotation is relatively strong. These results seem to be fairly robust irrespective of the numerical method or other details of the simulations. Also the theoretical understanding of the physical mechanisms driving the magnetism has developed significantly in the recent years with more advanced analysis tools such as the test field method, full energy transfer and field production (emf) analysis, and with direct comparisons to mean-field models.
Although our understanding of the physics of convection and resulting dynamo action has increased, new challenges have also been encountered. The most intriguing of these is the fact that current simulations struggle to reproduce solar convection and the resulting differential rotation at the solar luminosity and rotation rate. Given that this is a necessary requirement to get the dynamo right it is not a huge surprise that reproducing the solar dynamo remains challenging. This "convective conundrum" is the modern equivalent to the "dynamo dilemma" of the 1980s. The latter lead to a revival of old, and the conception of new, ideas about solar and stellar dynamos and a similar process is at work with respect to solar and stellar convection at the moment. The various ideas related to solving the conundrum include entropy rain and deep weakly subadiabatic convection, the influence of strong small-scale magnetism, and rotationally constrained deep convection. Research on this topic is very active and evolving rapidly, and, far from being stumped by the challenge posed by the convective conundrum, activity in the modelling of stellar convection and dynamos has instead been invigorated.
A key issue with the Sun is that even though the deep convection zone is highly likely rotationally dominated with Ro ≪ 1, there are many scales in the upper convection zone and near the surface where the rotational influence on the flow is weak. The Sun is also perhaps close to the transition to anti-solar differential rotation, which has some observational support, making it difficult to maintain a solar-like differential rotation profile if the simulations are not sufficiently near the correct parameter regime. Identifying the correct force balance prevailing in the solar convection zone is therefore key to this problem. With this information, simulations can be designed such that they follow a path leading to the correct balances and hopefully to solar-like results. This is a practice adopted in simulations of the geodynamo and perhaps a similar approach can be adopted for the Sun.
On the other hand, the issue regarding rotational influence is not as severe in stars that rotate more rapidly than the Sun and which are further away from the solar-like to anti-solar differential rotation transition. There are indications that simulations capture the characteristics of dynamos, such as non-axisymmetric large-scale fields, and dipole dominated dynamos in M dwarfs, in such stars more accurately. Although this is encouraging, we should also bear in mind that the observational data from other stars is not as accurate and detailed as the data we have from the Sun.
A common characteristic of all of the current simulations is the fact that it is not possible to model the surface layers, where the density drops vertiginously, accurately enough. This could be one of the reasons why none of the current simulations form spots that could play a role in the dynamo process via a Babcock-Leighton type effect, and their magnetic activity does not become independent of rotation at sufficiently low Ro. Self-consistent spot formation has not been reported even in local simulations to say nothing about global simulations. Therefore capturing spot formation in global simulations is perhaps as challenging, or even more challenging, than cracking the convective conundrum. Nevertheless, recent spot formation studies in more idealised simulation setups serve as a guide for the design of future global simulations that aim at achieving this.
All of these developments happen on a background where modelers have started to realize that the holy grail of stellar dynamo simulations -an asymptotic regime where results are independent of resolution or diffusivity -remains elusive, and that the computational cost of adding another data point at a higher resolution is already prohibitive. This begs the question whether it is feasible for everyone to try to beat everyone else in this very difficult task or whether it is better to combine resources for a collaborative effort where the resources of at least a large part of the field are directed in producing the "next generation" transformative simulations.