Magnetic field production at a first-order electroweak phase transition

We study the generation of magnetic field seeds during a first-order electroweak phase transition, by numerically evolving the classical equations of motion of the bosonic electroweak theory on the lattice. The onset of the transition is implemented by the random nucleation of bubbles with an arbitrarily oriented Higgs field in the broken phase. We find that about 10% of the latent heat is converted into magnetic energy, with most of the magnetic fields being generated in the last stage of the phase transition when the Higgs oscillates around the true vacuum. The energy spectrum of the magnetic field has a peak that shifts towards larger length scales as the phase transition unfolds. By the end of our runs the peak wavelength is of the order of the bubble percolation scale, or about a third of our lattice size.


I. INTRODUCTION
Magnetic fields are pervasive in the Universe. Micro Gauss fields coherent on scales up to ten kpc have been detected in nearby spiral galaxies, such as the Milky Way and in higher redshift galaxies (e.g. [1]). Similar stochastic magnetic fields are found in clusters of galaxies. Such fields are believed to result from the dynamo amplification of weak magnetic field seeds, whose origin remains a mystery (see e.g. [2][3][4]). Recent observational evidence that even the intergalactic medium (IGM) in voids is pervaded by a weak (below femto Gauss strength) magnetic field [5][6][7][8][9][10], points to a primordial origin of the field seed, since it is difficult to account for a field that fills the volume in the void regions by astrophysical processes in the late universe [11,12] (but see [13,14]). Furthermore, the study of the diffuse gamma-ray background provides clues for the existence of a non-zero helical component in the IGMF [7,8,15]. Interestingly, while most magnetic field generation mechanisms discussed so far produce non-helical fields, physical processes associated with electroweak baryogenesis imply fields that are helical [16,17].
The production of helical fields is related to the violation of baryon plus lepton (B+L) number during the electroweak phase transition (EWPT). To change B+L, requires a change in the Chern-Simons number of the electroweak gauge fields, which proceeds through "sphaleron" configurations. The decay of the sphaleron releases helical magnetic fields, and this is borne out by both numerical simulations [18] and analytical arguments [19]. Generically, helical magnetic fields are produced at the electroweak phase transition if the Chern-Simons number changes during the phase transition [20]. Inhomogeneities in the Higgs field can also give rise to the generation of helical magnetic fields as shown in [21,22] in the context of low-scale electroweak hybrid inflation [23].
The study of the properties of cosmological magnetic fields can, thus, open a window to the early universe and very high energy particle interactions. To investigate the epoch of magnetogenesis and identify the mechanism at the origin of the primordial seeds we need to make full use of the statistical properties of the magnetic fields matching theoretical predictions with observations [24]. These are encoded in the power spectrum which, for Gaussian random fields, entirely describes the statistical properties of the fields. In this respect, the helicity spectrum can be recovered from observations of the diffuse gamma-ray background [8].
On the theoretical front, it has been shown that a measurement of the sign of the helicity can distinguish fields produced during electroweak baryogenesis from those generated at an earlier epoch associated with leptogenesis [25]. However, a detailed study of the statistical properties of the magnetic fields is required to narrow the gap between theoretical studies of the microscopic properties and the macroscopic properties that can be experimentally observed (field strength and coherence scale), as was done for the case of low-scale hybrid inflation in [21,22].
In this paper, we study the dynamics of a first-order EWPT by numerically evolving the classical bosonic electroweak theory, and we examine the properties of the generated magnetic field. In the Standard Model (SM), the EWPT is first order only if the mass of the Higgs boson lies below m h < ∼ 70 GeV [26,27]. Since the experimentally observed mass violates this bound [28,29], we work under the assumption that there is physics beyond the SM that influences the character of the phase transition. Although the details of the particular SM extension are not important for our purpose, we have in mind models that make electroweak baryogenesis viable (see e.g. [30][31][32][33] for reviews). In that case, the properties of the cosmological magnetic fields can be related to the observed baryon asymmetry of the universe [17]. Furthermore, a cosmological first-order phase transition can also be a source of gravitational waves (GW) [34,35]. In this respect, large-scale numerical simulations of a scalar field theory on the lattice have recently become available to verify the production of GW radiation during a firstorder phase transition [36]. Our results bring another handle to probe the universe at the time of the EWPT: the observation of cosmological magnetic fields.
When the phase transition occurs, the Higgs field will leave the symmetric phase and gradually settle down around the true vacuum, |Φ| = η. In order to mimic this behavior on the lattice, we introduce a phenomenological damping term for the Higgs boson. The modified electroweak evolution equations preserve gauge invariance and satisfy the Gauss constraints. They are reviewed in Sec. II, where we also outline the calculation of the magnetic field spectrum from our lattice simulations. Magnetic fields are produced as a result of nonvanishing gradients of the Higgs field [17]. In a first-order phase transition, bubbles are randomly nucleated as a result of quantum tunneling, and subsequently expand and collide with each other, producing an out-of-equilibrium environment. Magnetic fields, will be produced when bubbles collide. We argue that the details of the short period of bubble nucleation are not of major concern, and we can safely mimic the quantum tunneling by a simple random procedure, controlled by a parameter p B , the nucleation probability. The specifics of our numerical implementation are presented in Sec. III.
To gain intuition about the general features of the magnetic fields generated from bubble collisions, we first consider in Sec. IV a set of constrained simulations with a regular array of bubbles so that we can control the size of the colliding bubbles. In Sec. V we allow for bubbles to nucleate at random locations in the unbroken phase and we present the spectrum of the magnetic field induced during a first-order EWPT. Finally, we discuss and summarize our results in Sec. VI.

A. Classical equations and Higgs damping
We consider the classical bosonic electroweak theory, which includes the Higgs doublet Φ, the SU(2)-valued gauge fields W a µ and the U(1) hypercharge field B µ . The Lagrangian is given by Since we will evolve the field equations using the standard Wilsonian approach for lattice gauge fields [37][38][39][40], it is advantageous to use the temporal gauge, W a 0 = B 0 = 0, which allows a simple identification of the canonical momentum. Our implementation of the lattice equations can be found in [20,41], with the addition of a Higgs damping term that we now discuss. The classical equations of motion (EOMs) in the continuum are given by: The solutions are subject to the Gauss constraints: The term proportional to γ in Eq. (3) gives rise to a linear damping of the magnitude of the Higgs field. Its purpose is to attenuate the radial oscillations of the Higgs field within a reasonable simulation time. The term also simulates the effects of energy losses due to Higgs decays into fermion-antifermion pairs. In principle, one could include separate damping terms for each component of the Higgs field. However, this is harder to implement since we want to respect gauge invariance and the conservation of electric charge.
The form of the damping term in Eq. (3) is motivated by considering the analogy of a 2D simple harmonic oscillator with linear damping in the radial direction. In polar coordinates, the EOMs arë where, r = |r|, r = (x, y). The second equation is the conservation of angular momentum and corresponds to the conservation of charge in the field theory. If the two equations are transformed into Cartesian coordinates, we findr which suggests the modification of Eq. (3).
To check that the damping term is not in conflict with the Gauss constraints, let us write a general additional term for the Higgs EOM, where Ξ = (Ξ 1 + iΞ 2 , Ξ 3 + iΞ4) T is a doublet that causes damping. The Gauss constraints should be satisfied throughout the evolution assuming that they are initially satisfied, which requires that the time derivatives of Eqs. (6) and (7) should vanish. Differentiating the two equations, and using the modified EOM Eq. (11) for the Higgs field, together with Eqs. (4) and (5), to replace the second-order time derivatives, we obtain The solution to these equations, that ensures the Gauss constraints, is and this gives the damping term in Eq. (3).
To simulate a first-order electroweak phase transition we also need to include the quantum nucleation of broken phase bubbles, which we now discuss.

B. Bubble profile
As mentioned above, the SM does not admit a firstorder electroweak phase transition. However, we expect that for our purposes the Higgs potential as given in Eq. (1) captures the dynamics of the phase transition in an extension of the SM that allows for a viable electroweak baryogenesis. The equations of motion, with the initial condition Φ =Φ = 0, are then supplemented by bubble nucleation events that occur randomly in regions where the symmetry is unbroken.
In numerical simulations, we use a simple method for randomly nucleating bubbles of the broken phase to mimic the tunneling effect. The sites of the lattice can be numbered as a sequence S from 1 to N 3 . At each time step of the simulation, we first randomly shuffle this sequence, and then we select sites from this shuffled sequence S rand , with probability p B that controls the rate of nucleation on the lattice. The selected sites are stored S select , which contains ∼ p B N 3 elements. We scan each site s i in S select and if the Higgs field in all lattice sites within a radius r 0 from s i is still in the symmetric phase, then a new bubble centered at s i is nucleated at this time step, otherwise, the site s i is skipped. The random shuffle procedure of all sites guarantees that the nucleation procedure is unbiased in any direction.
At every nucleation event we set up a bubble with a spherically symmetric profile |Φ| = f (r), determined by demanding that the nucleation process conserves energy. This requires that the energy change due to bubble nucleation should vanish. Therefore, This equation can be satisfied by choosing and the solution is The integration constant, C, is fixed by requiring that the center of the bubble be in the true vacuum, so . This leads to C = √ 2±1, and we choose the smaller value so as to have a gentler bubble profile. The final solution for the bubble profile is where m H = 2 √ λ η is the Higgs mass. 1 1 One issue with this bubble profile function is that it has a kink In this way we have fixed the bubble profile using the (stronger) requirement that bubble nucleation conserve energy locally. The direction of the Higgs within the bubble is assumed to be uniform. Since the vacuum manifold -zeros of the Higgs potential -defines a three sphere, the direction of the Higgs is chosen by randomly selecting a point with a uniform distribution on the three sphere. Different bubbles will have different Higgs field orientations.

C. Definition of electromagnetic field
Once the Higgs field leaves the symmetric phase (Φ = 0), we can define the electromagnetic field (EM) as follows: where, indicates the direction of the Higgs field, and θ w is the weak mixing angle. The corresponding field strength is constructed as [42,43]:

D. Magnetic energy spectrum
We assume that the magnetic field after production is a statistically homogeneous and isotropic, Gaussiandistributed vector field. The field can then be described in terms of the equal time correlation function, which we write, following the conventions in [44,45], as: at r = 0. For example, along the x−axis and close to the origin it behaves as exp(−|x|). This is not a problem numerically as finite differences will not resolve the kink.
The spectrum, F ij (k, t), can be divided into a symmetric (non-helical) part and an antisymmetric (helical) part, The mean magnetic energy density can be written as: The average wave number provides a characteristic of the energy distribution in a given field configuration.
We implement discretized versions of the expressions above on a three-dimensional lattice containing N nodes separated a distance ∆x along each spatial dimension of length L = N ∆x. Every lattice points is labeled by a triplet of integers, X, each ranging from 0 to N − 1: The corresponding Fourier space is also described by triplets of integers, K i , of the same form. The largest wavelength along a particular direction, corresponding to the smallest momentum, is of order L, while the smallest wavelength that can be effectively described is determined by the spacing ∆x. Allowing for modes traveling in the positive and negative directions, a given physical wave number corresponds to a triplet K i : where, For the physical wavelength associated to a momentum with magnitude k we have: where the magnitude, K = |K |, ranges from 0 to √ 3N/2 on a cubic lattice. We divide this range into bins of size ∆K , each with center value K c .

III. NUMERICAL SIMULATION
As mentioned above, we follow the strategy in [20,41] to evolve the electroweak EOMs on the lattice. Our code is based on the LATfield2 2 library [46], and the linear algebra operations are performed with the help of the Eigen 3 library [47]. Our simulations use periodic boundary conditions and the dimensionless constants entering the EOMs are fixed to their physical values: g = 0.65, sin 2 θ w = 0.22, g = g tan θ w and λ = 0.129. The spatial and time spacing are chosen to be ∆x = 0.25, ∆t = ∆x/4 = 0.0625, respectively. The dimensionful vacuum expectation value of the Higgs, denoted by η, is 174.13 GeV. In our numerical code we set η = 1, so that η∆x = 0.25, and then m H ∆x = 2 √ λη∆x = 0.18 where m H is the mass of the Higgs. This choice of lattice spacing gives us enough resolution to ensure that we capture all the dynamics. For instance, since m H ∆x = 0.18, momenta of order m H are well resolved. The bulk of our simulations are performed on a lattice with size N = 256, although we use a larger lattice for several runs in Sec. IV. We denote by T the (integer) time step number, and the physical time t is t = T ∆t.
The bubble profile function, Eq. (19), does not have any free parameters and its tail has infinite extent, which we truncate on the lattice as follows. We define the symmetric phase to correspond to locations where |Φ| ≤ 0.01η. With this prescription, the "size", r 0 , of the bubble turns out to be ηr 0 = 9.0 (m H r 0 ≈ 6.5), since the profile in Eq. (19) falls below 0.01η for r > r 0 . With our lattice parameters, this gives r 0 to be 36∆x. We use this value to prevent the nucleation of new bubbles within existing ones: a bubble can only be nucleated at a particular site if all lattice points within a distance r 0 are still in the symmetric phase (|Φ| ≤ 0.01η). Once a bubble is nucleated, it will expand and collide with other bubbles if there are any in the vicinity. The expansion of a single bubble is shown in Fig. 1, while Fig. 2 shows the evolution and collision of several randomly generated bubbles. Two additional inputs required for our runs are the Higgs damping γ, defined in Eq. (3), and the nucleation probability p B , which determines the probability of bubble nucleation per lattice site per time step. These two parameters cannot be determined within the model we are considering, and thus we will compare the results by varying the two parameters. We consider several values in the range 0 ≤ γ ≤ 0.01, including the experimentally measured decay width of Higgs boson, γ ∼ Γ Higgs ∼ 4.07 × 10 −3 GeV [48], which corresponds to γ ∼ 2.34 × 10 −5 in our lattice units. p B is chosen to be in the range 10 −8 ≤ p B ≤ 10 −3 in our simulations.
Since we are concerned with the generation of magnetic fields during the electroweak phase transition, we need a criterion to determine when the phase transition is completed. Our strategy is to compute the minimum |Φ| 2 among all the lattice sites at each time step. To avoid spurious fluctuations, we work with the 10-step moving average of |Φ| 2 min , denoted as |Φ| 2 MA10 , and we stop the simulation at the first time step T stop when |Φ| 2 MA10 > 0.25η 2 . In this manner, we ensure that the Higgs field is away from the symmetric phase.
One caveat of our formalism is that our field equations do not include the effects of other charged particles that might be present or generated at the time of the phase transition.

IV. TEST RUNS WITH NON-RANDOM BUBBLE DISTRIBUTIONS
A single expanding bubble in our analysis does not generate magnetic fields. This can be verified from the field equations since the gauge field currents (right-hand sides of Eqs. (4) and (5)) vanish for a spherically symmetric expanding bubble. Hence, the simplest setup where we can observe the generation of electromagnetic fields involves the collision of two bubbles.
Accordingly, we nucleate two bubbles along the z-axis at T = 0 and let them expand and collide. The initial radius r 0 of each bubble is fixed, r 0 = 36∆x, but the initial orientations of the Higgs field inside the bubbles are random. As shown in Fig. 3, the two bubbles initially expand freely before they collide. Once the collision occurs, the process of magnetic field generation can start. Specifically, as we can see from the bottom panel in Fig. 3, the magnetic field is generated at the intersection of the two bubbles. For this two-bubble configuration, a ring-shaped magnetic field will be produced, at least initially. Let us also emphasize that, since we are using periodic boundary conditions, the two bubbles actually collide twice along the z-axis during the expansion as can be seen in Fig. 3.
To better understand the general features of the magnetic field resulting from multiple bubble collisions, we start with a constrained simulation in which we control the initial separation of the colliding bubbles. To this effect, we consider a regular array of bubbles with centers separated by a fixed distance r s , which are all simultaneously nucleated at T = 0. No additional bubbles are nucleated at T > 0. In this case, the percolation size r p of the bubbles can be estimated by r p ≈ r s . We consider different values for the initial separation, r s /∆x = 80, 96, 112, 128, and two lattice sizes, N = 256, 400. The magnetic field is calculated using Eq. (22), and then Fourier transformed to obtain the power spectrum. We show the time evolution, in units of m H t, of the mean wave number, k mean ∆x/2π, in Fig. 4, and the peak of the spectrum, k peak ∆x/2π, is displayed in Fig. 5. To smooth out abrupt jumps of the peak location, a 10-step moving average is taken for the latter. In both cases, we adjust the starting time in the plot to coincide with the instant when the bubbles first collide, allowing for a meaningful comparison between runs with different parameters. Assuming that the bubble is expanding at roughly the speed of light, the starting time of bubble collision can be estimated as t = (r s − 2r 0 ) /2.
From Fig. 5, we observe that the peak of the spectrum is located around k∆x/2π ≈ 0.02 independently of the initial bubble separation r s and of the lattice size N . This value corresponds to a wavelength of λ k ≈ 50∆x, or m H λ k ≈ 9. On the other hand, the mean wave number of the spectrum does not show a clear dependence on either the initial bubble separation r s or the lattice size N . Nevertheless, curves with larger r s in Fig. 4 show relatively larger fluctuations. This is because for a given lattice size, larger values of r s lead to fewer number of bubbles. For instance, for N = 256 and r s = 128 there are only 4 bubbles in the lattice, which might result in significant statistical fluctuations.

V. RANDOM BUBBLE NUCLEATION
Having gained an intuition for the magnetic field resulting from multiple bubble collisions, we are now in a position to model accurately a first-order EWPT by allowing for bubbles to nucleate at random locations in the unbroken phase. We perform 30 simulations on a lattice of size N = 256, varying the nucleation probability over 6 different values, p B = 10 −3 , 10 −4 , 10 −5 , 10 −6 , 10 −7 , 10 −8 , and considering also 5 different values for the Higgs damping, γ = 0, 2.34 × 10 −5 , 10 −4 , 10 −3 , 10 −2 , where the second one is equal to the experimentally measured de- cay width. As can be seen from our results (Fig. 6), for p B > ∼ 10 −4 the total number of bubbles reaches the maximum number of bubbles that the lattice can accommodate almost instantaneously and the percolation size does not depend on p B . Conversely, for p B < ∼ 1/2N 4 ≈ 10 −10 , the nucleation probability is so small that only one bubble may be generated before the phase transition is completed in our lattice. In practice, already for p B = 10 −8 the results show a large variance because our lattice contains too few bubbles. To explore configurations with smaller p B would require a larger lattice. In the rest of the paper, we shall focus on configurations with 10 −7 ≤ p B ≤ 10 −4 .
To better understand the results of the simulations, we divide the evolution into three stages: 1. Free expansion (FE stage): the time before the nucleated bubbles collide with each other. During this stage no magnetic field is generated.
2. Bubble collision (BC stage): this stage starts when the bubbles collide with each other, and the generation of magnetic field starts. At this point, the broken phase does not yet extend to the whole lattice.
3. Higgs oscillation (HO stage): the Higgs field has completely left the symmetric phase but is still oscillating, and the generation of magnetic fields continues.
Although we cannot draw clear lines between the three stages, the shift from Stage 1 (FE stage) to Stage 2 (BC stage) is signaled by the onset of magnetic field generation. This typically occurs when m H t 20 in the simulations considered here, although, it can generically depend on the value of p B . The boundary between Stage 2 (BC stage) and Stage 3 (HO stage) is roughly given by T stop , which determines when the Higgs field at each lattice site has left the symmetric phase. This transition occurs when m H t ∼ 200 with some slight dependence on p B for the range of values that we consider.
We have carried out a set of "bubble-collision stage" simulations that focus on the magnetic field generation during the phase transition. These simulations cover the first two stages, and the magnetic fields generated up to T stop are analyzed. In addition, we have also performed "Higgs-oscillation stage" simulations that are run until well into Stage 3, when the Higgs has completely left the symmetric-phase but is still oscillating and producing magnetic fields. We discuss them in turn.

A. Bubble-collision stage simulation
In this section the results of the 30 parameter combinations defined at the beginning of Sec.V will be compared during Stages 1 and 2 of the phase transition, i.e. for T ≤ T stop . As mentioned above, the stopping point T stop of the simulations is chosen to be when |Φ| 2 MA10 = 0.25η 2 . In Fig. 7, various contributions to the energy density, as well as the energy density of the generated magnetic field, are shown as a function of time. Two different parameter combinations, γ = 2.34 × 10 −5 & p B = 10 −4 and γ = 0.01 & p B = 10 −6 , are displayed. The total energy is not conserved due to the presence of the Higgs damping term. Among the different contributions to the energy density, it is the Higgs potential energy the one that shows a significant and sustained decrease. This is in agreement with the expectation that the Higgs damping term is working properly only on the Higgs radial degree of freedom. The simulations start with vanishing gauge fields. However, once bubbles are nucleated and start to collide with each other, energy is transferred to the gauge fields, and magnetic fields are generated as well. Although, in the period considered here, the energy in the magnetic field is only a few percent of the total energy, it does not stop increasing by the end of these runs as can be observed in Fig. 8, where we plot the magnetic energy versus time for a selection of p B and γ values. Fig. 8a shows that increasing the damping reduces the magnetic field. This is so because the condition |Φ| 2 MA10 ≥ 0.25η 2 is met earlier due to the faster attenuation of the Higgs field, and the duration of stages 1&2 is decreased. Also, for larger damping, a larger proportion of the total energy gets dissipated, thus reducing the energy available for magnetic field generation. This is clearly seen for γ 10 −4 ; while for γ 10 −4 , we found the effects of Higgs damping become negligible. Fig. 8b shows that increasing p B increases both the magnitude and the rate dρ B (t)/dt of magnetic energy density generated. Furthermore, we notice that for smaller p B , the onset of magnetic field generation (i.e. the beginning of bubble collision) occurs later. For p B 10 −4 , bubble nucleation, as well as magnetic field generation, is saturated on the lattice, and the corresponding curves that fall in this range are similar to each other.  The dependence of the magnetic energy with the Higgs damping γ is shown in Fig. 9 for different values of p B . When the damping falls below γ 10 −4 , magnetic field production reaches "saturation" and there is no dependence on γ. Indeed, choosing the damping equal to the SM Higgs width makes almost no difference compared to the case with no damping at all. Also from Fig. 9, we deduce that the ratio ρ B /ρ total of the magnetic energy to the total energy at the end of the BC stage, i.e. at T = T stop , turns out to be ≈ 2 − 4%. More specifically, for γ 10 −4 , this ratio saturates to the value ∼ 3.3%, while for γ 10 −4 it decreases with increasing Higgs damping, approaching ∼ 2.3% when γ = 0.01. These results are summarized in Table I. A more detailed picture of the generated magnetic field can be obtained from Fig. 10, which shows the field spectrum E M (k), defined in Eq. (31), for various values of γ at fixed p B = 10 −4 . The dependence on spectrum with p B , for fixed γ = 2.34 × 10 −5 , is displayed in Fig. 11. In both cases, the spectrum is shown as a function of the physical wave number k∆x/2π = K /N , defined in   Eq. (29). The width of each bin is ∆k∆x/2π = ∆K /N . The spectrum is normalized in such a way that the area under the curve is equal to the magnetic energy density. One caveat is that, the non-spherical geometry of the lattice may lead to the underestimation of the spectrum for k∆x/2π 0.5. The vanishing tail for large k shows numerical artifacts from k ∼ 1/∆x are well controlled. It is clear from Figs. 10 and 11 that certain features of the spectrum are largely independent of p B and γ. Specifically, the peak of the spectra lies at k∆x/2π = 0.018. Thus, the dominant wavelength is λ k = 2π/k = ∆x/0.018 ≈ 56∆x, or m H λ k ≈ 56m H ∆x ≈ 10.

B. Higgs-oscillation stage simulations
At HO stage, the Higgs field has left the symmetric phase but it is still oscillating around the minimum of the potential. As a result, magnetic fields can continue to be generated and this is what we set out to study in this section.
To this effect we select a representative subset of the configurations considered before with the following set of parameters:  The evolution is followed for 100,000 time steps, m H t ≈ 4500, and a snapshot of the configuration is saved every 200 time steps. The outcome of this calculation is shown in Fig. 12. The upper-left plot displays k mean (t)∆x/2π. The upper-right plot shows k peak (t)∆x/2π, the mode of the spectrum, where, as before, the 10-step average is used. Finally, the lower plot depicts the magnetic energy density, ρ B (t)/m 4 H . First, we notice that the magnetic energy density keeps increasing within the time range of the simulations. For example, for the configuration with p B = 10 −4 & γ = 2.34 × 10 −5 (red curve), before m H t ∼ 1000, the magnetic energy density ρ B grows roughly linearly with time;  The plot of k mean and k peak in Fig. 12 shows that the magnetic energy has power on length scales that are much larger than the particle physics scale m −1 H ≈ 6∆x. For example, when γ = 2.34 × 10 −5 , independent of p B , k mean ∆x/2π converges to ∼ 0.04, equivalent to a wavelength of m H λ k ≈ 4.2. The power spectrum of the magnetic field peaks at even larger length scales. From the plot of k peak we see that the peak moves to larger length scales with time and at the end of our run, k peak ∆x/2π ≈ 0.011 for all parameters. (The plot is jagged because of binning effects.) This corresponds to a wavelength of λ k = 2π/k = ∆x/0.011 ≈ 91∆x (m H λ k = 15.2).
In Fig. 13 we show the energy spectrum of the magnetic fields at the end of our simulation for γ = 2.34 × 10 −5 & p B = 10 −6 . A peak is clearly seen in Fig. 13 and its location is largely independent of the parameters we varied in this paper. We conducted several runs on large lattices to test if the peak is due to finite lattice size and always found the peak indicating the same wavelength, independent of the lattice size. Further study is needed to determine what parameters control the location and height of this peak.

VI. DISCUSSION AND CONCLUSION
We have simulated the classical dynamics of the bosonic electroweak theory to study the generation of magnetic fields during the EWPT, assuming that physics beyond the SM yields a first-order transition. Bubbles with the Higgs in the broken phase are randomly nucleated in regions where the Higgs is still in the symmetric phase, with the nucleation rate controlled by a parameter p B that we vary over a range. To account for the energy damped into fermions due to Higgs decays that will be present in the full theory we add a damping term to the scalar EOM that acts on the magnitude, |Φ|, in a gauge  invariant way.
We found it useful to divide the phase transition into 3 stages: Free Expansion stage (FE), Bubble Collision stage (BC), and Higgs Oscillation stage (HO). During the FE stage broken phase bubbles are nucleated and expand in the symmetric phase, but bubble collisions have not started yet and no magnetic fields are generated. Once bubbles start crossing, the energy density in magnetic fields grows to ∼ 3%, for γ equal to the observed Higgs decay width, by the end of the BC stage. At this point the spectrum of the magnetic field has a peak at k∆x/2π = 0.018, or equivalently, the peak wavelength is m H λ k = 10. This is larger than the initial size of the nucleated bubbles (m H r 0 = 6.5) but not by much. We do not see a clear dependence of the peak location on either γ or p B . Similar behavior was found in [21,22], where the generation of magnetic fields in low-scale electroweak hybrid inflation was studied on the lattice. In this context, electroweak symmetry breaking also occurs via the nucleation and growth of Higgs bubbles and the system eventually enters a regime where magnetic fields with energy density ρ B /ρ total ∼ 0.01 were found. Furthermore, as in our scenario (see Fig. 8), ρ B was also observed to grow linearly with time. Let us emphasize however, that we consider initial conditions appropriate for a first-order phase transition with random bubble nucleation. Unlike the scenario in [21,22], our magnetic field is initially zero and is entirely dynamically generated.
A detailed characterization of the magnetic helicity is left for future work. Nevertheless, let us point out that our equations of motion do not include an explicit CPviolating term so we expect the average helicity to vanish. Nevertheless, as observed in [21,22], the dispersion is expected to be non-zero leading to non-vanishing helical magnetic susceptibility.
After the BC stage, the evolution enters the HO stage in which the Higgs oscillates around its true vacuum for a very long time. Magnetic energy is seen to continuously increase during the HO stage, even at the end of our simulation runs. Due to limitations in computation power, we are not able to see the asymptotic value of magnetic energy density from our simulations. However, it is clear that most of the final energy in the magnetic field is produced during the HO stage, exceeding that produced in the BC stage by a factor of ∼ 4 (for typical values of γ and p B ) and still growing at the end of our runs. When decomposing the magnetic energy in Fourier space, we find the spectrum to peak at k peak ∆x/2π = 0.011, or λ k = 91∆x, comparable to the bubble size at percolation which, is approximately 0.33 of the lattice size (see Fig. 6). Our simulations suggest that the peak location is not sensitive to the damping γ nor the bubble nucleation probability p B . This is consistent with Fig. 6 in which we see that the percolation size is not sensitive to these parameters, in the range that we have considered.
To summarize, using numerical simulations we find that a first-order EWPT generates a significant amount of magnetic fields. While magnetic field generation has not stopped by the end of our simulations, we find that ∼ 10% of the electroweak false vacuum energy is converted into magnetic fields. The energy spectrum of the magnetic field has a peak that shifts towards larger length scales. By the end of BC stage, the peak wavelength is of order of the bubble percolation scale, and it shifts to longer wavelength in the HO stage.