1 Introduction

Relativistic hydrodynamics has been widely used for the description of macroscopic dynamics in various fields ranging from nuclear physics to astrophysics. The high-energy heavy-ion collision experiment is one of the active areas of relativistic hydrodynamics applications.

In 2005 at the relativistic heavy-ion collider (RHIC), the production of a strongly interacting quark–gluon plasma (QGP) was achieved, which was supported not only by the experimental data but also theoretical analyses [1]. Studies based on relativistic hydrodynamics have shown remarkable success in understanding various observables such as particle distributions, collective flows, particle correlations, and so on [25]. The strong elliptic flow at RHIC is a highlight of the success of hydrodynamic models and is one piece of evidence that the QGP is not a weakly interacting gas but strongly interacting matter. Since then the hydrodynamic model has been one of the promising phenomenological models for the description of dynamics of hot and dense matter produced in the heavy-ion collisions.

The construction of relativistic viscous hydrodynamic model has been of practical importance and has formed a basis for the analyses of the heavy-ion collisions [612]. In the last decade, the hydrodynamic model itself has also been developed through the analyses of experimental data of heavy-ion collisions at RHIC and the large hadron collider (LHC). By comparing the hydrodynamic model calculations and the experimental observables such as particle distributions and collective flows, detailed bulk properties of QGP such as the QCD equation of state and its transport coefficients have been investigated. Also, physical QCD equation of state is now available by lattice QCD simulations at vanishing chemical potential [13, 14] and is applied to the hydrodynamic model. This enables us to bridge the first principle lattice QCD simulations and the experimental data in the heavy-ion collisions.

In spite of the success of hydrodynamic models in high-energy heavy-ion collisions, there are still several issues under discussion. Currently the hydrodynamic models often adopt Israel–Stewart theory [15] and a second-order viscous hydrodynamics from AdS/CFT correspondence [16] as their basic equations. However, we have not reached a conclusion on which relativistic viscous hydrodynamic equation is suitable for the description of relativistic heavy-ion collisions. This is because the extension from a relativistic ideal hydrodynamic equation to a viscous hydrodynamic equation is not straightforward and several possible candidates exist. Also viscous second-order anisotropic hydrodynamics is proposed which reproduces the exact solution of the Boltzmann equation in the relaxation-time approximation [17]. Furthermore it remains an enormous challenge to understand why hydrodynamics can be applied to the dynamics shortly after a heavy-ion collision takes place. Conclusive understanding of the mechanism of thermalization and hydrodynamization on such a short time scale is still missing.

Here we emphasize that a numerical algorithm for solving the relativistic hydrodynamic equation is one of the important ingredients in developing the hydrodynamic models. Recent high statistical experimental data at RHIC and the LHC imposed a more rigorous numerical treatment on the hydrodynamical models. For example, at RHIC and the LHC, higher harmonic anisotropic flow, which is expressed by the higher Fourier coefficient of particle yields as a function of azimuthal angle, is reported [1822]. The origin of the higher harmonics is considered to be event-by-event initial fluctuations in the particle distributions. When comparing with those high statistical data, reducing the numerical dissipation of the numerical algorithm for relativistic hydrodynamic equations should allow us an access to more precise value of transport coefficients of the QGP. Usually each algorithm has advantages or disadvantages in terms of coding, computational time, numerical precision, and stability. Up to now, unfortunately, only little attention has been paid to the numerical aspects in the hydrodynamic models for high-energy heavy-ion collisions.

Recently we developed a state-of-the-art numerical algorithm for solving the relativistic hydrodynamic equation with the QGP equation of state [23]. In the algorithm, we use a Riemann solver based on the two-shock approximation [2528] which is stable under the existence of large shock waves [29]. The new numerical scheme is stable even with a small numerical viscosity and can reduce the numerical uncertainly when extracting the physical viscosity of the QGP from the experimental data. However, this algorithm in Ref. [23] is developed in Cartesian coordinates. Meanwhile, at the high-energy heavy-ion collisions such as RHIC and the LHC, the expansion in longitudinal direction is rapid compared with that in transverse direction. For the description of a space-time evolution of high-energy heavy-ion collisions, Milne coordinates are more suitable than Cartesian coordinates. Therefore we extend our algorithm of relativistic ideal hydrodynamics in Cartesian coordinates to that in Milne coordinates so that we can efficiently apply it to the analyses of high-energy heavy-ion collisions. The algorithm that we shall present here plays an important role in solving the relativistic viscous hydrodynamic equation numerically [23, 24]. For the viscous hydrodynamics, we split the hydrodynamic equations into an ideal part and a viscous part. The ideal part can be solved by the Riemann solver for ideal hydrodynamics.

The present article is organized as follows. We begin in Sect. 2 by showing the basic equations for the hydrodynamic models in Milne coordinates. In Sect. 3 we explain the numerical algorithm; the Riemann problem in Milne coordinates and our numerical scheme. Section 4 is devoted to several numerical tests, such as relativistic shock tubes and a comparison with analytic solutions which describe the dynamics of realistic high-energy heavy-ion collisions. In addition, we discuss the propagation of longitudinal fluctuations. In Sect. 5 we investigate the conservation property of our code. We end in Sect. 6 with our conclusions.

2 Relativistic hydrodynamics

Relativistic hydrodynamics is based on the conservation equations of net charge, energy, and momentum,

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

where \(J^{\mu }\) is the baryon number current and \(T^{\mu \nu }\) is the energy-momentum tensor. For the ideal fluid, the energy-momentum tensor and the baryon number current are given by

$$\begin{aligned} J^\mu&=n u^\mu , \end{aligned}$$
(3)
$$\begin{aligned} T^{\mu \nu }&=(e+p)u^\mu u^\nu - p g^{\mu \nu }, \end{aligned}$$
(4)

where n is the baryon number density, e is the energy density, p is the pressure, \(u^\mu \) is the normalized four-velocity of the fluid, \(u^\mu u_\mu =1\), and \(g^{\mu \nu }\) is the metric tensor.

In high-energy heavy-ion collisions at RHIC and the LHC, approximate invariance under the longitudinal Lorentz boost is observed in particle rapidity distributions around mid-rapidity [3036]. In such situations, Milne coordinates are suitable for the description of space-time evolution of the hot and dense matter after the collisions. Milne coordinates \(\eta \) and \(\tau \) are described by the rapidity \(\eta =\mathrm{tanh}^{-1} (z/t)\) and the proper time \(\tau = \sqrt{t^2 -z^2}\) with Cartesian coordinates. The coordinate transformation of the four-velocity between Milne coordinates and Cartesian coordinates is given by

$$\begin{aligned} u^\tau&=\mathrm{cosh}\eta u^t -\mathrm{sinh}\eta u^z , \end{aligned}$$
(5)
$$\begin{aligned} u^\eta&=-\frac{\mathrm{sinh}\eta }{\tau }u^t+\frac{\mathrm{cosh}\eta }{\tau }u^z , \end{aligned}$$
(6)

where the transverse components of the four-velocity, \(u^x\) and \(u^y\), are the same in both coordinates. The four-velocity in Milne coordinates is written by the three-dimensional velocity as

$$\begin{aligned} u^\alpha =(u^\tau , u^x, u^y, u^\eta )=W(1, w^x, w^y, w^\eta ), \end{aligned}$$
(7)

where \(w^i=u^i/u^\tau (i=x,y,\eta )\) is the three-dimensional velocity in Milne coordinates and W represents the Lorentz factor,

$$\begin{aligned} W=u^\tau =\left( 1- (w^x)^2 - (w^y)^2 - \tau ^2 (w^\eta )^2\right) ^{-1/2}. \end{aligned}$$
(8)

The coordinate transformation of the three-dimensional velocity vector between Milne coordinates and Cartesian coordinates is given by

$$\begin{aligned} w^\eta&= \frac{1}{\tau }\frac{-\mathrm{sinh}\eta +v^z\mathrm{cosh}\eta }{\mathrm{cosh}\eta - v^z\mathrm{sinh}\eta }, \end{aligned}$$
(9)
$$\begin{aligned} w^i&=\frac{v^i}{\mathrm{cosh}\eta -v^z \mathrm{sinh}\eta }, \quad (i=x, y). \end{aligned}$$
(10)

where \(v^i = u^i/u^t (i=x,y,z)\) is the three-dimensional velocity in Cartesian coordinates. In contrast to \(u^x\) and \(u^y\), the x and y components of the three-dimensional velocity in Milne coordinates are different from those in Cartesian coordinates. The metric tensor is given by \(g^{\alpha \beta }=\mathrm{diag}(1, -1,-1,-1/\tau ^2)\) and the nonzero components of the Christoffel symbols are

$$\begin{aligned} \Gamma ^{\eta }_{\eta \tau }=\Gamma ^\eta _{\tau \eta }=\frac{1}{\tau },\quad \Gamma ^\tau _{\eta \eta }=\tau . \end{aligned}$$
(11)

In Milne coordinates, the charge conservation equation Eq. (1) and the equation of energy and momentum conservation Eq. (2) are written by

$$\begin{aligned}&\partial _\tau J^\tau + \partial _i J^i+\partial _\eta J^\eta = -J^\tau /\tau , \end{aligned}$$
(12)
$$\begin{aligned}&\partial _\tau T^{\tau j} + \partial _i T^{ij} +\partial _\eta T^{\eta j} = - T^{\tau j}/\tau , \end{aligned}$$
(13)
$$\begin{aligned}&\partial _\tau T^{\tau \eta } +\partial _i T^{i\eta }+\partial _\eta T^{\eta \eta } = -3 T^{\tau \eta }/\tau ,\end{aligned}$$
(14)
$$\begin{aligned}&\partial _\tau T^{\tau \tau }+\partial _i T^{i\tau }+\partial _\eta T^{\eta \tau }= -T^{\tau \tau }/\tau -\tau T^{\eta \eta } . \end{aligned}$$
(15)

There are geometric source terms in the right-hand side of Eqs. (12)–(15), which contain the effect from the coordinate expansion with \(\tau \). One can rewrite Eqs. (12)–(15)

$$\begin{aligned}&\partial _\tau (\tau J^\tau ) + \partial _i(\tau J^i)+\partial _\eta (\tau J^\eta )=0 ,\end{aligned}$$
(16)
$$\begin{aligned}&\partial _\tau (\tau T^{\tau j}) + \partial _i (\tau T^{ij}) +\partial _\eta (\tau T^{\eta j}) =0 ,\end{aligned}$$
(17)
$$\begin{aligned}&\partial _\tau (\tau T^{\tau \eta } )+\partial _i (\tau T^{i\eta }) +\partial _\eta (\tau T^{\eta \eta } ) = -2 T^{\tau \eta } ,\end{aligned}$$
(18)
$$\begin{aligned}&\partial _\tau (\tau T^{\tau \tau })+\partial _i (\tau T^{i\tau })+\partial _\eta (\tau T^{\eta \tau })= -\tau ^2 T^{\eta \eta } . \end{aligned}$$
(19)

Here the effect from the coordinate expansion with \(\tau \) is absorbed into the Jacobian \(\tau \) in the derivative terms. There are the source terms in the right-hand side of Eqs. (18) and (19), which indicates that \(T^{\tau \tau }\) and \(T^{\tau \eta }\) are not the conserved quantities. Instead of them, the conserved quantities are \(T^{\tau t}\) and \(T^{\tau z}\). \(T^{\tau t}\) and \(T^{\tau z}\) are related to \(T^{\tau \tau }\) and \(T^{\tau \eta }\) through the coordinate transformation between Milne and Cartesian coordinates,

$$\begin{aligned} T^{\tau t}&= \mathrm{cosh}\eta T^{\tau \tau }+\tau \mathrm{sinh}\eta T^{\tau \eta },\end{aligned}$$
(20)
$$\begin{aligned} T^{\tau z}&= \mathrm{sinh}\eta T^{\tau \tau }+\tau \mathrm{cosh}\eta T^{\tau \eta }. \end{aligned}$$
(21)

Using the conserved quantities, \(T^{\tau t}\) and \(T^{\tau z}\), one can express the hydrodynamic equations in the conservative forms [37]

$$\begin{aligned}&\partial _\tau (\tau J^\tau ) + \partial _i(\tau J^i)+\partial _\eta (\tau J^\eta )=0, \end{aligned}$$
(22)
$$\begin{aligned}&\partial _\tau (\tau T^{\tau j}) + \partial _i (\tau T^{ij}) +\partial _\eta (\tau T^{\eta j}) =0,\end{aligned}$$
(23)
$$\begin{aligned}&\partial _\tau (\tau T^{\tau z} )+\partial _i (\tau T^{iz}) +\partial _\eta (\tau T^{\eta z} ) =0, \end{aligned}$$
(24)
$$\begin{aligned}&\partial _\tau (\tau T^{\tau t})+\partial _i (\tau T^{i t})+\partial _\eta (\tau T^{\eta t})=0. \end{aligned}$$
(25)

Here, Eq. (24) corresponds to the conservation of the z component of momentum. \(T^{\tau z}\) represents the density of the z component of momentum at specific proper time. \(T^{\eta z}\) represents the flux of the z component of momentum passing through the surface perpendicular to the \(\eta \) coordinate. Equation (25) corresponds to energy conservation. We construct a new algorithm for the relativistic hydrodynamic equations using Eqs. (22)–(25), which do not have source terms. In numerical tests, Sect. 4, we shall discuss the effects of the existence of source terms from the point of view of stability and numerical viscosity.

3 Numerical simulations in Milne coordinates

3.1 Riemann problem in Milne coordinates

The Riemann problem is an initial-value problem for the hydrodynamic equation. The initial condition is given by two arbitrary constant hydrodynamic states \({\varvec{V}}_L\) and \({\varvec{V}}_R\) separated by a discontinuity,

$$\begin{aligned} {\varvec{V}}(t=t_0, x,y,z)= \left\{ \begin{array}{ll} {\varvec{V}}_L &{} (z<z_i) ,\\ {\varvec{V}}_R &{} (z>z_i) , \end{array} \right. \end{aligned}$$
(26)

where \(t_0\) and \(z_i\) stand for an initial time and a location of the discontinuity, respectively. The hydrodynamic state \({\varvec{V}}= (n,v^x,v^y,v^z, p)\) contains information on the fluid variables, namely baryon number density, fluid velocities, and pressure. The initial discontinuity at \(z=z_i\) decays into three nonlinear waves [38, 39]. Two of them are shock waves and/or rarefaction waves. The other is a contact discontinuity moving with hydrodynamic flow. These waves evolve between the constant hydrodynamic states \({\varvec{V}}_L\) and \({\varvec{V}}_R\) with a constant velocity. The hydrodynamic states \({\varvec{V}}_L\) and \({\varvec{V}}_R\) do not change until characteristic information from the discontinuity arrives. Therefore, the hydrodynamic state outside the light cone of the discontinuity \((t_0, z_i)\) remains \({\varvec{V}}_L\) or \({\varvec{V}}_R\).

We can also define a Riemann problem in Milne coordinates. The initial condition of the Riemann problem in Milne coordinates is set to

$$\begin{aligned} {\varvec{V}}(\tau =\tau _0, x,y,\eta )= \left\{ \begin{array}{ll} {\varvec{V}}_L &{} (\eta <\eta _i) ,\\ {\varvec{V}}_R &{} (\eta >\eta _i) , \end{array} \right. \end{aligned}$$
(27)

where \(\tau _0\) and \(\eta _i\) are the initial proper time and the location of the discontinuity and they represent the same point as \((t_0, z_i)\) in Eq. (26) in Cartesian coordinates. Note that the components of \({\varvec{V}}\) are not \((n,w^x,w^y,w^\eta , p)\) but the same as those in Eq. (26), \((n,v^x,v^y,v^z, p)\). The velocity fields in Cartesian coordinates \(u^i/u^t=(v^x, v^y, v^z)\) are constant in the rapidity direction. However, the velocity fields in Milne coordinates \(u^i/u^\tau =(w^x, w^y,w^\eta )\) depend on rapidity. Now we show that the analytical solution for the Riemann problem in Milne coordinates is obtained from that in Cartesian coordinates by proper coordinate transformations, in which the key issue is to represent the hydrodynamic states as variables independent of \(\eta \).

Fig. 1
figure 1

The Riemann problem in Cartesian coordinates (a) and that in Milne coordinates (b). The solid circle stands for the initial discontinuity at \(z_i=0\) (a) and \(\eta _i=0\) (b). The thick solid lines indicate the hypersurfaces on which the initial conditions of the Riemann problems are defined. LC stands for the light cone that originates from the discontinuity

Now we compare the two initial-value problems Eqs. (26) and (27). Without loss of generality, we can assume that the initial discontinuity represented by the solid circle is located at \(z_i=\eta _i=0\) as in Fig. 1a, b. In Fig. 1a, the thick solid line stands for the time at which we define the initial condition of the Riemann problem in Cartesian coordinates, Eq. (26). In Milne coordinates, the initial condition of the Riemann problem is set on a hyperbola \(\tau =\tau _0\) as in Fig. 1b. By comparison between Fig. 1a, b, the hyperbola \(\tau =\tau _0\) in Milne coordinates is located inside the constant hydrodynamic state \({\varvec{V}}_L\) or \({\varvec{V}}_R\) in Cartesian coordinates. This suggests that the initial condition of Eq. (27) is satisfied by the solution of the Riemann problem in Cartesian coordinates Eq. (26). In brief, the Riemann problems in both coordinates are identical and thus so are their solutions. A detailed explanation as regards this proof is given in Appendix A.

Fig. 2
figure 2

The Lagrange step in Milne coordinates. The solid closed path represents the domain of integration in Eq. (29). The cell boundary at \((\tau _n, \eta _i)\) moves with fluid. \(\Delta \eta ^\mathrm{lag}_i\equiv \Delta \eta +(\delta \eta _i(\Delta \tau ) -\delta \eta _{i-1}(\Delta \tau ))\) is the Lagrange grid-cell size at the proper time \(\tau ^{n+1}\). See text for detailed explanation

3.2 Numerical scheme

3.2.1 \(\tau \)\(\eta \) system

Assuming that the hydrodynamic variables in the x and y directions are constant, from Eqs. (23)–(25) we obtain

$$\begin{aligned} \partial _\tau (\tau T^{\tau \nu }) +\partial _\eta (\tau T^{\eta \nu } )= 0, \end{aligned}$$
(28)

where \(\nu = t, x, y\) or z. If the transverse components of the four-velocity \(u^x\) and \(u^y\) are vanishing, Eq. (28) expresses the one-dimensional longitudinal expansion. In our numerical scheme, we utilize the Lagrange step [40] in which the grid-cell boundary itself moves together with the hydrodynamic flow during a time step from \(\tau ^n\) to \(\tau ^{n+1}=\tau ^n+\Delta \tau \). We discretize Eq. (28) by space-time integration in a grid cell based on the Lagrangian approach (Fig. 2),

$$\begin{aligned} \int _{\tau ^n}^{\tau ^{n+1}}\int ^{\eta _{i+1}+\delta \eta _{i+1}(\tau ')}_{\eta _i+\delta \eta _i(\tau ')} \partial _\alpha (\tau T^{\alpha \nu }) \mathrm{d}\eta \mathrm{d}\tau =0, \end{aligned}$$
(29)

where \(\alpha =\tau \) or \(\eta \). Here \(\eta _i\) is the location of the ith grid-cell boundary at the proper time \(\tau ^n\), \(\delta \eta _i(\tau ')\) expresses a moving distance of the grid-cell boundary from \(\tau =\tau ^n\) to \(\tau =\tau ^n+\tau '\) \((0\le \tau '\le \Delta \tau )\), and \(\eta _i + \delta \eta _i(\tau ')\) indicates the location of the ith grid-cell boundary at the proper time \(\tau \). The center of the ith grid cell is located at \(\eta _i +\Delta \eta /2\) at \(\tau = \tau ^n\), where \(\Delta \eta =\eta _i -\eta _{i-1}\). Using Gauss’ theorem for integration of Eq. (29), we find the value of \(T^{\tau \nu }\) of the ith grid cell at the next time step \(\tau ^{n+1}\),

$$\begin{aligned} ( T^{\tau \nu } )^{n+1}_i&=\frac{\tau ^n\Delta \eta }{\tau ^{n+1} \Delta \eta _i^{\mathrm{lag}}} ( T^{\tau \nu })^n_i - \frac{1}{\tau ^{n+1} \Delta \eta _i^{\mathrm{lag}}} \nonumber \\&\quad \times \left[ \int _{C_i} T^{\alpha \nu }n_{\alpha ,i} \mathrm{d}s -\int _{C_{i-1}}T^{\alpha \nu }n_{\alpha ,i-1}\mathrm{d}s \right] , \end{aligned}$$
(30)

where \(\Delta \eta ^\mathrm{lag}_i\equiv \Delta \eta +(\delta \eta _i(\Delta \tau ) -\delta \eta _{i-1}(\Delta \tau ))\) is the Lagrange grid-cell size at the proper time \(\tau ^{n+1}\), \(C_i\) is the trajectory of the Lagrange grid-cell boundary at \(\eta _i\) and \(n_{\alpha , i}\) is the unit normal vector to \(C_i\) (Fig. 2). The average values of the conserved quantities in the grid cell at the proper times \(\tau ^n\) and \(\tau ^{n+1}\) are defined, respectively, by

$$\begin{aligned} ( T^{\tau \nu })^{n}_i&\equiv \frac{1}{\Delta \eta }\int ^{\eta _{i}}_{\eta _{i-1}} T^{\tau \nu }(\tau ^n,\eta ) \mathrm{d}\eta ,\end{aligned}$$
(31)
$$\begin{aligned} ( T^{\tau \nu })^{n+1}_i&\equiv \frac{1}{\Delta \eta _i^{\mathrm{lag}}}\int ^{\eta _{i}+\delta \eta _i(\Delta \tau )}_{\eta _{i-1}+\delta \eta _{i-1}(\Delta \tau )} T^{\tau \nu }(\tau ^{n+1},\eta ) \mathrm{d}\eta . \end{aligned}$$
(32)

The second term of Eq. (30) indicates the flux of the conserved quantities passing through the grid-cell boundary.

Using the analytical solution of the Riemann problem in Milne coordinates, we evaluate the \(\Delta \eta _i^\mathrm{lag}\) and the flux term in Eq. (30). The grid-cell boundary corresponds to the initial discontinuity in the Riemann problem and moves together with the contact discontinuity in the solution of the Riemann problem. This indicates that the physical quantities on the trajectory \(\delta \eta _i(\tau ')\) are given by those on the contact discontinuity. We obtain the moving distance \(\delta \eta _i(\Delta \tau )\) of the grid-cell boundary

$$\begin{aligned} \delta \eta _i(\Delta \tau )= \frac{1}{2}\mathrm{log} \left( \frac{(1+V^z_{0,i})\delta t(\Delta \tau ) + \tau ^n}{(1-V^z_{0,i})\delta t (\Delta \tau )+ \tau ^n}\right) , \end{aligned}$$
(33)

using \(\delta t(\Delta \tau )\)

$$\begin{aligned} \delta t(\Delta \tau )&=\frac{1}{1-(V^z_{0,i})^2}\biggl \{ -\tau ^n \nonumber \\&\quad +\sqrt{(\tau ^n)^2 +(1-(V_{0,i}^z)^2) (2\tau ^n\Delta \tau +{\Delta \tau }^2)}\biggr \}. \end{aligned}$$
(34)

In Eqs. (33) and (34), \(V_{0.i}^z\) is the velocity of the grid-cell boundary at \(\eta _i\) seen from an observer sitting at \(\eta =\eta _i\) in Milne coordinates. In the construction of algorithm, we use the Lorentz boost transformation which is explained in the next paragraph. Here we show the explicit form of Eq. (30). For a detailed derivation of it please see Appendix B. Up to the third order in \(\Delta \tau \), the flux terms are given by

$$\begin{aligned}&\int _{C_i} T^{\alpha t}n_{\alpha ,i} \mathrm{d}s =P_i(\mathrm{sinh}\eta _i+V^z_{0,i}\mathrm{cosh}\eta _i ) \Biggl \{ \Delta \tau \nonumber \\&\quad +\frac{(V^z_{0,i})^2}{2\tau ^n}\Delta \tau ^2+\frac{1}{2(\tau ^n)^2}\left( (V^z_{0,i})^4 -(V^z_{0,i})^2\right) \Delta \tau ^3 \Biggr \}, \end{aligned}$$
(35)
$$\begin{aligned}&\int _{C_i} T^{\alpha z}n_{\alpha ,i} \mathrm{d}s =P_i(\mathrm{cosh}\eta _i+V^z_{0,i}\mathrm{sinh}\eta _i )\Biggl \{ \Delta \tau \nonumber \\&\quad +\frac{(V^z_{0,i})^2}{2\tau ^n}\Delta \tau ^2+\frac{1}{2(\tau ^n)^2}\left( (V^z_{0,i})^4 -(V^z_{0,i})^2\right) \Delta \tau ^3 \Biggr \} , \end{aligned}$$
(36)
$$\begin{aligned}&\int _{C_i} T^{\alpha j}n_{\alpha ,i} \mathrm{d}s = 0 ,\quad j=x,y, \end{aligned}$$
(37)

where \(P_i\) is the pressure on the cell boundary located at \(\eta _i\).

From now we explain the numerical algorithm for solving the discretized equation Eq. (30). We express the hydrodynamic variables in Milne coordinates as \({\varvec{W}}\equiv (n, w^x, w^y, w^\eta , p)\). The first step is the interpolation procedure in which the left and right hydrodynamic states at the grid-cell boundary \({\varvec{W}}_{S,i}=(n_{S,i}, w^x_{S,i},w^y_{S,i},w^\eta _{S,i}, p_{S,i})\) \((S=L,R)\) are determined from the reconstruction of the distribution of volume-averaged hydrodynamic variables \({\varvec{W}}\) in a grid cell. If a linear interpolation method is used for the reconstruction of the distribution of hydrodynamic variables, second-order accuracy is achieved (the MC limiter [40]). For third-order accuracy, we need to utilize a quadratic curve (the piecewise parabolic method (PPM) [28, 41, 42]) in reconstruction of the distribution of hydrodynamic states. For the test calculation in the next section, we use the PPM. Next, using the constructed left and right states \({\varvec{W}}_{S,i}\) in Milne coordinates, we prepare the initial condition of the Riemann problem in terms of \({\varvec{V}}_{S,i}\) in Cartesian coordinates. To obtain \({\varvec{V}}_{S,i}\), we move a grid cell to \(\eta =0\) with the Lorentz boost transformation and perform the coordinate transformation to \({\varvec{V}}\). Here \({\varvec{W}}\) is invariant under the Lorentz boost transformation. Using these relations, \(v^{x,y}=w^{x,y}\) and \(v^z = \tau w^\eta \) at \(\eta =0\), we obtain

$$\begin{aligned} {\varvec{V}}_{S,i}= (n_{S,i}, w^x_{S,i},w^y_{S,i},\tau w^\eta _{S,i}, p_{S,i}) . \end{aligned}$$
(38)

In the second step, we solve the Riemann problem Eq. (26) with the initial condition Eq. (38). \(P_i\) and \(V^z_{0,i}\) in Eqs. (33)–(37) are determined by the analytical solution of the Riemann problem.Footnote 1 For solving the Riemann problem we employ the two-shock approximation [2528]. In the approximation, we can avoid solving the ordinary differential equation for the rarefaction wave which takes a lot of computational time in the multidimensional problem. The numerical procedure of this step depends on the equation of state. The Riemann solution with the QCD equation of state is described in Ref. [23]. After solving the Riemann problem, we perform the inverse Lorentz transformation to the original frame. Here \(\Delta \eta ^\mathrm{lag}_i\) is Lorentz invariant. The flux terms Eqs. (35)–(37) are defined on the original frame but written in terms of \(V^z_{0,i}\).

In the third step, solving the discretized hydrodynamic equation Eqs. (30), (33)–(37) with the values of \(P_i\) and \(V_{0,i}^z\), we obtain distribution of the conservative quantities \(T^{\tau \nu }(\nu =t,x,y,z)\) at the next time step using the Lagrange scheme. We remap the grids which move in the Lagrange step on the Eulerian coordinate [40].Footnote 2

In the final step, we construct the primitive variables \({\varvec{W}}\) from the conserved quantities [23]. We obtain \(T^{\tau \alpha }(\alpha = \tau ,x,y,\eta )\) from \(T^{\tau \mu }(\mu =t,x,y,z)\) from the coordinate transformation. The numerical method for construction of \({\varvec{W}}\) from \(T^{\tau \alpha }\) is the same as that in Ref. [23].

3.2.2 (3 + 1)-dimensional systems

The one-dimensional code is easily extended to a multidimensional code by the Strang splitting method [43], that is to say, multidimensional hydrodynamic evolution is realized by successive one-dimensional hydrodynamic calculations. To avoid counting the expansion effect of coordinates more than once, we extract one-dimensional hydrodynamic equations from Eqs. (12)–(15), which have source terms in the right-hand side. Then we rewrite each one-dimensional hydrodynamic equation as that without the source terms.

To be explicit, we express Eqs. (13)–(15) as

$$\begin{aligned} \partial _\tau T^{\tau \alpha } + \partial _i T^{i \alpha } + \partial _\eta T^{\eta \alpha }=S^\alpha , \end{aligned}$$
(39)

where the source term \(S^\alpha \) is given by

$$\begin{aligned} S^\alpha =\left( -\frac{1}{\tau }T^{\tau \tau } -\tau T^{\eta \eta }, - \frac{1 }{\tau }T^{\tau x}, - \frac{1}{\tau }T^{\tau y}, -\frac{3}{\tau }T^{\tau \eta } \right) . \end{aligned}$$
(40)

Applying the dimensional splitting method to Eq. (39), we obtain the one-dimensional hydrodynamic equations,

$$\begin{aligned}&\partial _\tau T^{\tau \alpha }+\partial _x T^{x\alpha } =0, \end{aligned}$$
(41)
$$\begin{aligned}&\partial _\tau T^{\tau \alpha }+\partial _y T^{y\alpha } =0, \end{aligned}$$
(42)
$$\begin{aligned}&\partial _\tau T^{\tau \alpha }+\partial _\eta T^{\eta \alpha }=S^\alpha . \end{aligned}$$
(43)

Solving the one-dimensional equations Eqs. (41)–(43) successively, we carry out the (3 + 1)-dimensional calculations.

For expansion in the rapidity direction, transforming Eq. (43) into Eq. (28), we use the algorithm mentioned in Sect. 3.2.1. In the x and y directions, we use the same algorithm in Cartesian coordinates in Ref. [23]. For example, for expansion in the x direction, we discretize Eq. (41) as explained in Sect. 3.2.1,

$$\begin{aligned} ( T^{\tau \tau } )^{n+1}_i&=\frac{\Delta x}{\Delta x_i^{\mathrm{lag}}} ( T^{\tau \tau })^n_i \nonumber \\&\quad - \frac{\Delta \tau }{\Delta x_i^{\mathrm{lag}}}\left( P_iV^x_{0,i} -P_{i-1}V^x_{0,i-1} \right) , \end{aligned}$$
(44)
$$\begin{aligned}&( T^{\tau x} )^{n+1}_i =\frac{\Delta x}{\Delta x_i^{\mathrm{lag}}} ( T^{\tau x})^n_i - \frac{\Delta \tau }{\Delta x_i^{\mathrm{lag}}}\left( P_i -P_{i-1} \right) , \end{aligned}$$
(45)
$$\begin{aligned}&( T^{\tau y} )^{n+1}_i =\frac{\Delta x}{\Delta x_i^{\mathrm{lag}}} ( T^{\tau y})^n_i, \end{aligned}$$
(46)

where \(P_i\) and \(V^x_{0,i}\) are determined by the solution of the Riemann problem whose initial condition is given by Eq. (38). The grid-cell size after the Lagrange step is given by

$$\begin{aligned} \Delta x^\mathrm{lag}_i=\Delta x + (V^x_{0,i} - V^x_{0,i-1}) \Delta \tau . \end{aligned}$$
(47)

Using the operator \(L^k_i\) which represents one-dimensional evolution in the i direction during the proper time \(k\Delta \tau \), two-dimensional expansion in \((x,\eta )\) coordinates is given by \(L^k_x\) and \(L^k_\eta \),

$$\begin{aligned} (\varvec{T}^{\tau \alpha })^{n+1}=L^{1/2}_x L_\eta ^1 L_x^{1/2} (\varvec{T}^{\tau \alpha })^n. \end{aligned}$$
(48)

Similarly the three-dimensional expansion in \((x,y,\eta )\) coordinates is written by

$$\begin{aligned} (\varvec{T}^{\tau \alpha })^{n+1}&=L^{1/6}_x L^{1/6}_y L_\eta ^{1/3}L^{1/6}_y L_x^{1/3} L_\eta ^{1/6} L_y^{1/3} L_x^{1/6} \nonumber \\&\quad \times L_\eta ^{1/3} L_x^{1/6} L_y^{1/3} L_\eta ^{1/6} L_x^{1/6} (\varvec{T}^{\tau \alpha })^n. \end{aligned}$$
(49)

3.3 The Courant–Friedrichs–Lewy condition

The Courant–Friedrichs–Lewy (CFL) condition helps us determine an appropriate time-step size in solving partial differential equations. The CFL condition is determined so that the numerical propagating speed on the grid is larger than the physical propagating speed,

$$\begin{aligned} \frac{\tau \Delta \eta }{\Delta \tau } > \tau |w^\eta _c| , \end{aligned}$$
(50)

where \(\Delta \eta /\Delta \tau \) and \(w_c^\eta \) are the numerical signal velocity and the characteristic velocity in the rapidity direction, respectively. Note that the proper time \(\tau \) is multiplied for a dimensionless expression. This condition is important for the stability of the numerical calculations. If the CFL condition Eq. (50) is written as a function of the characteristic velocity in z direction \(v^z_c\),

$$\begin{aligned}&\frac{\tau \Delta \eta }{\Delta \tau }> \left| \frac{-\mathrm{sinh}\eta - |v^z_c|\mathrm{cosh}\eta }{\mathrm{cosh}\eta + |v^z_c| \mathrm{sinh}\eta }\right| \quad \text {for } \ \eta >0,\end{aligned}$$
(51)
$$\begin{aligned}&\frac{\tau \Delta \eta }{\Delta \tau } > \left| \frac{-\mathrm{sinh}\eta +|v^z_c|\mathrm{cosh}\eta }{\mathrm{cosh}\eta - |v^z_c| \mathrm{sinh}\eta }\right| \quad \text {for } \eta <0, \end{aligned}$$
(52)

the CFL condition in Milne coordinates has a rapidity dependence. At large rapidity the right-hand side of Eqs. (51) and (52) approaches 1, which is the same condition as that in the case of \(|v^z_c|=1\). Therefore the CFL condition in Milne coordinates is determined by

$$\begin{aligned} \frac{\Delta \tau }{\tau \Delta \eta } < 1. \end{aligned}$$
(53)

Equation (53) indicates that the proper time of the denominator is larger, a possible time-step size \(\Delta \tau \) is larger. With these considerations, we define the Courant number as

$$\begin{aligned} C\equiv \frac{\Delta \tau }{\tau _0\Delta \eta }\quad (0<C<1), \end{aligned}$$
(54)

with an initial proper time \(\tau _0\).

Fig. 3
figure 3

Comparison between the analytical solution (solid line) and the numerical calculations for the shock tube problem at \(\tau = 5\) fm. The initial discontinuity is located at \(\eta =0\). Top left the energy density distribution as a function of \(\eta \). Top right the velocity distribution \(w^\eta \) as a function of \(\eta \). Bottom the velocity distribution \(v^z\) as a function of \(\eta \)

Fig. 4
figure 4

Comparison between the analytical solution (solid line) and the numerical calculations for the shock tube problem at \(\tau = 5\) fm. The initial discontinuity is located at \(\eta =1\). Top left the energy density distribution as a function of \(\eta \). Top right the velocity distribution \(w^\eta \) as a function of \(\eta \). Bottom the velocity distribution \(v^z\) as a function of \(\eta \)

3.4 Boundary conditions

When we numerically solve partial differential equations and update the value of a cell, the values of its neighboring cells are necessary. For the cell on the boundary of hydrodynamic grid, we need to prepare additional cells which are called ghost cells and put appropriate information to them. In the next section we shall discuss several numerical tests using our code; shock tube problems in Milne coordinates, expansion of matter to the vacuum, Landau–Kahlatnikov solution, fluctuations in longitudinal expansion, Gubser flow, and the conservation property. For the shock tube problem in Milne coordinates, we input an analytical solution as a boundary condition at the ghost cells. For the numerical test of expansion of matter to the vacuum, we use the physical values of the vacuum at the cell on the boundary. We employ the periodic boundary condition for the investigation of fluctuations in longitudinal expansion. For the Landau–Khalatnikov solution and the Gubser flow, we copy the values of the cells on the boundary onto those of the ghost cells.

In addition, we point out that in some cases we need a careful procedure at the boundary. For example, for the shock tube problem in Milne coordinates, we use the MC limiter at the boundary and ghost cells to reduce numerical errors which originate from inward flow at the boundary. In the expansion of matter to the vacuum, we observe that a numerical instability occurs at the discontinuity between matter and the vacuum. To stabilize the difficulty we employ the minmod limiter which is dissipative and smears out discontinuities compared to the MC limiter.

4 Numerical tests

We employ several problems to check correctness of the numerical algorithm in Milne coordinates. For one-dimensional tests, we analyze with our code the Riemann problem and Landau–Khalatnikov solution [4446] in order to verify our Riemann solver. The Landau–Khalatnikov solution is used for understanding the experimental data of the particle rapidity distributions in the high-energy heavy-ion collisions. Next we discuss propagation of fluctuations around Bjorken flow. We derive analytical solutions from linearized hydrodynamics and compare them to numerical calculations with our code. For multidimensional tests, we use the Gubser flow [47, 48], which gives us a three-dimensional hydrodynamic expansion of hot and dense matter created after the high-energy heavy-ion collisions. In the test problems we use the ideal gas equation of state, \(e=3p\).

4.1 Riemann problem

4.1.1 Shock tubes

Using the property that the initial-value problem of Eq. (27) in Milne coordinates is the same as the Riemann problem in Cartesian coordinates, we carry out the shock tube test in Milne coordinates. We solve the initial-value problem of Eq. (27) with our numerical scheme in Milne coordinates and compare the numerical results with the analytical solution of the Riemann problem Eq. (26). The analytical solution of the Riemann problem in Milne coordinates is obtained by the coordinate transformation from that in Cartesian coordinates [38, 39] (see Appendix C).

We perform test calculations in two cases. In the first case we set the discontinuity at \(\eta =0\) and in the second case we put it at \(\eta =1\) at the initial time \(\tau _0=1\) fm. In the first test problem, the temperature in \(\eta >0\) (\(\eta <0\)) is set to \(T_L=400 ~\mathrm{MeV}\) (\(T_R=200 ~\mathrm{MeV}\)) and in both regions the z component of the velocity \(v^z\) is vanishing. In our numerical scheme, we directly calculate the time evolution of the rapidity component of the velocity \(w^\eta \), instead of \(v^z\). The transformation between \(v^z\) and \(w^\eta \) is given by Eq. (9), which suggests that \(w^\eta \) is not vanishing even if \(v^z=0\). The initial condition of \(w^\eta \) is given by \(w^\eta =\frac{1}{\tau _0}\frac{-\mathrm{sinh}\eta }{\mathrm{cosh}\eta }\), which has an \(\eta \) dependence. We perform the numerical calculations with grid size \(\Delta \eta =0.01\) and time-step size \(\Delta \tau =0.1 \tau _0\Delta \eta \). Figure 3 shows the energy density distribution, the velocity \(w^\eta \), and the velocity \(v^z\), which is transformed by Eq. (9) from \(w^\eta \) as a function of rapidity \(\eta \) together with the analytical solutions (solid lines). The rarefaction wave moves to the negative direction from \(\eta =0\) and the shock wave moves to the positive direction from \(\eta =0\). Our numerical results are consistent with the analytical solutions.

For the second numerical test, we put the initial discontinuity at \(\eta \not =0\). Other conditions, \(T_L\), \(T_R\) and \(v^z\) are the same as those in the first test calculation. In Cartesian coordinates the first and second numerical tests are essentially identical. In Milne coordinates, however, the second numerical problem is different from the first problem, because the \(w^\eta \) depends on \(\eta \) differently from the first problem. The energy density distribution e, the velocity distribution \(w^\eta \), and the velocity distribution \(v^z\) are shown in Fig. 4. Again, our numerical calculations show good agreement with the analytical solutions in the second numerical test.

4.1.2 Expansion of matter into the vacuum

As one of the specific problems of the Riemann problem, we consider the one-dimensional expansion of matter into the vacuum; a rarefaction wave appears at the discontinuity and expands between the matter and the vacuum [49]. This problem is useful for a realistic description of expansion of the QGP and hadronic matter into the vacuum in the high-energy heavy-ion collisions. We set the initial condition to

$$\begin{aligned} p= & {} 1000 \;\mathrm{fm}^{-4}, \quad w^\eta = -\frac{\mathrm{sinh}\eta }{\mathrm{cosh}\eta } \quad \mathrm{for}\quad |\eta | \le 1.5, \nonumber \\ p= & {} 0, \quad w^\eta =0, \quad \mathrm{for} \quad |\eta |>1.5, \end{aligned}$$
(55)

where \(w^\eta \) in \(|\eta | \le 1.5\) corresponds to \(v^z=0\) in Cartesian coordinates and in \(|\eta | > 1.5\) lies the vacuum. Setting the vacuum for the boundary condition as in Eq. (55), one can avoid the matter from flowing into the system through the boundaries. In the shock tube problems in Milne coordinates in Sect. 4.1.1, the matter comes in through the boundaries, which is a possible source of numerical error.

Here we discuss the importance of description of the hydrodynamic equation in the conservative form in developing numerical algorithm. For the investigation, we discretize the hydrodynamic equation with the source terms Eq. (43) and construct a code based on the same procedure explained in Sect. 3.2.1. In the code, \(T^{\tau \tau }\) and \(T^{\tau \eta }\) are updated in the Lagrange step, instead of \(T^{\tau t}\) and \(T^{\tau z}\). Then we compare the results of the code without the source terms, Eq. (28), and those with the source terms. In both numerical calculations the grid size \(\Delta \eta \) and the time-step size are set to 0.02 and \(0.1\tau _0 \Delta \eta \), respectively. The hydrodynamic expansion starts at \(\tau _0=1\) fm.

Fig. 5
figure 5

The numerical results of codes with and without the source terms and the analytical solution (the solid line) of \(w_\eta \) as a function of \(\eta \) for the expansion into vacuum at \(\tau =1.1\) fm

Fig. 6
figure 6

The numerical results of codes with and without the source terms of the energy density (top left), \(w^\eta \) (top right) and \(v^z\) (bottom) distributions as a function of \(\eta \) together with the analytical solution (solid line) for the expansion into vacuum at \(\tau =4\) fm

Figure 5 shows the \(w^\eta \) distribution as a function of \(\eta \) at \(\tau =1.1\) fm. In \(0<\eta <1.46\), the matter is at rest in Cartesian coordinates, which corresponds to the negative flow in Milne coordinates. In \(1.46<\eta <1.58\), the rarefaction wave starts to expand; it propagates with the sound velocity inward the matter at rest in Cartesian coordinates and expands with the speed of light to the vacuum. In the rarefaction wave the steep velocity gradient is produced, where both of the codes with and without the source terms cannot reproduce the analytical result, though the code without the source terms is closer to the analytical solution.

Figure 6 shows the numerical results of the energy density, \(w^\eta \) and \(v^z\) distributions as a function of \(\eta \) together with the analytical solution at later time \(\tau =4\) fm. In \(|\eta |<0.27\) the velocity \(v^z\) is vanishing in Cartesian coordinates, which indicates the negative \(w^\eta \) in Milne coordinates. In \(0.27<|\eta |<2.89\) the rarefaction wave is spreading and at \(\eta =\pm 2.89\) the boundary to the vacuum exits, which moves out to the vacuum at the speed of light. For the energy density distribution, both codes with and without the source terms reproduce the analytical solution, though near the boundary between the matter and the vacuum a small difference between them is observed. In both codes, the value of \(w^\eta \) around the boundary is larger than that of the analytical solution near the boundary. The stronger flow near the boundary in the numerical solution causes the smaller energy density compared with the analytical solution. On the other hand, there is no difference between the behaviors of \(v^z\) of both codes. The stability of numerical calculation is sensitive to the differences in \(w^\eta \) of codes which are seen near the boundary between matter and the vacuum, because at the boundary pressure becomes zero and the Lorentz factor becomes infinity in the analytical solution.

Fig. 7
figure 7

The L1 norm of the energy density e (top panel) and the velocity \(w^\eta \) (bottom panel) for the expansion into vacuum as a function of number of cell for the codes with and without the source terms

To investigate the numerical accuracy of the codes with and without the source terms, we calculate the L1 norm which is defined by

$$\begin{aligned} L(u,N_\mathrm{cell})=\sum _{i} \left| u(\eta _i;N_\mathrm{cell}) -u_\mathrm{exact}(\eta _i)\right| \Delta \eta , \end{aligned}$$
(56)

where u is the energy density e or the rapidity component of the velocity \(w^\eta \), \(\Delta \eta \) is a grid-cell size. Using Eq. (56), we evaluate the deviation of the numerical results \(u(\eta _i ; N_\mathrm{cell})\) from the exact solutions. At the same time we can know the convergence speed to the exact solution of numerical algorithm. In Fig. 7, the L1 norms of energy density and \(w^\eta \) are shown. In both energy density and velocity, the values of the L1 norm of the code without the source terms are smaller than those with the source terms, which means that the code without the source term has smaller numerical viscosity than that with the source terms. As expected, the existence of the source terms produces more artificial viscosity.

If the initial discontinuity is set at the larger rapidity, this makes the velocity slope at rarefaction wave larger and gives more severe problems to the codes in Milne coordinates. We find that the code without the source terms is more stable than that with the source terms. For example, if we set the initial discontinuity at \(\eta =1.7\), we find that numerical instability occurs in the code with the source terms.

4.2 Landau–Khalatnikov solution

We employ the Landau–Khalatnikov solution [4446] as a one-dimensional numerical test problem. The initial condition of it is expressed by a thin slab of hot and dense matter created after the collisions, which is the same as the problem discussed in Sect. 4.1.2. In the expansion of the slab of matter, two rarefaction waves travel into the slab from both sides and start to overlap at the center of the slab. The region where rarefaction waves overlap is described by the Landau–Khalatnikov solution. The asymptotic form of the Landau–Khalatnikov solution for sufficiently later time \(\tau \gg \Delta \) is written by

$$\begin{aligned} e=e_0\mathrm{exp}\left\{ -\frac{4}{3}\left[ 2\mathrm{ln}\left( \frac{\tau }{\Delta }\right) -\sqrt{\mathrm{ln}\left( \frac{\tau }{\Delta }\right) ^2-\eta ^2}\;\right] \right\} \end{aligned}$$
(57)

and \(w^\eta =0\), where \(\Delta \) is the thickness of the slab. The asymptotic solution Eq. (57) is used for an investigation of the rapidity distributions of the produced particles at RHIC [5055].

Fig. 8
figure 8

The analytical and numerical results of the energy density distribution for the Landau–Khalatnikov solution with \(\Delta \tau =\) 0.1 and 5 fm. From the top, the energy density distributions are at \(\tau =510, 600, 700\) and 1000 fm

In the numerical calculation, we start the simulation at \(\tau _0=500\) fm with the initial condition given by Eq. (57), where \(e_0\) and the thickness size are set to 10 GeV/fm\(^3\) and \(\Delta = 0.5\) fm, respectively. The numerical calculation is performed with the grid size \(\Delta \eta =0.1\), the time-step size \(\Delta \tau =0.1\) fm and \(\Delta \tau =0.1 \tau _0\Delta \eta =5\) fm, which is determined by the CFL condition in Sect. 3.3. Figure 8 shows the energy density distributions at \(\tau =\) 510, 600, 700, and 1000 fm together with the analytical solution. Calculations with the time-step sizes \(\Delta \tau =5\) fm and 0.1 fm can explain the analytical solution, which suggests that the computational time can be saved if the time-step size is determined by the CFL condition in Sect. 3.3. There is a small deviation between numerical calculations and the analytical solution at large \(|\eta |\), which implies that the asymptotic form of the Landau–Khalatnikov solution Eq. (57) cannot be applicable at large rapidity [45, 46].

Fig. 9
figure 9

Analytical and numerical results for the propagation of fluctuations around Bjorken flow at \(\tau = 4\), 5, and 6 fm (\(D > 0\)). The numerical calculation is done with the grid size \(\Delta x=0.1256\) fm and the time-step size \(\Delta \tau = 0.1\tau _0\Delta \eta \)

Fig. 10
figure 10

Analytical and numerical results for the propagation of fluctuations around Bjorken flow at \(\tau = 4\), 5 and 5.694 fm (\(D<0\)). The numerical calculation is carried out with the grid size \(\Delta x=0.01\) fm and the time-step size \(\Delta \tau = 0.1\tau _0\Delta \eta \)

4.3 Propagation of longitudinal fluctuations around Bjorken flow

The longitudinal fluctuation in particle distributions and collective flows is one of the interesting topics in high-energy heavy-ion collisions at LHC [56]. For instance, the propagation of fluctuations around Bjorken flow in heavy-ion collisions are investigated from linear analyses [7, 57]. The small longitudinal fluctuations around Bjorken flow propagate according to the following linearized equations:

$$\begin{aligned}&e=e_B+\delta e, \quad w^\eta =\delta w^\eta ,\end{aligned}$$
(58)
$$\begin{aligned}&\partial _\tau \delta e+ (1+\lambda )e_B \partial _\eta \delta w^\eta +\frac{1+\lambda }{\tau }\delta e =0, \end{aligned}$$
(59)
$$\begin{aligned}&\partial _\tau \delta w^\eta +\frac{\lambda }{1+\lambda } \frac{1}{\tau ^2 e_B}\partial _\eta \delta e+\frac{2-\lambda }{\tau } \delta w^\eta =0. \end{aligned}$$
(60)

Here \(\quad e_B=e_0\left( \frac{\tau _0}{\tau }\right) ^{1+\lambda }\) is the energy density from Bjorken’s scaling solution [58] for the equation of state \(p=\lambda e\).Footnote 3

Since the background is rapidity independent, we can obtain solutions with a definite wave number \(\delta e, \delta w^\eta \propto e^{ik\eta }\). The solutions consist of two modes, as Eq. (60) is essentially a second-order ordinary differential equation in the k-space. The nature of the modes depends on the sign of \(D \equiv (1-\lambda )^2-4k^2\lambda \ne 0\). For \(D>0\) the fluctuations do not propagate but just attenuate, while for \(D<0\) the fluctuations propagate as well as attenuate. The condition for \(D=0\) is satisfied by \(k = (1- c_s^2)/2 c_s\), where \(c_s = \sqrt{\lambda }\) is the sound velocity. General solutions of the linearized equations including the case \(D=0\) are given in Appendix D.

Here we compare the analytical solutions and the numerical calculation with our hydrodynamic code for two cases, \(D>0\) and \(D<0\). In both cases, we choose initial conditions so that we can single out a particular mode of attenuation (\(D>0\)) and propagation (\(D<0\)). To be specific, for \(D>0\) we choose

$$\begin{aligned}&\delta e(\tau ,\eta ) = A\left( \frac{\tau }{\tau _0}\right) ^{(-3-\lambda -\sqrt{D})/2} \mathrm{sin}(k\eta ), \end{aligned}$$
(61)
$$\begin{aligned}&\delta w^\eta (\tau ,\eta ) = \frac{\lambda - 1-\sqrt{D}}{2ke_0(1+\lambda )\tau _0 } A \left( \frac{\tau }{\tau _0}\right) ^{(-3+\lambda -\sqrt{D})/2 } \mathrm{cos}(k\eta ), \end{aligned}$$
(62)

and for \(D<0\)

$$\begin{aligned} \delta e(\tau ,\eta )&= A\left( \frac{\tau }{\tau _0}\right) ^{-(3+\lambda )/2} \mathrm{sin}(k\eta -\theta ), \end{aligned}$$
(63)
$$\begin{aligned} \delta w^\eta (\tau ,\eta )&= \frac{A}{2ke_0(1+\lambda ) \tau _0}\left( \frac{\tau }{\tau _0}\right) ^{(\lambda -3)/2} \nonumber \\&\quad \times \left[ (\lambda -1)\mathrm{cos}(k\eta -\theta ) + \sqrt{-D} \mathrm{sin}(k\eta -\theta ) \right] , \end{aligned}$$
(64)

where \(\theta \) is defined by \(\theta \equiv \frac{1}{2}\sqrt{-D}\mathrm{log}(\tau /\tau _0)\). The phase velocity of the fluctuation is \(\sqrt{-D}/(2k\tau )\).

We set the initial time to \(\tau _0=1\) fm and use the ideal gas equation of state, \(e=3p\) and \(\lambda =1/3\). The initial energy density \(e_0\) in Bjorken flow is given by \(e_0= 1000\) \(\mathrm{fm}^{-4}\). In the case of \(D>0\), we choose \(k=0.5\), \(D=0.111\) and \(A=0.1\) \(\mathrm{fm}^{-4}\). In the case of \(D<0\), we choose \(k =2\pi \), \(D=-52.193\) and \(A=0.1\) \(\mathrm{fm}^{-4}\).

Figures 9 and 10 show the analytical and numerical results of the fluctuations of the energy density and the velocity around Bjorken flow for \(D>0\) and \(D<0\). In the numerical calculation, we use the periodic boundary condition. When the value of D is positive, the fluctuation does not propagate and its amplitude decreases with time (Fig. 9). On the other hand, when the value of D is negative, the fluctuation propagates and its amplitude decreases with time (Fig. 10). However, if we chose different initial conditions such that more than one mode were involved, the amplitude of the fluctuation would at first grow and then reduce for both \(D>0\) and \(D<0\) due to the interference of two modes. The similar amplification of the fluctuations around Bjorken flow is reported in Ref. [57]. Our numerical results show good agreement with the analytical solutions.

Fig. 11
figure 11

Comparison between the analytical solution and the numerical calculation of the energy density e for the Gubser flow. Top at \(\tau =2\) and 3 fm, bottom at \(\tau =5\) and 7 fm

Fig. 12
figure 12

Comparison between the analytical solution and the numerical calculations of transverse velocity \(w^\bot \) for the Gubser flow at \(\tau =2,3,5\), and 7 fm

4.4 Gubser flow

An analytic solution to the relativistic, conformally invariant Navier–Stokes equation is constructed based on symmetry considerations in \((\tau , \eta , x_\bot , \phi )\) coordinate system [47, 48]. The Gubser flow and its related solutions are utilized for checking or improvement of hydrodynamic codes [12, 5964]. The solution is a generalization of Bjorken flow where the medium expands both longitudinally and radially, which gives us a realistic description of the space-time evolution of high-energy heavy-ion collisions. According to the solution for an inviscid fluid, the transverse or radial velocity \(w^\bot \) and energy density e are given by

$$\begin{aligned}&w^\bot =\frac{u^\bot }{u^\tau }=\frac{2q^2\tau x_\bot }{1+q^2\tau ^2+q^2x_\bot ^2} , \end{aligned}$$
(65)
$$\begin{aligned}&e =\frac{\hat{e_0}}{\tau ^{4/3}}\frac{(2q)^{8/3}}{[1+2q^2(\tau ^2+x_\bot ^2)+q^4(\tau ^2 -x_\bot ^2 )^2]^{4/3}}, \end{aligned}$$
(66)

where \(\hat{e_0}\) is a dimensionless integration constant, q is an arbitrary dimensional constant with the unit of inverse length of the system size [47, 48].

We compare our numerical calculations and the analytical solution in Figs. 11 and 12. In our numerical calculation, the parameters are set to \(q=1\) fm\(^{-1}\) and \(\hat{e_0} =400\). The hydrodynamic expansion starts at \(\tau _0=1\) fm. The numerical simulation is performed with the grid size \(\Delta x=\Delta y=0.05\) fm, \(\Delta \eta =0.1\) and the time-step size \(\Delta \tau = 0.1 \Delta x\). First the consistency between our numerical calculations and the analytical solution suggests the Strange splitting method in Sect. 3.2.2 works correctly. In the Gubser flow, the existence of the initial transverse flow is at the origin of the strong transverse flow at later time. To reproduce the strong transverse flow in the Gubser flow, we find that a careful choice of the interpolation method is required in the numerical calculation. For example, if the second-order interpolation method is employed, the energy density around \(x=0\) fm of the numerical calculations is larger than that of the analytical solutions. However, if we use the PPM interpolation method, we can reproduce the analytical solutions numerically. It is discussed in Appendix E.

Table 1 The violation of the total energy and momentum conservation

5 Conservation property

We check the energy and momentum conservation of our code. The conserved quantities in our algorithm in Milne coordinates are given by \(\tau T^{\tau \nu } (\nu = t,x,y,z)\). Their time evolution in our algorithm is schematically written by

$$\begin{aligned} \tau ^{n+1}(T^{\tau \nu })^{n+1}_i = \tau ^n(T^{\tau \nu })^{n}_i - \frac{\Delta \tau }{\Delta \eta }(F^\nu _i - F^\nu _{i-1}), \end{aligned}$$
(67)

where \(F^\nu _i\) represents the flux of the conserved quantities which flow into and out of ith grid cell during \(\Delta \tau \). Equation (67) contains two steps: the Lagrange and remap steps. Integrating Eq. (67) on all spatial grids, we obtain

$$\begin{aligned} \sum _{i=i_{min}}^{i_{max}} \tau ^{n+1} (T^{\tau \nu })^{n+1}_i =&\sum _{i=i_{min}}^{i_{max}}\tau ^n(T^{\tau \nu })^{n}_i \nonumber \\&- \frac{\Delta \tau }{\Delta \eta }(F^\nu _{i_{max}} - F^\nu _{i_{min}-1}), \end{aligned}$$
(68)

which suggests that the total variation of the conserved quantities depends on the amount of inflow and outflow from the boundary. If the equations with the source terms, Eqs. (16)–(19), are used in the code, the right-hand side of Eq. (68) has an additional term from the source terms, which can spoil the conservation property and affects the numerical accuracy in application to physical problems.

Here we focus on the effects of existence of the source terms in Milne coordinates on conservation property. We perform our numerical calculation with the initial energy density and flow distributions which are usually used in study of the relativistic heavy-ion collisions,

$$\begin{aligned} e(\tau _0, \eta )&= e_0\mathrm{exp}\left[ -\frac{(|\eta _s| - \eta _\mathrm{flat}/2)^2}{\sigma _\eta ^2} \theta ( |\eta | - \eta _\mathrm{flat}/2) \right] \nonumber \\&\quad \times \theta (Y_b - |\eta |) , \end{aligned}$$
(69)
$$\begin{aligned} w^\eta (\tau _0, \eta )&= 0 , \end{aligned}$$
(70)

where \(Y_b=5.3\) is the beam rapidity, \(\sigma _\eta =2.1\) and \(\eta _\mathrm{flat}=2.6\) show the size of the flat structure of the initial energy density distribution in the rapidity, and \(e_0=30\;\mathrm{GeV/fm}^3\) is the maximum value of the energy density. We choose a typical parameter set which is tuned for the RHIC collision energy [61, 65]. To discuss the source-term effect in Milne coordinates clearly, we carry out the numerical calculation only in the rapidity direction. In Ref. [61] one calculates the total energy and entropy in the beginning and at the end of 3D hydrodynamic evolution, using the Glauber model with a limited rapidity profile for an initial condition. From comparison between them they find that the energy is conserved on a level of better than 3 \(\%\) in their code.

To check the conservation property of our code, we evaluate the total energy and momentum in the hydrodynamic expansion,

$$\begin{aligned} E(\tau ^n )&= \tau ^n \Delta \eta \sum _\mathrm{all \;grid} (T^{\tau 0}) ^n_i, \end{aligned}$$
(71)
$$\begin{aligned} M(\tau ^n)&= \tau ^n \Delta \eta \sum _\mathrm{all \; grid} (T^\mathrm{\tau z})^n_i. \end{aligned}$$
(72)

We carry out a numerical calculation from \(\tau _0=1\) fm to \(\tau = 10\) fm on \(\Delta \eta =0.02, 0.1, 0.2,\) and 0.5 grid sizes with \(\Delta \tau = 0.1 \tau _0 \Delta \eta \) time-step size. The total momentum in the beginning is vanishing in the numerical precision. We observe that in the case where the source terms are explicitly included, the total energy and momentum increase with the proper time \(\tau \) monotonically on \(\Delta \eta =0.5\). On other grid sizes, first the total energy and momentum increase with \(\tau \) and after some time steps they start to decrease. If there are no source terms, sometime the total energy and momentum increase and at other times they decrease. This behavior suggests that the simple comparison between total conserved quantities in the beginning and those at the end is not suitable for an investigation of the conservation property. Instead of the simple comparison, we evaluate the violation of the energy and momentum conservation at each time step and sum it from the beginning to the end,

$$\begin{aligned} \varepsilon _E&\equiv \sum _\mathrm{all\; step} \frac{|E(\tau ^n) - E(\tau ^{n-1})|}{E(\tau _0)}, \end{aligned}$$
(73)
$$\begin{aligned} \varepsilon _M&\equiv \sum _\mathrm{all\; step} \frac{|M(\tau ^n) - M(\tau ^{n-1})|}{|M(\tau _0)|}. \end{aligned}$$
(74)

We show the calculated results of them in Table 1. We find that the numerical calculation based on the equations without the source terms keeps the energy and momentum conservation with high accuracy compared with that with source terms on every grid size. In the case where the source terms are explicitly included, enough numerical accuracy is still kept, but the amount of the violation of the conservation property increases with grid size. On the other hand, in the numerical algorithm with the conservative form, it does not depend on the grid size. Even on a coarse grid, the conservation property is kept with very high accuracy.

Fig. 13
figure 13

The numerical results for longitudinal expansion with the fluctuating initial condition at \(\tau =10\) fm. Top panel the energy distributions from the codes with the conservative form and with the source terms. The dotted line stands for the initial energy distribution. Bottom panel the velocity distribution from the codes with the conservative form and with the source terms. The dotted line stands for the initial velocity distribution

Next we investigate the total energy and momentum conservation in the hydrodynamic evolution which starts from a fluctuating initial condition. We add the fluctuation to the energy density and velocity distributions in Eqs. (69) and (70),

$$\begin{aligned} e(\tau _0,\eta )&= e^\mathrm{flat}(\tau _0,\eta ) \nonumber \\&\quad \times \left( 1+\sum _{n=0}^{10} \delta e_n \mathrm{cos} \left( n\frac{2\pi (\eta - \eta _n^e)}{L}\right) \right) , \end{aligned}$$
(75)
$$\begin{aligned} w^\eta (\tau _0,\eta ) =&\sum _{n=0}^{10}\delta w^\eta _n \mathrm{cos}\left( n\frac{2\pi (\eta - \eta _n^v)}{L}\right) , \end{aligned}$$
(76)

where \(e^\mathrm{flat}\) is given by Eq. (69) and values of \(\eta ^e_n\) and \(\eta ^v_n\) are chosen between \(\eta =-Y_b\) and \(Y_b\) at random. We set \(\delta e_n=0.05\) and \(\delta w^\eta =0.05\) fm\(^{-1}\) for all n. We carry out numerical calculations with the grid size \(\Delta \eta =0.2\), which is often chosen in calculations of high-energy heavy-ion collisions [61]. We set the time-step size equal to \(\Delta \tau =0.1\tau _0\Delta \eta \). In Fig. 13 the energy density and velocity distributions at \(\tau =10\) fm with and without the source terms are shown. At the mid-rapidity the energy density and the flow distributions of numerical calculations with and without the source terms are consistent with each other. In the region of \(|\eta |>4\), however, the differences between them are observed in the small structure of both distributions. The growth of the velocity to the vacuum \(|\eta | \sim 8\) gives a difficulty of numerical calculation and becomes the reasons for the differences.

Table 2 The violation of the total energy and momentum conservation with fluctuating initial conditions. The initial total energy and momentum are \(E_0=2224\) GeV and \(M_0=-94\) GeV

The deviation from the energy and momentum conservation are listed in Table 2. For both cases, we find that they are around ten times as large as those with the smoothed initial condition. Nevertheless, the code based on the conservative form keeps conservation property with high accuracy. On the other hand, in the code with the source terms a few % deviation from the energy and momentum conservation appears, which is still acceptable. In the code with the source terms, numerical calculation with fine grid size is indispensable for the energy and momentum conservation. There exist other ingredients which can cause additional error, and violation of the conservation property originates from the geometric source term, for instance shock waves and jets in medium [6668]. In addition, the existence of the viscosity can be the origin of the breakdown of the conservation property [61]. To avoid such problems, we need to construct the codes based on constitutive equations with the conservative form or perform numerical calculations on sufficiently fine grids.

6 Summary

We constructed a new Godunov type relativistic hydrodynamic code in Milne coordinates based on the algorithm in Cartesian coordinates [23]. We evaluated the flux terms, using the numerical solution of the Riemann problem with the initial condition at the constant proper time \(\tau \). We checked the correctness of our algorithm from the comparison between numerical calculations and analytical solutions of shock tube, expansion of matter into the vacuum, the Landau–Khalatnikov solution, propagation of fluctuation around Bjorken flow and the Gubser flow. We investigated the energy and momentum conservation of our code from a calculation of the longitudinal hydrodynamic expansion with an initial condition for high-energy heavy-ion collisions.

In particular, we focused on the effects of the source terms in relativistic numerical hydrodynamics in Milne coordinates on stability and numerical viscosity. We analyzed those effects in the test problems of expansion into the vacuum and the conservation property. In expansion of matter into the vacuum, we showed that numerical results from the code without the source terms closer to the analytical solution compared with that with source terms. Besides, the code without the source terms is more stable and has less numerical viscosity than the code with the source terms. In addition, we observed that the code written in the conservative form keeps the conservation property with high accuracy in the expansion from the fluctuating initial longitudinal profile for high-energy heavy-ion collisions, even on a coarse grid.

Our algorithm is easily extended to the code with the QCD equation of state and finite viscosities [23, 24]. After that, we shall employ our hydrodynamic code to investigate experimental results at RHIC and LHC and understand the detailed QGP bulk property using a reliable 3D relativistic viscous hydrodynamic expansion with small numerical viscosity.