1 Introduction

High-energy nuclear collisions, studied by several experimental collaborations at RHIC and at the LHC, allow one to explore the QCD phase-diagram in the high-temperature region, from high to almost vanishing baryonic density. Strong evidence, coming both from soft and hard observables, was obtained for the onset of a deconfined phase in the RHIC and LHC energy regime. Furthermore, at the experimentally accessible conditions (i.e. slightly above the deconfinement phase transition), the produced system, with a lifetime \(\sim \)10 fm/c, was found to behave like a collective, strongly interacting medium, rather opaque to penetrating probes, in contrast to the expected gas of weakly interacting quarks and gluons. Relativistic hydrodynamic models (nowadays including also dissipative effects) were developed to describe the evolution – driven by pressure gradients – of the produced matter and turned out to reproduce the data quite well [1,2,3,4,5,6,7,8], in particular the various flow-harmonics arising from the collective response of the system to the anisotropies and fluctuations in the initial conditions.

While the main purpose of relativistic heavy-ion experiments is the study of strong interactions at extreme energy densities similar to the early universe, it was recently realized that during the collisions of high-Z nuclei (\(Z=82\) for Pb) at ultra-relativistic energies, one can also produce the strongest magnetic fields reached in our universe, with initial values of \(B\!\sim \!10^{15}\) T and oriented mainly in the direction perpendicular to the reaction plane [9]. In the last years it was suggested [9, 10] that, besides leading to the production of a strongly interacting deconfined system, the presence of these strong magnetic fields in relativistic heavy-ion collisions opens also the possibility of exploring peculiar non-perturbative features of QCD, such as the appearance of non-trivial topological configurations of the color field. Once coupled to quarks, these configurations characterized by a non-vanishing winding number lead to an excess of quarks of a given chirality (chiral anomaly), depending on the value of the topological charge, and hence, on an event-by-event basis, to a violation of parity (clearly preserved after an event average). In the presence of strong magnetic fields this can give rise to observable effects, with a separation of oppositely charged particles with respect to the reaction plane. Since for massless particles with a fixed handedness (e.g. right-handed quarks) the chirality coincides with the helicity (i.e. the projection of the spin along the particle momentum) and since particles tend to align their magnetic moments along the B-field, one would have an excess of positively charged u-quarks moving in the direction of the magnetic field and an excess of negative d-quarks moving in the opposite direction. Clearly, averaging over a large sample of events, each one with a different excess of right- or left-handed quarks, the effect should cancel at the level of single-particle distributions; however, it should leave its fingerprints in multi-particle correlations, as suggested in [11]. Due to the interplay between a non-perturbative feature of strong interactions (the chiral anomaly) and the role of the magnetic field, such a phenomenon was called the chiral magnetic effect (CME) and is currently studied by different experimental collaborations at RHIC and at the LHC [12,13,14]. Analogous effects have been recently observed also in astrophysics (as an explanation of neutron stars kicks) [15] and in solid-state physics, placing Dirac semi-metals in parallel magnetic and electric fields [16,17,18,19]. Other related phenomena (chiral magnetic wave [20], chiral separation effect [21], chiral vortical effect [22]), all arising from an unbalance among right- and left-handed particles and from the presence of a strong magnetic field or angular momentum, were suggested to occur in non-central heavy-ion collisions: for an overview we refer the reader to [22].

An unambiguous observation of the CME in heavy-ion collisions would be clearly a result of deep theoretical interest, since it would represent a manifestation of the non-trivial topological structure of a Yang–Mills theory. However, in order to separate opposite-sign charges with respect to the reaction plane, the initial magnetic field generated by the colliding nuclei must be sufficiently long lived. The lifetime of the magnetic field depends strongly on the nature of the produced medium. In the vacuum the initial magnetic field decays rather rapidly. On the contrary in the opposite limit, in the presence of an ideal plasma with infinite electric conductivity, the freezing of the magnetic-flux makes the field survive much longer and may allow for the manifestation of signatures of the possible chiral unbalance in the final charged-hadron spectra, even though, at the same time, a large conductivity would also tend to compensate any local charge excess. Unfortunately, so far in the literature one can find only semi-analytic estimates of the time evolution of the magnetic field in heavy-ion collisions, based on simplifying assumptions [23,24,25,26,27,28]. A fully realistic calculation would require one to solve the Maxwell equations together with the continuity equations for the energy-momentum tensor (closed by some form of Ohm’s law), i.e. it calls for a full relativistic magneto-hydrodynamic (RMHD) description of the medium, in which the evolution of the electromagnetic field is consistently coupled with the evolution of the plasma: this is the challenge we address with the present paper.

For this first study we consider the case of an ideal plasma, with no dissipative effects and, in particular, an infinite electric conductivity, which makes the electric field in the local rest frame of the medium vanish. We also neglected any anomalous term in the currents, although previous studies [29, 30] in simplified models showed that they would not to contribute to entropy production, being in this sense “ideal”: the inclusion of dissipative and anomalous terms (necessary for the description of the CME) in our setup is left for future work. In light of the small experimental uncertainties reached at the LHC and RHIC on flow measurements the development of a code able to consistently treat the coupled evolution of the plasma and Z-enhanced electromagnetic fields represents in any case a necessary baseline for any claim that CME (and other related phenomena that we will be able to address after including anomalous currents) can be disentangled from possible other confounding electromagnetic effects that could lead to charge separation.

Our paper is organized as follows. In Sect. 2 we present the RMHD equations in their most general form, focusing then on their ideal limit, i.e. on the case of a plasma with infinite electrical conductivity (and neglecting other dissipative effects such as viscosity and thermal conduction). Only the ideal case is considered for the present paper. In Sect. 3 we discuss the numerical implementation of the ideal-RMHD equations, written in a conservative form, within our improved ECHO-QGP code. In Sect. 4 we discuss the results of a large variety of numerical tests to prove the accuracy and the robustness of the implementation: the shock-tube problem, the description of Alfvén waves, the rotor test, the reproduction of the one-dimensional Bjorken expansion in a magnetic field and the accurate treatment of the in-vacuum self-similar expansion in transverse-MHD. In Sect. 5 we show the results obtained from the code with simplified (but reasonable) initial conditions for non-central nucleus-nucleus collisions. At least in the context of this simplified approach, the magnetic field is not able to modify the elliptic flow of the final hadrons substantially. Nevertheless, further and more realistic investigations are needed before solid conclusions can be drawn. Finally, in Sect. 6 we discuss our findings and the future perspectives of our work, with the idea of performing 3D + 1 simulations based on a much broader pool of different initial conditions, possibly including dissipative effects. Appendix 1 is devoted to a discussion of the propagation of linear perturbations in RMHD, focusing on the case of fast-magnetosonic and Alfvén waves, which are the ones relevant for the analysis carried out in this paper.

2 Ideal relativistic magneto-hydrodynamics

Relativistic MHD (RMHD hereafter) is a one-fluid description of the interaction of matter and electromagnetic fields in plasmas [31, 32]. In general, as in the Newtonian limit of classical MHD, one assumes that there is a dominant species determining a main fluid current, while a secondary species must be responsible for the conduction current, namely the source for the electromagnetic field. The RMHD evolution equations describing the dynamics of the overall system are the conservation laws for this fluid current \(N^\mu \) (associated to the net-baryon current or to any other conserved charge, if any) and for the total (matter and fields) energy-momentum tensor of the plasma \(T^{\mu \nu }\), namely

$$\begin{aligned}&\mathrm{d}_\mu N^\mu = 0, \end{aligned}$$
(1)
$$\begin{aligned}&\mathrm{d}_\mu T^{\mu \nu } = 0 , \end{aligned}$$
(2)

with \(\mathrm{d}_{\mu }\) being the covariant derivative, thus to be supplemented by the second law of thermodynamics

$$\begin{aligned} \mathrm{d}_\mu s^\mu \ge 0, \end{aligned}$$
(3)

where \(s^\mu \) is the entropy current. On the other hand, the electromagnetic field obeys Maxwell’s equations

$$\begin{aligned}&\mathrm{d}_\mu F^{\mu \nu } = - J^\nu \quad (\mathrm{d}_\mu J^\mu = 0), \end{aligned}$$
(4)
$$\begin{aligned}&\mathrm{d}_\mu F^{\star \mu \nu } = 0, \end{aligned}$$
(5)

where \(F^{\mu \nu }\) is the Faraday tensor and \(F^{\star \mu \nu }=\textstyle {\frac{1}{2}}\epsilon ^{\mu \nu \lambda \kappa }F_{\lambda \kappa }\) is its dual. Notice that here we have neglected possible polarization and magnetization effects of the plasma, therefore we do not make a distinction between microscopic and macroscopic fields [33]. Under this assumption, the electromagnetic contribution to the energy-momentum tensor is known to be

$$\begin{aligned} T^{\mu \nu } _\mathrm {f} = F^{\mu \lambda }F^\nu _{\,\lambda } - \tfrac{1}{4}g^{\mu \nu }F^{\lambda \kappa }F_{\lambda \kappa }, \end{aligned}$$
(6)

for which \(\mathrm{d}_\mu T^{\mu \nu } _\mathrm {f}=J_\mu \,F^{\mu \nu }\), from Maxwell equations. Introducing the matter contribution to the energy-momentum tensor \(T^{\mu \nu } _\mathrm {m}\) and letting \(T^{\mu \nu } = T^{\mu \nu } _\mathrm {m} + T^{\mu \nu } _\mathrm {f}\), Eq. (2) gives

$$\begin{aligned} \mathrm{d}_\mu T^{\mu \nu } _\mathrm {m} = - J_\mu F^{\mu \nu }, \end{aligned}$$
(7)

where the right-hand side is the Lorentz force acting on the plasma.

In the ideal limit all dissipative fluxes can be neglected and local equilibrium is assumed. A single fluid four-velocity \(u^\mu \) (\(u_\mu u^\mu = -1\)) can be thus defined and we write

$$\begin{aligned}&N^\mu = n u^\mu , \end{aligned}$$
(8)
$$\begin{aligned}&T^{\mu \nu }_\mathrm {m} = e u^\mu u^\nu + p \Delta ^{\mu \nu } = (e + p) u^\mu u^\nu + p g^{\mu \nu }, \end{aligned}$$
(9)
$$\begin{aligned}&s^\mu = s u^\mu , \end{aligned}$$
(10)

where we have introduced the projector \(\Delta ^{\mu \nu } = g^{\mu \nu } + u^\mu u^\nu \) (\(\Delta ^{\mu \nu } u_\nu = 0\)). In the above zeroth-order relations \(n= - N^\mu u_\mu \) is the main charge density, \(e = T^{\mu \nu }_\mathrm {m}u_\mu u_\nu \) the fluid energy density, and \(p = \tfrac{1}{3} \Delta _{\mu \nu } T^{\mu \nu }_\mathrm {m}\) the kinetic pressure, all quantities are defined in the comoving frame. The Faraday tensor and its dual can also be split with respect to \(u^\mu \) as

$$\begin{aligned} F^{\mu \nu }&= u^\mu e^\nu - u^\nu e^\mu + \epsilon ^{\mu \nu \lambda \kappa } b_\lambda u_\kappa , \end{aligned}$$
(11)
$$\begin{aligned} F^{\star \mu \nu }&= u^\mu b^\nu - u^\nu b^\mu - \epsilon ^{\mu \nu \lambda \kappa } e_\lambda u_\kappa , \end{aligned}$$
(12)

where

$$\begin{aligned} e^\mu = F^{\mu \nu }u_\nu , \quad&(e^\mu u_\mu =0), \end{aligned}$$
(13)
$$\begin{aligned} b^\mu = F^{\star \mu \nu }u_\nu , \quad&(b^\mu u_\mu =0), \end{aligned}$$
(14)

are the electric and magnetic fields measured in the comoving frame of the fluid.

Since the electromagnetic fields do not evolve in vacuum, but are strongly coupled with the fluid, we must now provide an appropriate Ohm law relating the current with the fields. In the simplest case one usually assumes the linear form

$$\begin{aligned} J^\mu = \rho _\mathrm {e} u^\mu + j^{\,\mu }; \quad j^{\,\mu } = \sigma ^{\,\mu \nu } e_\nu , \end{aligned}$$
(15)

where \(\rho _\mathrm {e}\) is the electric charge density in the comoving frame, \(j^{\,\mu }\) the conduction current (\(j^{\,\mu } u_\mu = 0\)), and \(\sigma ^{\,\mu \nu }\) the plasma conductivity tensor. The presence of a finite conductivity in the plasma gives rise to (anisotropic) magnetic dissipation and Joule heating, as well as to topological field line changes known as magnetic reconnection. Recent theoretical and numerical results may be found in [34] and the references therein.

In the ideal MHD approximation considered in the present paper we assume a conductivity high enough to avoid the onset of huge currents in the plasma. We can then replace the Ohm law with its limiting case,

$$\begin{aligned} e^\mu = 0. \end{aligned}$$
(16)

When the above condition holds, the expressions for the Faraday tensor and for its dual are simplified, and the number of unknowns is reduced. In particular, Eq. (4) will be used to derive the current, if needed, while Eq. (5) will become the evolution equation for \(b^\mu \). Moreover, the electromagnetic energy-momentum tensor becomes

$$\begin{aligned} T^{\mu \nu } _\mathrm {f}&= \tfrac{1}{2} b^2 u^\mu u^\nu + \tfrac{1}{2} b^2 \Delta ^{\mu \nu } - b^\mu b^\nu \nonumber \\&= b^2 u^\mu u^\nu + \tfrac{1}{2} b^2 g^{\mu \nu } - b^\mu b^\nu , \end{aligned}$$
(17)

where \(b^2 = b_\mu b^\mu \), which can be plugged into Eq. (2) together with the corresponding matter contribution in Eq. (9). Summarizing, the system of ideal RMHD equations is

$$\begin{aligned}&\mathrm{d}_\mu ( n u^\mu ) = 0, \end{aligned}$$
(18)
$$\begin{aligned}&\mathrm{d}_\mu \left[ (e + p + b^2) u^\mu u^\nu + ( p + \tfrac{1}{2} b^2) g^{\mu \nu } - b^\mu b^\nu \right] = 0, \end{aligned}$$
(19)
$$\begin{aligned}&\mathrm{d}_\mu ( u^\mu b^\nu - u^\nu b^\mu ) = 0 , \end{aligned}$$
(20)

in the unknowns n, e, p, \(u^\mu \), and \(b^\mu \).

Non-conservative versions of the above equations can also be found. It is useful to decompose the covariant derivative as

$$\begin{aligned} \mathrm{d}_\mu = - u_\mu D + \nabla _\mu , \end{aligned}$$
(21)

where \(D \equiv u^\mu \mathrm{d}_\mu \) indicates derivation along \(u^\mu \) (reducing to the Eulerian time derivative in the nonrelativistic limit), and \(\nabla _\mu = \Delta _\mu ^\nu \mathrm{d}_\nu \) is the derivative transverse to the flow (reducing to the spatial gradient in the nonrelativistic limit). The charge conservation (baryon number in the case of heavy-ion collisions) becomes

$$\begin{aligned} Dn + n \theta = 0, \end{aligned}$$
(22)

where \(\theta \!\equiv \! \mathrm{d}_\mu u^\mu = \nabla _\mu u^\mu \) is the expansion factor. The energy equation is derived by projecting the \(\mathrm{d}_\mu T^{\mu \nu } = 0\) conservation law along the flow \(u_\nu \), where, we remember, the total energy-momentum tensor is given by the sum of the matter and field components: \(T^{\mu \nu }=T_\mathrm{m}^{\mu \nu }+T_\mathrm{f}^{\mu \nu }\). From Eq. (7) we get

$$\begin{aligned} u_\nu \mathrm{d}_\mu T^{\mu \nu }_\mathrm {m} = - J_\mu F^{\mu \nu }u_\nu , \end{aligned}$$
(23)

which leads to

$$\begin{aligned} D e + (e+p) \theta =J_\mu e^\mu . \end{aligned}$$
(24)

Written in the above form, the energy equation is rather general, the right-hand side representing the Joule heating of the fluid. However, as previously discussed, in ideal MHD the electric field in the local rest frame vanishes, \(e^\mu =0\), thus one simply has

$$\begin{aligned} D e + (e+p) \theta = 0, \end{aligned}$$
(25)

independent of \(b^\mu \), as in ordinary relativistic hydrodynamics. This form of the energy equation will be exploited in discussing the Bjorken flow of a magnetized plasma in Sect. 4.4. However, if the two contributions are kept together, we may also write

$$\begin{aligned} D \left( e + \tfrac{1}{2}b^2\right) + (e+p+b^2) \theta + u_\mu b^\nu \mathrm{d}_\nu b^\mu = 0. \end{aligned}$$
(26)

The relativistic extension of the MHD Euler equation is retrieved by projecting the total energy-momentum conservation law transverse to the flow, that is,

$$\begin{aligned}&(e+p+b^2) D u^\mu + \nabla ^\mu \left( p + \tfrac{1}{2}b^2\right) \nonumber \\&= b^\mu \mathrm{d}_\nu b^\nu + b^\nu \mathrm{d}_\nu b^\mu + u^\mu u_\nu b^\lambda \mathrm{d}_\lambda b^\nu . \end{aligned}$$
(27)

Several expressions may be derived from the last RMHD equation for the evolution of \(b^\mu \), here we choose to rewrite it as

$$\begin{aligned} D b^\mu + \theta b^\mu = u^\mu b^\nu D u_\nu + b^\nu \mathrm{d}_\nu u^\mu , \end{aligned}$$
(28)

where we have used the relation \(\mathrm{d}_\mu b^\mu = b^\mu D u_\mu \).

Finally, the system of ideal RMHD equations must be closed by choosing an equation of state (EoS), for instance of the form \(p=\mathcal {P}(e, n)\), under the assumption that in the ideal case each local equilibrium state can be completely determined by \(u^\mu \) and two thermodynamical variables (e and n in this case). The Euler and Gibbs–Duhem relations read

$$\begin{aligned} e + p = Ts + \mu n, \quad \mathrm{d} e = T d s +\mu \mathrm{d} n, \end{aligned}$$
(29)

where we have defined the local temperature \(T = (\partial e / \partial s)_n\) and the chemical potential \(\mu = (\partial e / \partial n)_s\). Equations (29), (25), and (22) allow us to write

$$\begin{aligned} Ds + s \, \theta = 0. \end{aligned}$$
(30)

We then retrieve the expected result that in the ideal case, when all dissipative terms are neglected, there is no entropy production and Eq. (3) holds as an equality. Notice that the entropy current is conserved even in the case of vanishing charge (baryon number) density and chemical potential \(n=\mu =0\), as appropriate for high-energy heavy-ion collisions and an ultra-relativistic EoS with \(p=\mathcal {P}(e)\).

3 The RMHD module in ECHO-QGP

We now rewrite the evolution equations for ideal RMHD in a form suitable for numerical integration, for which we need a clear separation between time and space components (the so-called \(3+1\) split) and the preservation of the original conservative character of the equations, since shock-capturing numerical codes such as ECHO-QGP require one to solve a series of balance laws. Here we will provide the basic expressions, for further formal and technical details, see [6, 35, 36] and references therein.

Neglecting curvature effects due to gravitational fields, we consider here a metric in special relativity (though not necessarily Minkowskian) of the form

$$\begin{aligned} \mathrm{d}s^2 = - \mathrm{d}x^0 \mathrm{d}x^0 + g_{ij}\,\mathrm{d}x^i \mathrm{d}x^j \end{aligned}$$
(31)

where the three-metric coefficients \(g_{ij}\) may depend both on space \(x^i\) and time \(x^0\), in general. It is first useful to introduce the fluid velocity \(v^i\) and electric and magnetic fields \(E^i\) and \(B^i\) as measured in the laboratory frame, which are spatial vectors (vanishing time component). The fluid four-velocity can be expressed as

$$\begin{aligned} u^\mu = ( \gamma , \gamma v^i ), \end{aligned}$$
(32)

where \(\gamma = (1-v^2)^{-1/2}\) is the Lorentz factor of the bulk flow and \(v^2=v_kv^k\), whereas the fields are, respectively,

$$\begin{aligned} e^\mu = ( \gamma v_kE^k, \gamma E^i + \gamma \varepsilon ^{ijk} v_jB_k), \end{aligned}$$
(33)
$$\begin{aligned} b^\mu = ( \gamma v_kB^k, \gamma B^i - \gamma \varepsilon ^{ijk} v_jE_k), \end{aligned}$$
(34)

where \(\varepsilon _{ijk}\) is the Levi-Civita pseudo-tensor of the spatial three-metric, namely \(\varepsilon _{ijk} = \vert g \vert ^{\frac{1}{2}} [ijk]\), with \(g=\mathrm {det}\{g_{\mu \nu }\}=-\mathrm {det}\{g_{ij}\} < 0\) and [ijk] the usual alternating symbol of three-dimensional space with values \(\pm 1\) or 0. From the ideal Ohm law of Eq. (16) we can derive the spatial electric field as

$$\begin{aligned} E_i = - \varepsilon _{ijk}v^jB^k, \end{aligned}$$
(35)

which is known once \(v^i\) and \(B^i\) have been determined. In this case the \(b^\mu \) field is

$$\begin{aligned} b^\mu = \left( \gamma v_kB^k, B^i/\gamma + \gamma v_kB^k v^i \right) \end{aligned}$$
(36)

with

$$\begin{aligned} b^2 = B^2 - E^2 = B^2/\gamma ^2 + (v_kB^k)^2 \end{aligned}$$
(37)

where \(B^2=B_kB^k\) and \(E^2=E_kE^k=v^2B^2 - (v_kB^k)^2\). Notice that when \(v^i=0\), that is, in the fluid rest frame, we retrieve \(u^\mu = (1,0)\) and \(b^\mu = (0, B^i)\), as expected.

Let us now rewrite Eqs. (18)–(20) in a form appropriate for numerical integration, by clearly separating time and space derivatives and tensor components. We find the system

$$\begin{aligned} \partial _0 \mathbf{U}+ \partial _i \mathbf{F}^i =\mathbf{S}, \end{aligned}$$
(38)

where

$$\begin{aligned} \mathbf{U} \! = \! \vert g \vert ^{\frac{1}{2}}\! \left( \begin{array}{c} \gamma n \\ S_j \equiv T^0_{\,j}\\ \mathcal {E} \equiv - T^0_{\,0} \\ B^j \end{array}\right) , \, \mathbf{F}^i \! = \! \vert g \vert ^{\frac{1}{2}}\! \left( \begin{array}{c} \gamma n v^i \\ T^i_{\,j}\\ S^i \equiv - T^i_{\, 0} \\ v^iB^j - B^iv^j \end{array}\right) \end{aligned}$$
(39)

are, respectively, the set of conservative variables and fluxes, while the source terms are given by

$$\begin{aligned} \mathbf{S}=\vert g \vert ^{\frac{1}{2}}\left( \begin{array}{c} 0 \\ \tfrac{1}{2} T^{ik}\partial _j g_{ik} \\ - \tfrac{1}{2} T^{ik}\partial _0 g_{ik} \\ 0 \end{array}\right) , \end{aligned}$$
(40)

where the symmetric and antisymmetric properties of \(T^{\mu \nu }\) and \(F^{\star \mu \nu }\), respectively, have been exploited in deriving the above balance laws.

The components of \(T^{\mu \nu }\) appearing in the expressions for the conserved variables and fluxes are

$$\begin{aligned} S_i= & {} (e+p)\gamma ^2v_i + \varepsilon _{ijk}E^jB^k , \end{aligned}$$
(41)
$$\begin{aligned} T_{ij}= & {} (e+p)\gamma ^2 v_iv_j + (p + u_\mathrm {em} )g_{ij} -E_iE_j - B_iB_j , \nonumber \\ \end{aligned}$$
(42)
$$\begin{aligned} \mathcal {E}= & {} (e+p)\gamma ^2 - p + u_\mathrm {em} , \end{aligned}$$
(43)

where we have defined the electromagnetic energy density \(u_\mathrm {em}=\tfrac{1}{2}(E^2+B^2)\). We recall that while \(B^i\) is a dynamical variable, \(E^i\) is a derived quantity, obtained from Eq. (35).

One final constraint comes from the time component of Eq. (20), that is, the solenoidal condition

$$\begin{aligned} \partial _i (\vert g \vert ^{\frac{1}{2}} B^i) = 0, \end{aligned}$$
(44)

which, if valid at the initial time of the evolution, should be preserved analytically by the last equation of the above RMHD system. From a numerical point of view, however, this constraint needs some specific techniques to be actually enforced. In fact, the accumulation of the numerical errors associated to the computation of the derivatives of the magnetic field may lead to the violation of the solenoidal (i.e. “null-B divergence”) condition (44), implying the formation of unphysical magnetic monopoles and fictitious forces. There are several methods to avoid, or at least to limit, this issue [37,38,39,40]. We adopted the method proposed by Dedner for MHD and later extended to the cases of special and general relativity [41,42,43,44,45,46].

3.1 Numerical procedures

ECHO-QGP is based on finite difference schemes. At the beginning of the simulation, the initial values of the primitive variables n (the baryon density), \(v^i\) (the contravariant components of the velocity of the fluid in the lab frame), p (the pressure of the fluid in the comoving frame) and \(B^i\) (the contravariant components of the magnetic induction field in the lab frame) are discretized on the computational grid by evaluating them at the center of each cell. Time integration of conservative variables is performed using a second or third order Runge–Kutta algorithm, then, at each sub-timestep:

  • the values of the primitive variables are reconstructed at cell borders, for each direction (several algorithms are implemented and can be selected [36]: TVD2, CENO3, WENO3, WENO5, PPM4, MPE3, MPE5, MPE7),

  • fluxes in Eq. (39) are computed,

  • the Riemann problem for fluxes at cell interfaces is solved using the HLL (Harten–Lax–Van Leer) [47] approximate method,

  • the divergence of these numerical fluxes and source terms in Eq. (40) are computed at cell centers, allowing to integrate the discretized evolution equations for the conservative variables,

  • the new primitive variables are retrieved from the evolved conservative ones.

This last step above implies to solve a system of non-linear equations and currently there is no known algorithm which guarantees a global convergence to the solutions. The system is more easily solved by providing an initial guess for the solution, usually chosen as the values of the primitive variable at the previous timestep. However, in a rapidly evolving system as in the case of heavy-ion collision, this guess may not be close enough to the real solution and the algorithm may fail or converge to other (unphysical) solutions. Nevertheless, if we restrict to the use of a specific analytic Equation of State (EoS), then the system of non linear equations may be considerably simplified and it is possible to develop very robust inversion routines [36, 48].

For the present study we focus for the sake of simplicity on the ultra-relativistic gas EoS \(p=e/3\), using an “ad hoc” version of the method described in [36], hereafter shortly summarized. We exploit Eq. (35) to rewrite Eqs. (41) and (43), then we compute \(S^2=S_i S^i\) and \(S_i B^i\), which are known since \(B^i\) is both a conservative and primitive variable (the difference is only in the factor \(\vert g \vert ^{\frac{1}{2}}\)). After introducing the new variables \(x=v^2=v^i v_i\) and \(y=4p\gamma ^2\), with some algebraic manipulations we can formulate the following system of equations:

$$\begin{aligned} (y+B^2)^2x-y^{-2}(S_i B^i)^2(2y+B^2)-S^2=0, \end{aligned}$$
(45)
$$\begin{aligned} \dfrac{3+x}{4}y +\dfrac{1}{2}(1+x)B^2-\dfrac{1}{2}y^{-2}(S_i B^i)^2-\mathcal {E}=0. \end{aligned}$$
(46)

These coupled non-linear equations are solved through a nested procedure: Eq. (45) is solved for x with a one dimensional iterative hybrid Newton–Raphson/bisection method [49] with bracketing between 0 and 1; at each iteration of this routine, the y variable is obtained by finding the (unique) positive root of the third order polynomial of Eq. (46) multiplied by \(y^2\) with \(x=x(y)\). The solution of the system allows then to compute the primitive variables through the relations:

$$\begin{aligned} v^i=\frac{S^i+ (S_kB^k)B^i/y}{y+B^2}, \quad p= \frac{e}{3} = \frac{1}{4} (1-x) y. \end{aligned}$$
(47)

For EoS where the pressure p depends also on the baryon density n, like the ideal-gas EoS used in [36] and in the shock-tube test presented here, note that the latter quantity can be easily obtained by dividing the corresponding conserved variable by the Lorentz factor \(\gamma \). However, for a comparison to high energy HIC data, a lattice QCD based equation of state should be employed [50] (in contrast to the simplified EoS used for the present study), which unfortunately does not allow to simplify the system of non-linear equations on which the inversion routine is based and needs a more careful (and slower) numerical treatment as discussed above.

4 Tests

In this section we present some numerical test problems selected in order to validate the code. We avoid to repeat tests aimed at simply measuring the accuracy of the “core” algorithms, since ECHO-QGP for relativistic hydrodynamics [6, 7] has been already validated against basic benchmarks, and many additional tests have been performed on the original ECHO code [36], from which ECHO-QGP has been derived sharing the same base structure. Instead, here we focus on checking the correctness of its results in the ideal RMHD context. We use the ultra-relativistic EoS \(p\!=\!e/3\), if not mentioned otherwise.

We will use either Minkowski (txyz) or Milne \([\tau ,x,y,\eta _s]\) coordinates, where \(\tau \!\equiv \!\sqrt{t^2-z^2}\) is the longitudinal proper-time and \(\eta _s\equiv \frac{1}{2}\ln \frac{t+z}{t-z}\) the space-time rapidity. In the following, in writing four-vector components in Milne coordinates, we will employ square brackets. Notice that in the first case the three-metric is \(g_{ij}=\mathrm {diag}\{1,1,1\}\), with \(\vert g \vert ^{\frac{1}{2}}= 1\), whereas for Milne coordinates \(g_{ij}=\mathrm {diag}\{1,1,\tau ^2\}\), with \(\vert g \vert ^{\frac{1}{2}}= \tau \). In both cases \(\partial _j g_{ik}=0\) and the source terms in the evolution equations simplify considerably. Notice that in Milne coordinates, where \(g_{33}=\tau ^2\), the source term for the energy equation contains a non-vanishing term proportional to \(\tfrac{1}{2}\partial _0 g_{33} = \tau \).

Table 1 Initial conditions for the magnetized shock-tube test
Fig. 1
figure 1

Magnetized shock-tube test for \(t=4\), with the comparison of quantities computed by ECHO-QGP against the solution given by the Exact Riemann Solver by Giacomazzo and Rezzolla [51]. We display the mass density \(\rho \) (top left), the \(v_x\) velocity component (top right), the \(B_y\) magnetic-field component (bottom left) and the total pressure \(p+\frac{1}{2}b^2\) (bottom right), where b is the magnetic field in the comoving fluid frame

4.1 Magnetized shock tube

In order to test the shock-capturing properties of ECHO-QGP for relativistic MHD, we run a 1D shock-tube test in Minkowski coordinates comparing the numerical results against the solutions of the same problem computed by the exact Riemann solver developed by Giacomazzo and Rezzolla [51]. Since the cited solver works for an ideal-gas EoS, for the present test we impose

$$\begin{aligned} p=(\Gamma -1)(e-\rho ), \end{aligned}$$
(48)

with an adiabatic index \(\Gamma =4/3\), where \(\rho = n m\) stands for the mass density in the comoving frame (m is the rest mass and n is the number density of the conserved species), in a situation in which particle creation/annihilation is negligible, so that \((e-\rho )\) is the thermal energy density. To employ Eq. (48) in this test, when retrieving the primitive variables we used the same method described in Ref. [36].

The initial conditions for the non-vanishing quantities are provided in [52] and listed in Table 1 using proper dimensionless units.

The test runs from an initial time \(t=0\) to a final time \(t=4\), with a grid resolution of 0.0025 (400 cells per unit of length). Results are displayed in Fig. 1. The comparison shows excellent agreement between the RMHD implementation in ECHO-QGP and the exact result.

Fig. 2
figure 2

Circularly polarized Alfvén-wave test: comparison between the velocity \(v_z(y=x)\) (left) and the magnetic field \(B_z(y=x)\) (right) at \(t=0\) and after 5 periods of the wave

4.2 Large-amplitude CP Alfvén wave

A multi-dimensional relativistic MHD test with an exactFootnote 1 solution is provided by the propagation along the diagonal of a square numerical domain of a large-amplitude Circularly Polarized (CP) Alfvén wave [36].

We consider a Cartesian \(X-Y-Z\) frame, rotated along \(Z\equiv z\) in the \(x-y\) plane in such a way that X coincides with the diagonal \(y=x\) of the numerical domain. A relativistic MHD CP Alfvén wave is defined by the magnetic-field and velocity components

$$\begin{aligned} B_X = B_0, \quad B_Y=\eta B_0\cos \phi ,\quad B_Z =\eta B_0\sin \phi , \end{aligned}$$
$$\begin{aligned} v_X=0, \quad v_Y=-v_A B_Y/B_0, \quad v_Z=-v_A B_Z/B_0, \end{aligned}$$
(49)

where \(B_0\) is the uniform background field, the dimensionless parameter \(\eta =\sqrt{B_X^2 + B_Y^2}/B_0\) sets the scale of the perturbation, and \(\phi \) is the phase. For propagation along X we have \(\phi \!=\!k(X - v_At)\), where \(k=2\pi /\lambda \) is the wave number and the relativistic Alfvén velocity for arbitrary large amplitudes \(\eta \) is given by [36]:

$$\begin{aligned} v_A^2 = \dfrac{2B_0^2}{ e + p + (1 + \eta ^2)B_0^2 + \sqrt{\left[ e + p + (1 + \eta ^2)B_0^2\right] ^2 - 4\eta ^2B_0^4}}. \end{aligned}$$
(50)

We recall that in our ideal MHD approach the electric field is given by Eq. (35) and we notice that the quantities \(v^2\equiv |\mathbf {v}|^2\!=\!\eta ^2 v_A^2\), \(B^2\!=\!B_0^2(1+\eta ^2)\) and \(E^2\!=\!\eta ^2 v_A^2 B_0^2\) are constant. Here we use the ultra-relativistic EoS \(p\!=\!e/3\), where p and e remain constant to their initial uniform values \(p_0\) and \(e_0\). Notice that, as expected, for small amplitudes the Alfvén speed in Eq. (50) correctly reduces to the expression derived in Appendix 2 for the linearized case. With the above assumptions the CP Alfvén wave has a period \(T=\lambda /v_A\), so that at time \(t=nT\), with n any integer number, the numerical solution is expected to assume the same configuration as at \(t=0\). In the following we will consider the case of a perturbation with wavelength \(\lambda =L/2\), where L is the length of the diagonal of the \(x-y\) domain. We perform the test in a square numerical domain \([0,2\pi \sqrt{2}] \times [0,2\pi \sqrt{2}]\), so that \(L=4\pi \), discretized with a grid of 512 x 512 cells, choosing \(p_0\!=\!e_0/3=B_0^2=1\) and also a large amplitude of the wave \(\eta =1\) and a unit wave number \(k=1\) (so that \(\lambda =2\pi =L/2\)).

In Fig. 2 we compare the z components of the velocity and of the magnetic field for \(t=5T\), that is, after \(n=5\) periods, along the diagonal of the grid \(y=x\). Neither deformations nor phase lags are observed for the depicted components as well for the other quantities not shown here. The accuracy obviously depends on an adequate numerical resolution and on the order of time and spatial integration. Further details can be found in Ref. [36]. Finally, note that large-amplitude Alfvén waves, even if exact solutions of MHD equations, may be unstable on long timescales due to coupling with compressive modes [53, 54].

4.3 Rotor test

We now describe a modified version of the 2D “rotor” test [35, 43], here both in Minkowski and in Milne coordinates, using the ultra-relativistic EoS \(p\!=\!e/3\).

Fig. 3
figure 3

Results of the Rotor test in Minkowski coordinates at \(t_f\!=\!1.4\) (start time was \(t_i\!=\!1\)), using a grid of 400 \(\times \) 400 cells. The left plot shows the thermal pressure, the right plot shows the magnetic pressure (\((B^x B_x + B^y B_y)/2\))

An initially rigidly rotating disk of radius \(r_0\) is threaded by a constant magnetic field, causing a rapid slow down of the motion. In the previous examples found in the literature the disk is denser than the surrounding medium, but, since in our case the density does not have any influence on the evolution of the system, because the EOS does not depend on it, we assume that the region inside the disk has an initial thermal pressure larger than the region outside. After this modification, the new test proposed here becomes a sort of mixture between the “rotor” and the “magnetized cylindrical blast wave” tests [35] (Figs. 3, 4).

Fig. 4
figure 4

Results of the Rotor test in Milne cordinates at \(t_f\!=\!1.4\) (start time was \(t_i\!=\!1\)), using a grid of 400 \(\times \) 400 cells. The left plot shows the thermal pressure, the right plot shows the magnetic pressure (\((B^x B_x + B^y B_y)/2\)). We recall that in Milne coordinates \(v^{\eta }\!=\!0\) \(\Leftrightarrow \) \(v^z=z/t\), implying that this case describes the evolution of a system which is different from the other one in Minkowski coordinates

The initial velocity of the fluid is null outside of the disk, while inside the disk its components are

$$\begin{aligned} {\left\{ \begin{array}{ll} v^x\,=\,\dfrac{\omega \,y}{r_0}\\ v^y\,=\,-\dfrac{\omega \,x}{r_0}\\ v^z\,=\,0 \end{array}\right. } \end{aligned}$$

in the case of Minkowski coordinates, while, in Milne coordinates, \(v^z\) is substituted by \(v^{\eta }\!=\!0\), which amounts to assume a longitudinal Bjorken expansion \(v^z=z/t\).

Table 2 Values of the parameters used in the rotor test

The values of the parameters chosen for the test are listed in Table 2.

The major difference between the results in the two coordinate systems is the decay of the thermal and magnetic pressures in the case of Milne coordinates, which occurs in every region of the grid, due the longitudinal expansion of the system. Then in both cases we observe a compression wave, due to the larger initial inner pressure and due to the motion of rotation of the disk, forged into an asymmetric shape by the effects of the magnetic field.

4.4 Bjorken flow

This test consists in a comparison with the analytical solution for the temporal evolution of a one-dimensional boost-invariant flow, obtained extending the model by Bjorken [55] to the case of transverse MHD [56].

We consider the relativistic flow along the z-direction of an ideal magnetized fluid, with pressure p and energy density e, related by the ultra-relativistic EoS \(p\!=\!e/3\), both constant in the transverse \(x\!-\!y\) plane and independent from the space-time rapidity \(\eta _s\) (one employs Milne coordinates). For the flow profile one considers a longitudinal boost-invariant Hubble-law expansion \(v^z\!=\!z/t\), leading to a four-velocity \(u^\mu \!=\!(\cosh \eta _s,0,0,\sinh \eta _s)\). In Milne coordinates the fluid velocity reads simply \(u^\mu \!=\![1,0,0,0]\), so that for the comoving derivative and the expansion rate one has \(D\!=\!\partial _\tau \) and \(\theta \!=\!1/\tau \). The transverse MHD hypothesis, i.e. the assumption of having a magnetic field \(b_\mu \!=\!(0,b_x,b_y,0)\) orthogonal to the fluid velocity \(u^\mu \), so that \(u^\mu b_\mu =0\), allows one to derive from Eq. (26) the energy-conservation equation [56]

$$\begin{aligned} \partial _{\tau } \left( e+\frac{{b}^{2}}{2}\right) +\frac{e+p+{b}^{2}}{\tau }=0. \end{aligned}$$
(51)

However, under the hypothesis of infinite conductivity, one has also from Eq. (25)

$$\begin{aligned} \partial _{\tau }\,e+\frac{e+p}{\tau }=0. \end{aligned}$$
(52)

This allows one to obtain the evolution equation for the magnetic field:

$$\begin{aligned} \partial _\tau b+\frac{b}{\tau }=0. \end{aligned}$$
(53)
Fig. 5
figure 5

Evolution of the energy density in arbitrary units for different values of the initial magnetization \(\sigma _0\) in comparison to the analytical result

Fig. 6
figure 6

Evolution of the normalized total energy density \((e+b^2/2)/e_0\) in comparison to the analytical result

Considering the case of an ultra-relativistic \(p=e/3\) EoS, it is possible to derive from the above the time evolution of the energy density and of the magnetic field:

$$\begin{aligned} e(\tau )= & {} e_0\left( \dfrac{\tau _0}{\tau }\right) ^{4/3} \end{aligned}$$
(54)

and

$$\begin{aligned} b(\tau )= & {} b_0 \dfrac{\tau _0}{\tau } . \end{aligned}$$
(55)

Notice that, in an ideal plasma, due to the flux-freezing condition, the magnetic field decreases according to the same law as the conserved charges or of the entropy.

We perform the test for three different values of the initial magnetization \(\sigma _0\!=\!b_0^2/e_0\): 0, 1 and 10 (in adimensional units). The comparison with the analytic results (shown in Figs. 5, 6) shows perfect agreement between the simulation and the exact solution.

4.5 Self-similar expansion in vacuum

With the purpose of performing a non-trivial validation of our numerical code, here we consider an exact solution of the so-called transverse RMHD equations, namely a situation in which a hot magnetized plasma flows along one direction, with the magnetic field perpendicular to the flow. Without loss of generality we can adopt a Minkowskian flat space in Cartesian coordinates and take the fluid flowing along the z-axis, while the magnetic field having only x-component

$$\begin{aligned} u^\mu =\gamma (1,0,0,v),\quad b^\mu =(0,b,0,0)=(0,B/\gamma ,0,0). \end{aligned}$$
(56)

Within ideal RMHD, we recall that the relation between the magnetic field in the comoving (\(b^\mu \)) and laboratory (\({\varvec{B}}\)) frames is given by Eq. (36):

$$\begin{aligned} b^\mu =[\gamma ({\varvec{v}}\!\cdot \!{\varvec{B}}),{\varvec{B}}/\gamma +\gamma ({\varvec{v}}\!\cdot \!{\varvec{B}}){\varvec{v}}], \end{aligned}$$
(57)

and if all quantities are constant in the transverse plane, the set of equations reduces to

$$\begin{aligned} D\left( e+{b^2}/{2}\right) +(e+p+b^2)\theta =0, \end{aligned}$$
(58a)
$$\begin{aligned} (e+p+b^2)D u^\mu +\nabla ^\mu (p+b^2/2)=0. \end{aligned}$$
(58b)

The above equations have to be solved together with the one providing the evolution of the magnetic field in the plasma

$$\begin{aligned} \partial _t{\varvec{B}}= - {\varvec{\nabla }}\times {\varvec{E}}, \end{aligned}$$
(59)

which, in ideal MHD where \({\varvec{E}}=-{\varvec{v}}\times {\varvec{B}}\), leads to

$$\begin{aligned} (\partial _t+{\varvec{v}}\!\cdot \!{\varvec{\nabla }}){\varvec{B}}=({\varvec{B}}\!\cdot \!{\varvec{\nabla }}){\varvec{v}}-{\varvec{B}}({\varvec{\nabla }}\!\cdot \!{\varvec{v}}). \end{aligned}$$
(60)

Writing explicitly the derivatives one gets

$$\begin{aligned} (\partial _t+v\,\partial _z)\left( e+{b^2}/{2}\right) +\gamma ^2(e+p+b^2)(v\,\partial _t+\partial _z)v=0,\end{aligned}$$
(61a)
$$\begin{aligned} (v\,\partial _t+\partial _z)(p+b^2/2)+\gamma ^2(e+p+b^2)(\partial _t+v\,\partial _z)v=0, \end{aligned}$$
(61b)

and

$$\begin{aligned} (\partial _t+v\,\partial _z)B=-B(\partial _z v). \end{aligned}$$
(62)

We now wish to address the case of a plasma, initially at rest, with magnetic field, pressure, energy, and entropy density \(b_0\), \(p_0\), \(e_0\), and \(s_0\) for \(z<0\) and vanishing on the right. We want to study how the system evolves in time, extending the study performed in [57] to the case of an ultra-relativistic plasma of massless particles. For this purpose, it is useful to introduce the self-similar variable \(\xi \equiv z/t\), which allows one to rewrite the equations as

$$\begin{aligned} (v-\xi )\frac{\mathrm{d}}{\mathrm{d}\xi }\left( e+{b^2}/{2}\right) +\gamma ^2(e+p+b^2)(1-v\,\xi )\frac{\mathrm{d}v}{\mathrm{d}\xi }=0,\end{aligned}$$
(63a)
$$\begin{aligned} (1-v\,\xi )\frac{\mathrm{d}}{\mathrm{d}\xi }(p+b^2/2)+\gamma ^2(e+p+b^2)(v-\xi )\frac{\mathrm{d}v}{\mathrm{d}\xi }=0. \end{aligned}$$
(63b)

In Ref. [57] the system was closed by combining the induction equation for the magnetic field with the one for mass conservation. Actually, in the case of heavy-ion collisions, such a choice would not be meaningful, since one deals with an ultra-relativistic plasma of massless particles, in which particle-antiparticle pairs are continuously created/annihilated. However, in the absence of dissipative effects, one can replace the conservation equation for the mass with the one for the entropy. One can write the conservation law \(\mathrm{d}_\mu s^\mu = \partial _\mu s^\mu =0\) for the entropy current

$$\begin{aligned} s^\mu \equiv s u^\mu =s\gamma \,(1,{\varvec{v}})\equiv \tilde{s}\,(1,{\varvec{v}}). \end{aligned}$$
(64)

Entropy conservation can be expressed by Eq. (30) or, more conveniently presently, in terms of its density in the laboratory frame:

$$\begin{aligned} (\partial _t+{\varvec{v}}\!\cdot \!{\varvec{\nabla }})\tilde{s}=-\tilde{s}\,{\varvec{\nabla }}\!\cdot \!{\varvec{v}}. \end{aligned}$$
(65)

Introducing the Lagrangian derivative \(d/dt\equiv (\partial _t+{\varvec{v}}\!\cdot \!{\varvec{\nabla }})\) and combining Eqs. (60) and (65) one gets

$$\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t}\left( \frac{{\varvec{B}}}{\tilde{s}}\right) =\frac{1}{\tilde{s}}({\varvec{B}}\!\cdot \!{\varvec{\nabla }})\,{\varvec{v}}. \end{aligned}$$
(66)

In the transverse one-dimensional MHD case we are addressing one has then

$$\begin{aligned} {\frac{\mathrm{d}}{\mathrm{d}t}\left( \frac{B}{\tilde{s}}\right) =\frac{\mathrm{d}}{\mathrm{d}t}\left( \frac{b}{s}\right) =0}\quad \longrightarrow \quad b(\mathrm{d}b)=b^2\frac{\mathrm{d}s}{s} . \end{aligned}$$
(67)

This allows one to rewrite the set of RMHD equations as (the prime index denotes the derivative with respect to the self-similar variable \(\xi \))

$$\begin{aligned}&(v-\xi )\left( e'+b^2\frac{s'}{s}\right) +\gamma ^2(e+p+b^2)(1-v\,\xi )v'=0,\end{aligned}$$
(68a)
$$\begin{aligned}&(1-v\,\xi )\left( p'+b^2\frac{s'}{s}\right) +\gamma ^2(e+p+b^2)(v-\xi )v'=0,\end{aligned}$$
(68b)
$$\begin{aligned}&s'=-\frac{1-v\,\xi }{v-\xi }\gamma ^2 s v'. \end{aligned}$$
(68c)

The equation for the entropy, together with the rather general EoS \(p=c_s^2 e\) (here \(c_s\) is the sound speed), leads to

$$\begin{aligned}&(v-\xi )e'+\gamma ^2(e+p)(1-v\,\xi )v'=0,\end{aligned}$$
(69a)
$$\begin{aligned}&(v-\xi )(1-v\,\xi )c_s^2 e'\nonumber \\&\quad +\gamma ^2 \left[ (e+p+b^2)(v-\xi )^2-(1-v\,\xi )^2 b^2\right] v'=0. \end{aligned}$$
(69b)

The system has a non-trivial solution only if the determinant vanishes, i.e. if

$$\begin{aligned} (1-v\,\xi )^2 c_s^2(e+p)=(e+p)(v-\xi )^2-(1-v^2)(1-\xi ^2)b^2. \end{aligned}$$
(70)

A rarefaction wave propagates from the outside inside the plasma. The position of the rarefaction front, characterized by a vanishing value of the fluid velocity \(v=0\) and with all the other quantities equal to their initial unperturbed values is given by

$$\begin{aligned} c_s^2(e_0+p_0)=(e_0+p_0)\xi _\mathrm{rw}^2-(1-\xi ^2_\mathrm{rw})b^2. \end{aligned}$$
(71)

One gets then

$$\begin{aligned} \xi ^2_\mathrm{rw}=\frac{(e_0+p_0)c_s^2+b_0^2}{e_0+p_0+b_0^2}, \end{aligned}$$
(72)

which, in the case of and ideal ultra-relativistic gas EoS, reduces to

$$\begin{aligned} {\xi ^2_\mathrm{rw}=\frac{(4/3)p_0+b_0^2}{4p_0+b_0^2}}\,, \end{aligned}$$
(73)

in agreement with what was obtained for the fast-magnetosonic speed in Eq. (A.8) of Appendix 1. Hence, with the initial condition we chose, the position of the rarefaction front propagates backwards with a velocity equal to the fast-magnetosonic speed: \(z_\mathrm{rf}(t)=-c_f\,t\).

We now look for an explicit solution written in terms of the ratio \({\mathcal B}\) between the initial thermal and magnetic pressure. We will try to follow an approach as close as possible to the one employed by Lyutikov and Hadden [57]. In the case of an ideal ultra-relativistic plasma one has \(p\sim T^4\) and \(s\sim T^3,\) so that

$$\begin{aligned} p=p_0\left( \frac{s}{s_0}\right) ^{4/3}\quad \longrightarrow \quad p'=\frac{4}{3}p\left( \frac{s'}{s}\right) . \end{aligned}$$
(74)

One gets then

$$\begin{aligned} (1-v\,\xi )\left( \frac{4}{3}p+b^2\right) \frac{s'}{s}+\gamma ^2(4p+b^2)(v-\xi )v'=0. \end{aligned}$$
(75)

Exploiting Eq. (68c) one obtains

$$\begin{aligned} (4p+b^2)(v-\xi )^2-\left( \frac{4}{3}p+b^2\right) (1-v\,\xi )=0. \end{aligned}$$
(76)

In the approach by Lyutikov (generalized to our ultra-relativistic case) one writes the above equation in terms of the parameter and variable

$$\begin{aligned} {{\mathcal B}\equiv \frac{p_0}{b_0^2/2}} \quad \mathrm{and}\quad {s_1\equiv \frac{s}{s_0}}. \end{aligned}$$
(77)

One has then, from Eqs. (67) and (74),

$$\begin{aligned} p=p_0\left( \frac{s}{s_0}\right) ^{4/3}\!\!\!={\mathcal B}\,\frac{b_0^2}{2}\,s_1^{4/3} \end{aligned}$$
(78)

and

$$\begin{aligned} b^2=b_0^2\,\frac{b^2}{b_0^2}=b_0^2\,\frac{s^2}{s_0^2}=b_0^2 s_1^2. \end{aligned}$$
(79)

Hence, we get

$$\begin{aligned} (2{\mathcal B}+s_1^{2/3})(v-\xi )^2-\left( \frac{2}{3}{\mathcal B}+s_1^{2/3}\right) (1-v\,\xi )=0, \end{aligned}$$
(80)

which we can recast as

$$\begin{aligned} \begin{aligned}&s_1^{2/3}(1-v^2)(1-\xi ^2)+\frac{2}{3}{\mathcal B}[1+4v\,\xi -3\xi ^2+v^2(\xi ^2-3)]\\&=0. \end{aligned} \end{aligned}$$
(81)

The latter is equivalent to Eq. (6) in the paper by Lyutikov, except that now it depends only on the parameter \({\mathcal B}\) (thermal pressure and particle/entropy density are not independent variables in an ultra-relativistic plasma) and it is does not include the term arising from the mass density.

The above equations can be equivalently written in terms of the variables

$$\begin{aligned} \delta _v\equiv \sqrt{\frac{1+v}{1-v}},\quad \delta _\xi \equiv \sqrt{\frac{1+\xi }{1-\xi }}. \end{aligned}$$
(82)

One obtains

$$\begin{aligned} \delta _v^2\delta _\xi ^2 s_1^{2/3}-\frac{1}{3}{\mathcal B}\left[ \delta _v^4-4\delta _v^2\delta _\xi ^2+\delta _\xi ^4\right] =0,\end{aligned}$$
(83a)
$$\begin{aligned} (\delta _v^2+\delta _\xi ^2)s_1\frac{\partial \delta _v}{\partial \delta _\xi }+ \delta _v(\delta _v^2-\delta _\xi ^2)\frac{\partial s_1}{\partial \delta _\xi }=0. \end{aligned}$$
(83b)

From the first equation we define

$$\begin{aligned} \frac{\delta ^2_v}{\delta ^2_\xi }\equiv f^2(s_1)\equiv \frac{(4{\mathcal B}+3s_1^{2/3})\pm \sqrt{(4{\mathcal B}+3s_1^{2/3})^2-4{\mathcal B}^2 }}{2{\mathcal B}}. \end{aligned}$$
(84)

From the second equation one then gets

$$\begin{aligned} \frac{\partial \ln \delta _\xi }{\partial s_1}=\frac{f(s_1)(1-f^2(s_1))-s_1 f'(s_1)(1+f^2(s_1))}{s_1\,f(s_1)(1+f^2(s_1))}. \end{aligned}$$
(85)

The previous equation can easily be integrated, leading to

$$\begin{aligned} \ln \frac{\delta _\xi (s_1)}{\delta _{\xi _0}}= \int _1^{s_1}\!\!\!\mathrm{d}\alpha \frac{f(\alpha )(1-f^2(\alpha ))-\alpha f'(\alpha )(1+f^2(\alpha ))}{\alpha \,f(\alpha )(1+f^2(\alpha )}, \end{aligned}$$
(86)

where \(\delta _{\xi _0}\) can be fixed through the initial condition, namely the development of a left-propagating rarefaction wave, with velocity equal to the fast-magnetosonic speed:

$$\begin{aligned} \delta _{\xi _0}=\sqrt{\frac{1-c_{f,0}}{1+c_{f,0}}},\quad \mathrm{where}\quad c^2_{f,0}=\frac{2{\mathcal B}+3}{3(2{\mathcal B}+1)}. \end{aligned}$$
(87)
Fig. 7
figure 7

Self-similar expansion into vacuum test, comparison of the ECHO-QGP results with the semi-analytic solution computed with Mathematica [58]. The graph shows \(s_1=s/s_0\) vs. \(\xi =z/t\) at \(t=20\) for three different values (10, 1 and 0.1 from top to bottom) of the \(\mathcal B=2 p_0/B_0^2\) parameter. We used a grid of 801 cells, the reconstruction algorithm MPE5, the approximate Riemann solver HLL and the time integration algorithm was a second order Runge–Kutta. The initial pressure was: left side (\(z \le 0\)) \(p_0 = 1000\), right side (\(z > 0\)) \(p_0 = 5\cdot 10^{-5}\approx 0\) (due to numerical reasons)

In Fig. 7 we display a comparison between the above semi-analytic solution and the numerical result provided by our code. The graph shows \(s_1=s/s_0\) vs. \(\xi =z/t\) at \(t=20\) for three different values ( 10, 1 and 0.1 ) of the \(\mathcal B=2 p_0/B_0^2\) parameter. We used a grid of 801 cells, reconstruction algorithm: MPE5, approximate Riemann solver: HLL, time integration algorithm: second order Runge–Kutta. The initial pressure was: left side (\(z \le 0\)) \(p_0 = 1000\), right side (\(z > 0\)) \(p_0 = 5\cdot 10^{-5}\approx 0\) (due to numerical reasons, since ECHO-QGP cannot run with true null pressure). Again we observe excellent agreement between the numerical implementation and the analytical results for a large variety of parameters.

5 Results of RMHD simulations for HIC

We plan to present a more extensive study of the QGP evolution in a subsequent article, nevertheless here we present some preliminary results to evaluate the impact that the interplay between magnetic-field and hydro evolution may have on some experimental observables. Although the whole 3D + 1 formalism has been already implemented into the code, for simplicity here we will show a basic 2D + 1 application to heavy ion collisions.

5.1 Setup

We consider Au–Au collisions at \(\sqrt{s_{NN}}=200\) GeV. The initial conditions are modeled with the optical Glauber model [6, 59]. In this framework, the initial energy density distribution e in the transverse plane is given by

$$\begin{aligned} e(\tau _0,{\varvec{x}};b)=e_0\left[ (1-\alpha _H)\frac{n_\mathrm{part}({\varvec{x}};b)}{n_\mathrm{part}({\varvec{0}};0)}+\alpha _H\frac{n_\mathrm{coll}({\varvec{x}};b)}{n_\mathrm{coll}({\varvec{0}};0)}\right] , \end{aligned}$$
(88)

where \(e_0\) is the value of e at \({\varvec{x}}\!=\!{\varvec{0}}\) and \(b\!=\!0\), \({\varvec{x}}\) the coordinates in the transverse plane and b the impact parameter. One defines the nuclear thickness function as

$$\begin{aligned} \widehat{T}_{A/B}({\varvec{x}})\equiv \int _{-\infty }^{\infty }\!\!\!\mathrm{d}z\, \rho _{A/B}({\varvec{x}},z), \end{aligned}$$
(89)

with

$$\begin{aligned} \int _{-\infty }^{\infty }\widehat{T}_{A/B}({\varvec{x}})\,\mathrm{d}{\varvec{x}}\!=\!1 \end{aligned}$$
(90)

where \(\rho _{A/B}({\varvec{x}},z)\) is the Wood–Saxon nuclear density distribution for the nuclei A and B. One then obtains the density of participants \(n_\mathrm{p}({\varvec{x}};b)\equiv n_\mathrm{p}^A({\varvec{x}};b)+n_\mathrm{p}^B({\varvec{x}};b)\) from

(91)

and the number density of binary collisions in the transverse plane as

$$\begin{aligned} n_\mathrm{c}({\varvec{x}};b)=AB\,\sigma ^\mathrm{in}_{NN}\,\widehat{T}_{A}({\varvec{x}}+{\varvec{b}}/2)\widehat{T}_{B}({\varvec{x}}-{\varvec{b}}/2), \end{aligned}$$
(92)

where \(\sigma ^\mathrm{in}_{NN}\) is the inelastic nucleon–nucleon cross-section. Since ECHO-QGP is not able to run with null energy density or if the thermal pressure is much smaller than the magnetic pressure, to ensure the stability of the code, we increase the initial energy density distribution by an additional small amount \(e_{min}\), negligible from the point of view of the dynamics of the system. We adopt Milne coordinates and we assume boost invariance along the \(\eta \) direction. The velocity components of the fluid are all null at the initial time \(\tau _0\), i.e. \(v^x\!=\!v^y\!=v^\eta \!=\!0\).

We compute the initial magnetic field following the approach adopted by Tuchin [23], i.e. we consider a magnetic field produced by an electric charge e moving parallel to the z-axis with a speed v having a Lorentz factor \( \gamma \gg 1\) as measured in the laboratory frame by an observer located at \({\varvec{r}}= z\hat{{\varvec{z}}} + {\varvec{b}}\), where \({\varvec{b}}\) is the distance from the z-axis in the transverse plane ( \({\varvec{b}}\cdot \hat{{\varvec{z}}} = 0 \)). We also assume a constant permittivity \(\epsilon =1\), a constant permeability \(\mu =1\), a constant finite electrical conductivity \(\sigma \). Under these assumptions, it can be shown that the magnetic field \(\mathbf {B}=B(t,{\varvec{r}})\hat{{\varvec{\phi }}}\) is given by

(93)

where \(x_\pm = t \pm v/z\) and \(e\!=\!\sqrt{4\pi \alpha }\), \(\alpha \) being the fine structure constant. We mention that the \(\mathbf {B}\) field has dimensions [\(\text {GeV}^{1/2}\text {fm}^{-3/2}\)], so that \(B^2\) has the same dimensions as the pressure, i.e. [\(\text {GeV}/\text {fm}^{3}\)].

Then we approximate the electric charge distribution inside the two colliding nuclei as being uniform and spherical and we perform an integration over it to get the total magnetic field in each point of our computational grid. We assume that the motion and the distribution of the electric charges are unaffected by the collision between the nuclei. A detailed description of the whole procedure can be found in Ref. [23]. Since at the moment our code is not able to handle configurations where the magnetic pressure is much larger than the thermal pressure, which is the case in regions outside the fireball, where the initial energy density is less than 30 \(\text {MeV}/\text {fm}^3\) we rescale the magnetic field so that the ratio between the magnetic and the thermal pressure does not exceed 0.1. This procedure does not affect the final results because at such a low temperature there is no participating QCD matter and the hydrodynamic description of the medium would cease to be valid anyway.

Table 3 Values of the parameters used in the setup of the 2D + 1 RMHD simulations of heavy-ion collisions
Fig. 8
figure 8

The initial spatial pressure distribution in the transverse plane, obtained using the geometrical Glauber model given by Eq. (88) with the parameters listed in Table (3). The parameters are for the reaction Au + Au, b = 10 fm at \(\sqrt{s_{NN}}=200\) GeV

Fig. 9
figure 9

The initial spatial distribution of the components of the magnetic field \(\mathbf {B}\), computed using the method described in Ref. [23]. The parameters are for the reaction Au + Au, \(b=10\) fm at \(\sqrt{s_{NN}}=200\) GeV

Our choices of the parameters for the initial conditions are summarized in Table 3. The initial distribution of the thermal pressure, the magnetic field and the ratio of thermal to magnetic pressure in the transverse plane are shown in Figs. 8, 9, and 10 for Au + Au, \(b=10\) fm reactions at \(\sqrt{s_{NN}}=200\) GeV.

We always use the same initial conditions for the initial energy density distribution, but for the initial magnetic field we consider two cases:

  1. 1.

    B = 0 (no magnetic field);

  2. 2.

    B \(\ne 0\) and \(\sigma =5.8\) MeV.

In the first case we consider a pure hydrodynamical simulation, without magnetic field. In the second case we assume that in the pre-equilibrium phase there is a medium with finite constant electrical conductivity \(\sigma =5.8\) MeV, which allows one to compute an initial magnetic-field distribution as in Ref. [23], shown in Fig. 9.

We assume that at the time \(\tau _0\) the fluid is in local thermal equilibrium, its electrical conductivity \(\sigma \) becomes infinite and that the magnetic field generated by the fast moving electric charges contained in the protons of the nuclei is converted into the magnetic field of the fluid, while, consistently with the hypothesis that initially the fluid is at rest and it has infinite electrical conductivity, we assume that there is no initial electric field in the fluid frame (otherwise, for Eq. (35), we should have also initial non-null fluid velocity). We neglect dissipative effects and we assume that the fluid obeys the \(e\!=\!p/3\) EoS.

We run the simulation until thermal freeze-out, when the energy density is below \(150\,\text {MeV}/\text {fm}^3\). Then we compute the spectra and the elliptic flow of the pions produced. Here we adopt the Cooper–Frye prescription [6, 60], without any modification to the distribution function due to the electromagnetic interaction.

5.2 Results

In Figs. 11 and 12 we compare the decay of the magnetic field in the ideal 2D + 1 RMHD simulation in the center of the of overlap region of the two nuclei (i.e. in the center of the grid: \(x\!=\!y\!=\!z=\!\eta \!=0\)) with some common analytical models. Figure 11 shows the comparison between the decay of the magnitude of B in the center of the grid during the 2D + 1 RMHD evolution and the decay expected for a Bjorken flow, following the analytic law \(\tau _0/\tau \). Figure 12 show the comparison of the time evolution of the magnitude of the magnetic field (in neutral pion mass units squared) at the center of the grid in five different cases:

  1. (a)

    ECHO-QGP 2D + 1 RMHD evolution starting from initial conditions as described in this section, with \(\sigma =5.8\) MeV;

  2. (b)

    time evolution of the magnetic field computed using the same approach exploited to provide the initial conditions (explained in detail in Ref. [23]), assuming a medium with uniform and constant electrical conductivity \(\sigma \!=\!5.8\) MeV;

  3. (c)

    same as in case b), but assuming zero electrical conductivity \(\sigma \!=\!0\) MeV (vacuum);

  4. (d)

    exponential decay of magnetic field as modeled in Ref. [61], with \(t_D\!=\!1.9\);

  5. (c)

    Bjorken flow.

Fig. 10
figure 10

The initial ratio \(1/\beta \!=\! B^2/2p\) between magnetic and thermal pressure in the transverse plane. The parameters are for the reaction Au + Au, \(b=10\) fm at \(\sqrt{s_{NN}}=200\) GeV

Fig. 11
figure 11

\(B/B_0=\sqrt{B_iB^i(\tau )}/\sqrt{B_iB^i(\tau _0)}\), with \(\tau _0=0.4\) fm/c. Comparison between the decay of the magnitude of B in the center of the grid during the 2D+1 RMHD evolution and the decay expected for a Bjorken flow, following the analytic law \(\tau _0/\tau \). The parameters are for the reaction Au + Au, \(b=10\) fm at \(\sqrt{s_{NN}}=200\) GeV

Fig. 12
figure 12

Comparison of the time evolution of the magnitude of the magnetic field (in neutral pion mass units squared) at the center of the grid in five different cases: a with ECHO-QGP, as described in this section, computing the initial conditions assuming \(\sigma =5.8\) MeV; b magnetic field generated by the electric charges of the two colliding nuclei moving in a medium with uniform and constant electrical conductivity \(\sigma \!=\!5.8\) MeV, i.e. the same approach exploited to provide the initial conditions (explained in details in Ref. [23]), but now adopted for the whole time interval; c same as in case b, but assuming zero electrical conductivity \(\sigma \!=\!0\) MeV (vacuum) d assuming an exponential decay of the magnetic field as modeled in Ref. [61], with \(t_D\!=\!1.9\) e) Bjorken flow. The parameters are for the reaction Au + Au, \(b=10\) fm at \(\sqrt{s_{NN}}=200\) GeV

Fig. 13
figure 13

\(v_2\) of \(\pi ^+\) in two cases: a Without magnetic field. b With an initial magnetic field computed assuming \(\sigma =5.8\) MeV. The parameters are for the reaction Au + Au, \(b=10\) fm at \(\sqrt{s_{NN}}=200\) GeV

Fig. 14
figure 14

Transverse momentum distribution of \(\pi ^+\) in two cases: a Without magnetic field. b With an initial magnetic field computed assuming \(\sigma =5.8\) MeV. The parameters are for the reaction Au + Au, \(b=10\) fm at \(\sqrt{s_{NN}}=200\) GeV

We notice that the expansion of the fluid in the transverse plane leads to a faster decrease compared to the case of a pure longitudinal Bjorken flow [56] and tends to become roughly exponential. However, the decay of the magnetic field of the fluid is still slower than in the case that the fields are generated by two electric charges moving in opposite directions in a uniform medium with constant finite electrical conductivity, as in Ref. [23], especially if there is no medium at all and the electric charge propagates in empty space. We stress that this comparison between different decay rates is based on a simplified model of HIC. In a 3D + 1 simulation, adopting a more realistic EoS and including dissipative effects, the decay rate of the B-field might be considerably quantitatively different.

In Figs. 13 and 14 we compare the elliptic flow and the transverse momentum distribution of pions, computed with the Cooper–Frye prescription [6, 60], with and without an initial magnetic field, computed as described in the previous section of this article. According to our current results, the presence of a magnetic field with a magnitude and spatial distribution evaluated according to Ref. [23] seems to have a negligible impact both on the pion spectra and on the elliptic flow. This is in contrast to Ref. [62] where was suggested that the magnetic field might substantially influence the anisotropic flow. In Ref. [63] it was indeed found that a significant enhancement of the elliptic flow might be possible. A direct comparison with our results is, however, not possible because of the many differences compared to our approach. However, in contrast to Refs. [62, 63] and the present study, Ref. [61] reported the opposite result, namely a reduction of the anysotropic flow. This was attributed to the effects of the magnetic squeezing. However, the model at Ref. [61] does not satisfy the divergence-free condition for the magnetic field. There the magnetic field has a rather large magnitude and it is not completely coupled with the fluid.

6 Conclusions, discussion, and outlook

We presented the extension of the ECHO-QGP code to the relativistic magneto-hydrodynamic regime, in the limit of infinite electrical conductivity, i.e. without taking into account any resistive effect. In the present version, the code has been tested with an ideal-gas EoS, either in the presence of a finite mass density or in the ultra-relativistic regime (\(p=e/3\)). After introducing the physics equations on which the code is based, we gave an overview of their numerical implementation. Then we illustrated the results of several tests to validate the implementation. Since our final aim is to exploit the code to study the evolution of the quark–gluon plasma formed in heavy-ion collisions, we showed first applications in this context, adopting simplified initial conditions.

Due to the (on average) small ratio of the magnetic to thermal pressure, the magnetic field does not seem to significantly affect the fluid evolution and we observed only a tiny effect on inclusive hadronic observables such as the elliptic flow and transverse momentum spectra of pions. However, in our approach the magnitude of the initial magnetic field could have been underestimated, possibly because in the pre-equilibrium phase we considered the electrical conductivity \(\sigma \) as constant, while there is some evidence that it increases with the temperature [64,65,66,67]. Other authors, employing different initial conditions for the magnetic field, found a non-negligible effect of the latter on the hadron elliptic flow [61,62,63]. Clearly this would affect the estimate of the viscosity-to-entropy \(\eta /s\) ratio obtained by comparison of hydrodynamic results with experimental data: if, for example, part of the hadron \(v_2\) in non-central collisions arose from the magnetic field, one should reduce the contribution from the hydrodynamic expansion, via for instance a larger value of \(\eta /s\).

Our preliminary results suggest also that the formation of a deconfined conductive plasma, compared to the case of the vacuum, might slow down the decay of the initial magnetic field generated by the colliding nuclei, possibly affecting non-perturbative phenomena relying on the presence of huge magnetic fields to show up. Since our study refers to the case of an ideal plasma, with infinite electrical conductivity, our results have to be considered as an upper limit on the lifetime of the magnetic field produced in heavy-ion collisions.

However, the recent estimates both from lattice QCD computations [64,65,66] and fitting of experimental data [67] point toward high, but finite value for the electrical conductivity of the QGP. For a quantitative comparison with experimental data this has to be taken into account including the effects of the electrical resistivity. We expect a considerably acceleration of the decay of the magnitude of the magnetic field compared to our studies.

As a next step, we plan to evaluate better the role of the initial magnitude and spatial distribution of the magnetic fields, performing full 3D + 1 simulations, already possible with the present setup. This will allow one to explore a broader range of possible initial conditions under different models [68], using a more realistic EoS.

The next development of the code will involve the inclusion of dissipative effects (shear and bulk viscosity and a finite electric conductivity), using the numerical techniques presented in [6, 34] and already implemented in previous versions of the ECHO code, going beyond the approximation of an ideal plasma. A major conceptual achievement would be represented by the inclusion in our setup of anomalous currents, allowing one to provide a consistent description of the CME and to estimate the possibility of disentangling it from other charge-separating effects related to the presence of strong electromagnetic fields.

Then, indeed, it would be necessary to modify the Cooper–Frye formula by taking into account the presence of an electromagnetic field and of a non-uniform spatial distribution of electric charges. After that, for a proper comparison with experimental data, one should compute the effects on the final particle spectra and on collective flows, in the post-freeze-out phase, of decays, elastic collisions and of magnetic deflections by the Lorentz force.

Finally, we deem that applications of numerical calculations performed with the present relativistic MHD version of the ECHO-QGP code could also be relevant for cosmological (generation of the primordial magnetic fields [69]) or astrophysical studies. For instance, the sudden transition from an hadronic to a QGP-like equation of state in a proto-magnetar (phase transition to a quark star) has recently been suggested as a possible explanation for the observed cases of (long) gamma-ray burst events with double prompt emission peaks [70].