EDUCATION Revista Mexicana de F´ısica E 59 (2013) 28–50 JANUARY–JUNE 2013

Exact solution of the 1D problem in Newtonian and relativistic hydrodynamics

F. D. Lora-Clavijo, J. P. Cruz-Perez,´ F. Siddhartha Guzman,´ and J. A. Gonzalez´ Instituto de F´ısica y Matematicas,´ Universidad Michoacana de San Nicolas´ de Hidalgo, Edificio C-3, Cd. Universitaria, 58040 Morelia, Michoacan,´ Mexico.´ Received 10 August 2012; accepted 15 February 2013

Some of the most interesting scenarios that can be studied in astrophysics, contain fluids and plasma moving under the influence of strong gravitational fields. To study these problems it is required to implement numerical algorithms robust enough to deal with the equations describing such scenarios, which usually involve hydrodynamical shocks. It is traditional that the first problem a student willing to develop research in this area is to numerically solve the one dimensional , both Newtonian and relativistic. Even a more basic requirement is the construction of the exact solution to this problem in order to verify that the numerical implementations are correct. We describe in this paper the construction of the exact solution and a detailed procedure of its implementation.

Keywords: Hydrodynamics-astrophysical applications; hydrodynamics-fluids.

PACS: 95.30.Lz; 47.35.-i

1. Introduction mentation of the solution. We focus on the solution of the problem and omit some of the mathematical background that High energy astrophysics has become one of the most impor- is actually very well described in the literature. tant subjects in astrophysics because it involves phenomena The paper is organized as follows. In Sec. 2 we present associated to high energy radiation, modeled with sources the Newtonian Riemann problem and how to implement it; traveling at high speeds or sources under the influence of in Sec. 2 we present the exact solution to the relativistic case strong gravitational fields like those due to black holes or and how to implement it. Finally in Sec. 3 we present some compact stars. Current models involve a hydrodynamical de- final comments. scription of the luminous source, and therefore hydrodynam- ical equations have to be solved. In this scenario, due to the complexity of the system of 2. Riemann problem for the Newtonian Euler equations it is required to apply numerical methods able to equations control the physical discontinuities arising during the evolu- tion of initial configurations, for example the evolution of the The Riemann problem is an initial value problem for a gas front shock in a supernova explosion, the front shock of a jet with discontinuous initial data, whose evolution is ruled by propagating in space, the edges of an accretion disk, or any Euler’s equations. The set of Euler’s equations determine the shock formed during a violent process. The study of these evolution of the density of gas, its velocity field and either its systems involve the implementation of advanced numerical pressure or total energy. A comfortable way of writing such methods, being two of the most efficient and robust ones the equations involves a flux balance form as follows high resolution shock capturing methods and smooth particle hydrodynamics which are representative of Eulerian and La- ∂tu + ∂xF(u) = 0 (1) grangian descriptions of hydrodynamics, each one with pros T T and cons. where u = (u1, u2, u3) = (ρ, ρv, E) is a set of conser- It is traditional that a first step to evaluate how appropri- vative variables and F is a flux vector, where ρ is the mass ate the implementation of a numerical method is, requires the density of the gas, v its velocity and E = ρ((1/2)v2 + ε), comparison of numerical results with an exact solution in a with ε the specific internal energy of the gas. The enthalpy simple situation. The simplest problem in hydrodynamics is of the system is given by the expression H = (1/2)v2 + h, the 1D Riemann problem. This is an excellent test case be- where h is the specific internal enthalpy given by h = ε+p/ρ, cause it has an exact solution in the Newtonian case (e.g. [1]) where p is the pressure of the gas. The fluxes are explicitly and also in the relativistic regime [2,3], where codes deal- in terms of the primitive variables ρ, v, p and the conservative ing with high Lorentz factors are expected to work properly. variables [1] From our experience we have found that the existent liter-     ature about the construction of the exact solution is not as u2 ρv 2 2  1 u2  explicit as it may be expected by students having their first   (3 − Γ) + (Γ − 1)u3 F(u)= ρv + p =  2 u1  . contact with this subject. This is the reason why we present u3 v(E + p) u2 1 2 Γ u u3 − 2 (Γ − 1) 2 a paper that is very detailed in the construction and imple- 1 u1 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 29

The initial data of the Riemann problem is defined as fol- coordinates (x, t) with the combination (x − x0)/t; it can be lows seen that such behavior implies that the following conditions ½ hold [4] u , x < x u = L 0 uR, x > x0, du1 du2 du3 i = i = i (5) r1 r2 r3 where uL and uR represent the values of the gas properties on a chamber at the left and at the right from an interface where i indicates the component of a given eigenvector. On the other hand, the Rankine Hugoniot conditions relate states between the two states at x = x0 that exists only at initial time. on both sides of a shock wave or a contact discontinuity The evolution of the initial data is described by the char- ∆F = V ∆u, (6) acteristic information of the system of equations, and this is why the properties of the Jacobian are impor- which are simply jump conditions, where ∆u is the size of tant. The Jacobian matrix of the system of equations is the discontinuity in the variables, V is the velocity of either A(u) = ∂F/∂u and explicitly reads the contact discontinuity or shock and ∆F is the change of   the flux across the discontinuity. 0 1 0  1 2  A = 2 (Γ − 3)v (3 − Γ)v Γ − 1 . 2.1. Contact discontinuity waves 3 ΓvE ΓE 3 2 (Γ − 1)v − ρ ρ − 2 (Γ − 1)v Γv The contact discontinuity is described by the second eigen- Its eigenvalues satisfy the condition λ1(u) < λ2(u) < λ3(u) vector and evolves with velocity λ2. Let us then analyze the and are given by second eigenvector. In this case the Riemann invariant con- ditions read λ = v − a (2) 1 dρ d(ρv) dE = = . λ = v (3) 1 2 2 1 v 2 v

λ3 = v + a (4) These relations implies that d(ρε) = dv = 0, further imply- p ing that p = constant and v = constant across the contact where a = (∂p/∂ρ)|s is the speed of sound in the gas, wave. In order to relate the two sides from the contact dis- which depends on the equation of state. For the ideal gas continuity we use the Rankine-Hugoniot conditions, which p = ρε(Γ − 1), where Γ is the ratio between the specific are given by heats at constantp pressure and volume Γ = cp/cv, the speed of sound is a = (Γp/ρ). On the other hand, the eigenvec- ρLvL − ρRvR = Vc(ρL − ρR), (7) tors of the Jacobian matrix read ρ v2 + p2 − ρ v2 + p2 = V (ρ v − ρ v ), (8)   L L L R R R c L L R R 1 vL(EL + pL) − vR(ER + pR) = Vc(vL(EL + pL) r1 =  v − a  , H − av − vR(ER + pR)). (9)     1 1 Here Vc is the velocity of propagation of the contact discon- r2 =  v  , r3 =  v + a  . tinuity. 1 2 0 2 v H + av The discontinuity travels at speed λ = v therefore the Vc = v. For this reason from Eq. (7) follows that vL = vR The eigenvectors r1, r2, r3 are classified in the following = Vc. As a consequence of this, Eq. (8) gives the condition way: pL = pR, which implies (9) is satisfied. Notice that no con- • they are called genuinely non-linear when satisfy the dition on the density arises, which allows the density to be discontinuous. condition ∇uλi · ri(u) 6= 0.

• and linearly degenerate when ∇uλi · ri(u) = 0. 2.2. Rarefaction waves

It happens that r2 is linearly degenerate and represents At this point we do not know the nature of waves 1 and 3, and a contact discontinuity, however the other two are genuinely we can assume they may be rarefaction waves. Once again non-linear. we use the Riemann invariant equalities, which for vectors 1 Depending on the particular region of the solution we and 3 read will use both the Riemann invariant conditions for rarefaction dρ d(ρv) dE waves and the Rankine Hugoniot conditions for shocks and = = , 1 v − a H − av contact discontinuities. The Riemann invariants are based on dρ d(ρv) dE the self-similarity property of the solution in some regions, = = . in the sense that the solution depends on the spatial and time 1 v + a H + av

Rev. Mex. Fis. E 59 (2013) 28–50 30 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

Manipulation of these equalities results in the following a useful expression for vR arises equations "µ ¶ Γ−1 # 2a p 2Γ dρ ρ v = v − L R − 1 . (19) = − for λ , (10) R L Γ − 1 p dv a 1 L dρ ρ The only unknown quantity is p . = for λ , (11) R dv a 3 On the other hand, when the wave is moving to the right dε p we assume we know the information at the state at the right = for both λ and λ . (12) dρ ρ2 1 3 from the wave, then we search for expressions of the vari- ables on the state at the left. For the velocity we find accord- The next step is to integrate these equations assuming an ing to (16) equation of state, in our case the ideal gas. From (12) we 2 obtain v = v − [a − a ], (20) L R Γ − 1 R L p = KρΓ (13) and the speed of sound on both sides obeys where K is a constant. A rarefaction process is isentropic µ ¶ Γ−1 2Γ (unlike a shock), and therefore the states at the left and at the pL aL = aR , (21) right from the wave obey (13) with the same constant K. pR Using this expression for p in the speed of sound we have p p which finally implies a = KΓρΓ−1 = Γp/ρ, which substituted into (10,11) " µ ¶ Γ−1 # results in 2Γ Z 2aR pL p 2a vL = vR − 1 − . (22) v = ± KΓρΓ−3dρ + k = ± + k, (14) Γ − 1 pR Γ − 1 The only unknown quantity in this case is p . where + stands for the wave moving to the right (the case of L The rarefaction zone has a finite size, bounded by two λ and r corresponding to a rarefaction wave) and − when 3 3 curves, the tail and the head. The head of the wave is the line moving to the left (the case of λ and r corresponding to 1 1 of the front of the wave and the tail is the boundary left be- a rarefaction wave), where k is an integration constant and hind the wave. The region in the middle is called the fan of therefore the velocity is constant as well. This property al- the rarefaction wave. lows us to set relations between the velocity of the gas on The velocity of all the particles between the head and the the state at the left and at the right from the rarefaction wave, tail obeys the following expression explicitly there are two possible cases: x − x0 i) When the wave is moving to the left, condition (14) = v ± a, (23) t implies that where + is used when the wave is propagating to the right 2aL 2aR and the - when it is moving to the left. Then, when the vL + = vR + . (15) Γ − 1 Γ − 1 wave is moving to the left, using this expression we have a = v − (x − x )/t, which substituted into (19) provides ii) When the wave is moving to the right, condition (14) R R 0 the following expression for the velocity of the gas on the implies state at the right from the wave is 2a 2a · ¸ v − L = v − R (16) 2 1 x − x L Γ − 1 R Γ − 1 v = a + (Γ − 1)v + 0 . (24) R Γ + 1 L 2 L t When the wave is moving to the left, we assume informa- Then it is possible to calculate the pressure and density tion from the left state is available and we look for expression as well. Substituting (24) into (15) and (18) we obtain an of the variables on the state to the right from the wave. For the expression for the pressure also at the state to the right velocity of the fluid at the right state we then have from (15) · µ ¶¸ 2Γ Γ−1 2 2 Γ − 1 x − x0 vR = vL − [aR − aL], (17) pR=pL + vL− . (25) Γ − 1 Γ + 1 aL(Γ + 1) t nowp considering thatp the speed of sound on both sides obeys Now, using this into (13) implies the expression for the den- a = KΓρΓ−1 = Γp/ρ (see (13)) sity

µ ¶ Γ−1 · µ ¶¸ 2 2Γ Γ−1 pR 2 Γ − 1 x − x0 aR = aL , (18) ρR=ρL + vL− . (26) pL Γ + 1 aL(Γ + 1) t

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 31 ¡ ¢ ˆ 2 Then finally we have expressions for the velocity, pressure ER = ρR (1/2)ˆvR + εR . These expressions correspond to and density on the state at the right when the wave is moving the Rankine Hugoniot jump conditions measured by an ob- to the left. server located in the rest frame of the shock wave. Similarly when the wave is moving to the right we have From Eq. (30), we introduce the mass flux definition from (23) that aL = vL + (x − x0)/t, which substituted into (22) implies the following for the velocity on the state at j = ρLvˆL = ρRvˆR. (33) the left from the wave · ¸ Then, from Eq. (31) and the mass flux definition before men- 2 1 x − x0 tioned, we can get an expression for j, which is given by vL = −aR + (Γ − 1)vR + . (27) Γ + 1 2 t p − p p − p j = − R L = − R L , (34) In order to obtain the expressions for the pressure and the vˆR − vˆL vR − vL density, we substitute this last expressions into (16) in order which is a consequence of j being invariant under Galilean to relate the speeds of sound, and then using (21) we finally transformations. Considering the shock is moving to the left, obtain the expression for the pressure at the left we would be interested in constructing the variables on the · µ ¶¸ 2Γ Γ−1 state at the right from the shock and we can start with the 2 Γ − 1 x − x0 pL=pR − vR− . (28) velocity, which can be written as Γ + 1 aR(Γ + 1) t pR − pL Finally using the Eq. (13) we obtain the density vR = vL − . (35) j · µ ¶¸ 2 Γ−1 2 Γ−1 x−x0 Now, in order to express the velocity in terms of the pressure ρL=ρR − vR− . (29) Γ+1 aR(Γ+1) t and the variables of the state at the left from the shock, we can rewrite (33) as follows In this way we have relations between the variables on to the state at the left and at the right from a rarefaction wave. These j j vR − S = , vL − S = . (36) relations will be useful when solving the Riemann problem. ρR ρL

2.3. Shock waves Thus, substituting this into (34) we obtain

2 pR − pL Similar to the previous case, the shock can move either to j = − 1 1 . (37) ρ − ρ the right (if λ3 and r3 correspond to a shock wave) or to the R L left (if λ1 and r1 correspond to a shock wave), and for each On the other hand, using Eq. (32) and the expression for the of the two cases there is known and unknown information. specific internal enthalpy h we can easily get the following When a shock is moving to the right one is expected to have expression for the difference of internal specific enthalpies information of the state at the right from the shock and con- £ ¤ versely, when the shock is moving to the left one accounts 1 2 2 hR − hL = vˆL − vˆR , (38) with information of the state at the left. 2

Shocks require the use of Rankine Hugoniot condi- where hL = εL + pL/ρL and hR = εR + pR/ρR. Now, tions (6). We express these conditions in terms of the primi- from Eqs. (30) and (31) we give expressions for the veloci- tive variables as follows tites measured by the observer located in the rest frame of the shock wave ρLvL − ρRvR = S(ρL − ρR), 2 ρL pL − pR 2 2 vˆR = , ρLvL + pL − ρRvR − pR = S(ρLvL − ρRvR), ρR ρL − ρR

vL(EL + pL) − vR(ER + pR) = S(EL − ER), 2 ρR pL − pR vˆL = . ρL ρL − ρR where S is the speed of the wave, which may take the values v − a or v + a depending on whether the wave moves to the With the substitution of these last equations into (38) and left or to the right respectively. Manipulating these equations considering the definitions for the specific internal enthalpy one gets mentioned above, we obtain

1 (pL + pR)(ρR − ρL) ρLvˆL = ρRvˆR, (30) εR − εL = . 2 ρLρR ρ vˆ2 + p = ρ vˆ2 + p , (31) L L L R R R Assuming the gas obeys an ideal equation of state we get an

vˆL(EˆL + pL) =v ˆR(EˆR + pR), (32) expression for the density as follows

ρR pL(Γ − 1) + pR(Γ + 1) where vˆL = vL − S, vˆR = vR − S ¡are velocities in¢ the = . (39) ˆ 2 ρL pR(Γ − 1) + pL(Γ + 1) rest frame of the shock and EL = ρL (1/2)ˆvL + εL and

Rev. Mex. Fis. E 59 (2013) 28–50 32 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

Notice that this expression relates the density among the Region 1: initial left state that has not been yet influ- two sides from the shock. Now, substituting this expression enced by rarefaction or shock waves into (37) we obtain Region 2: wave traveling to the left (may be rarefaction pR + BL or shock) j2 = , AL Region 3: region between the wave moving to the left 2 Γ − 1 AL = ,BL = pL. (40) and the contact discontinuity, called region star-left (Γ + 1)ρL Γ + 1 Contact discontinuity Thus, the expression for the velocity (35) can be written as follows Region 4: region between the contact discontinuity and s the wave moving to the right, called region star-right AL vR = vL − (pR − pL) . (41) Region 5: wave traveling to the right (may be rarefac- pR + BL tion or shock) From expression (36) and using (40) we express the shock velocity as follows Region 6: initial right state that has not been yet influ- enced by rarefaction or shock waves s pR(Γ + 1) + pL(Γ − 1) Regions 2 and 5 are special. If the wave propagating in such S = vL − . 2ρL regions is a rarefaction wave the region involves a head-fan- p tail structure, whereas if it is a shock the region becomes only Finally, using the sound speed expression aL= pLΓ/ρL we a discontinuity. Counting from left to right on the spatial do- obtain the final expression for the shock velocity main, the results can be reduced to the following four possible s combinations of waves: (Γ + 1)pR Γ − 1 S = vL − aL + . (42) 1) rarefaction-shock 2pLΓ 2Γ 2) shock-rarefaction Analogously, when the shock moves to the right, it is pos- sible to construct the expressions for the variables for the state 3) rarefaction-rarefaction at the left from the shock s 4) shock-shock AR vL = vR + (pL − pR) , (43) with a contact discontinuity between the two waves in all p + B L R cases. It is worth noticing that these combinations can occur pR(Γ − 1) + pL(Γ + 1) under a wide variety of possible combinations of the initial ρL = ρR , (44) pL(Γ − 1) + pR(Γ + 1) values of the thermodynamical variables. In this paper we il- s lustrate each of these scenarios using particular sets of initial (Γ + 1)pL Γ − 1 conditions. S = vR + aR + . (45) 2pRΓ 2Γ 2.4.1. Case 1: Rarefaction-Shock and we let this as an exercise to the reader. This case corresponds to the typical case used to test numer- 2.4. Classical Riemann Problem ical codes, a test called the Sod’s shock tube problem [5]. A traditional set of initial values that produces this scenario The Riemann problem is physically a tube filled with gas corresponds to a gas with higher density and pressure in the which is divided into two chambers separated by a remov- left chamber than in the right chamber, and the velocity is set able membrane at x = x0. At the initial time the membrane initially to zero in both. is removed and the gas begins to flow. Once the membrane is A rarefaction wave travels into the high density region removed, the discontinuity decays into two elementary, non- (moves to the left), whereas a shock moves into the low den- linear waves that move in opposite directions. sity region (moves to the right). Depending on the values of the thermodynamical vari- Summarizing, the problem then involves five regions ables in each chamber, four cases can occur. Considering the only. Regions 1 correspond to the initial state to the left that fluid is described on a one-dimensional spatial domain, rar- has not been influenced by the evolution of the system. Re- efaction and shock waves can evolve toward the left or right gion 2 corresponds to a rarefaction wave containing the head- from the location of the membrane. fan-tail structure, region 3 and 4 are the left and right states In general the solution in all the cases can be studied in separated by the contact discontinuity. Region 5 reduces to six following regions: the shock. Finally region 6 is the initial state at the right

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 33 chamber that has not been influenced by the evolution of the matrix evaluated at the location next to the head from system. the left side, that is, considering (2) Vh = v1 − a1. The The goal is to determine the state in all the regions using solution there is simply the relations between the thermodynamical quantities con- structed before. pexact = p1, The starting point to construct the solution happens at the v = v , contact discontinuity, where the velocity and pressure obey exact 1 ∗ ∗ the conditions p3 = p4 = p and v3 = v4 = v . ρexact = ρ1. Region 3 plays the role of the state at the right from the rarefaction wave and region 1 the state at the left. Then we 2. Region 2 is defined by the condition tVhead < x − can use (19) to obtain an expression for v3 x0 < tVtail, where Vtail is the same characteristic value "µ ¶ Γ−1 # 2Γ again, but this time evaluated at the tail curve, that is 2a1 p3 v = v − − 1 . (46) V = v − a . This is the fan region for a rarefaction 3 1 Γ − 1 p tail 3 3 1 wave moving to the left, for which we simply use ex- On the other hand, region 4 plays the role of a state at the left pressions (24,25,26) that need only information from from the shock wave and region 6 the role of the state at the region 1 and obtain right. Then we use (43) to calculate v4: · µ ¶¸ 2 Γ−1 s 2 Γ−1 x − x0 ρexact=ρ1 + v1− , A6 Γ+1 a1(Γ+1) t v4 = v6 + (p4 − p6) . (47) p + B · µ ¶¸ 2Γ 4 6 Γ−1 2 Γ−1 x − x0 pexact=p1 + v1− , where A6 = 2/ρ6/(Γ + 1) and B6 = p6(Γ − 1)/(Γ + 1). Γ+1 a1(Γ+1) t ∗ · ¸ Given that v3 = v4 = v , equating both expressions one 2 1 x−x ∗ 0 obtains a trascendental equation for p : vexact= a1+ (Γ−1)v1+ . (51) Γ+1 2 t s ∗ A6 (p − p6) ∗ 3. Region 3 is defined by the condition tVtail < x − x0 < p + B6 tVcontact, where Vcontact is the velocity of the contact "µ ¶ Γ−1 # ∗ 2Γ discontinuity, which is the second eigenvalue (3) of 2a1 p + − 1 + v6 − v1 = 0. (48) the Jacobian matrix evaluated at this region, that is Γ − 1 p1 Vcontact = v3 = v4. The solution there finally reads Unfortunately as far as we can tell, no exact solution is known for p∗, and then we proced to construct its solution numeri- pexact = p3, cally. Once this equation is solved, p and p are automat- 3 4 vexact = v3, ically known, and v3 and v4 can be calculated using (46) and (47) respectively. ρexact = ρ3. Then, it is possible to calculate ρ3 using (13) at both sides of the rarefaction zone, given C is the same on both sides be- 4. Region 4 is defined by the condition tVcontact < x − cause it is an isentropic process: x0 < tVshock, where according to (45), the velocity of µ ¶1/Γ a shock moving to the right separating regions 4 and 6 p3 ρ3 = ρ1 (49) is s p1 (Γ + 1)p4 Γ − 1 Vshock = v6 + a6 + , where now p1, ρ1 and p3 are known. On the other hand one 2Γp6 2Γ can also calculate ρ4 using (44) p µ ¶ where a6 = p6Γ/ρ6. Then the solution in this region p6(Γ − 1) + p4(Γ + 1) is ρ4 = ρ6 (50) p4(Γ − 1) + p6(Γ + 1) p = p , also in terms of known information. With this information it exact 4 is already possible to construct the solution in the whole do- vexact = v4, main. We explain how to do it region by region. A scheme of how the regions are distributed is shown in Fig. 1. ρexact = ρ4.

1. Region 1 is defined by the condition x − x0 < tVhead, as calculated where Vhead is the velocity of the head of the rarefaction wave given by the characteristic value of the Jacobian 5. There is no region 5.

Rev. Mex. Fis. E 59 (2013) 28–50 34 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

6. Region 6 is defined by tVshock < x − x0. In this region 2.4.2. Case 2: Shock-Rarefaction the solution is simply This case is identical to the previous one, except that we choose the initial pressure and density are higher on the right

pexact = p6, chamber. After initial time, the wave traveling to the left is a shock, while the one moving to the right is a rarefaction vexact = v6, wave. This implies that region 2 plays the role of region 5 in the previous case and region 5 has the tail-fan-head structure ρexact = ρ6. of a rarefaction wave. Starting from the contact discontinuity, the conditions An example of how the solution looks like is shown in ∗ ∗ Fig. 2 for initial data in Table I. v3 = v4 = v and p3 = p4 = p hold. The conditions on a shock wave moving to the left imply according to (41) that the velocity of the state at the right is TABLE I. Table with the initial data for the four different cases. We choose the spatial domain to be x ∈ [0, 1] and the location of the s membrane at x0 = 0.5. In all cases we use Γ = 1.4. A1 v3 = v1 − (p3 − p1) , (52) p3 + B1 Case pL pR vL vR ρL ρR Rarefaction-Shock 1.0 0.1 0.0 0.0 1.0 0.125 and information from the rarefaction wave interface can be Shock-Rarefaction 0.1 1.0 0.0 0.0 0.125 1.0 obtained from (27) for v4 as the velocity on the state at the Rarefaction-Rarefaction 0.4 0.4 -1.0 1.0 1.0 1.0 left from a rarefaction wave moving to the right Shock-Shock 0.4 0.4 1.0 -1.0 1.0 1.0 " µ ¶ Γ−1 # 2Γ 2a6 p4 v4 = v6 − 1 − . (53) Γ − 1 p6

Equating these two expression one obtains a trascendental equation for p∗: s ∗ A1 − (p − p1) ∗ p + B1

" µ ¶ Γ−1 # ∗ 2Γ 2a6 p + 1 − + v1 − v6 = 0 (54) Γ − 1 p6

that one solves numerically for p∗. This information pro- vides the necessary information to construct the solution in the whole domain as described below. The different regions FIGURE 1. Description of the relevant regions for the Rarefaction- are illustrated in Fig. 3 and the exact solution region by re- Shock case. gion is as follows.

1. Region 1 is defined by x − x0 < tVshock, where the ve- locity of the shock is given by (42) because the shock is traveling to the left: s (Γ + 1)p3 Γ − 1 Vs = v1 − a1 + , 2p1Γ 2Γ

and the exact solution here reads

pexact = p1,

vexact = v1,

ρexact = ρ1.

FIGURE 2. Exact solution for the Rarefaction-Shock case at time t = 0.25 for the parameters in Table I. 2. There is no region 2.

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 35

3. Region 3 is defined by the condition tVs < x − x0 < tVcontact. Vcontact is the characteristic value (3) evalu- ∗ ated at this region: Vcontact = v3 = v4 = v . Using (39) explicitly for the density and (52) for the velocity, the solution in this region reads

pexact = p3,

vexact = v3,

p1(Γ − 1) + p3(Γ + 1) ρexact = ρ1 . p3(Γ − 1) + p1(Γ + 1)

4. Region 4 is defined by the condition tVcontact < x − x0 < tVt, where the velocity of the tail of the rarefac- FIGURE 3. Description of the relevant regions for the Shock- tion wave Vt is the third eigenvalue (4) evaluated at the Rarefaction case. region behind the tail Vt = v4 + a4.

One uses (53) to calculate v4 and (13) implies p4/p6 = Γ (ρ4/ρ6) for a constant value of K, which implies an expression for ρ4. The resulting exact solution is

pexact = p4,

vexact = v4

µ ¶1/Γ p4 ρexact = ρ6 . p6

5. Region 5 is a fan region defined by the condition tVt < x − x0 < tVh where the velocity of the head of the wave is again the third eigenvalue, but this time evalu- ated at the head Vh = v6 + a6. One uses the expres- FIGURE 4. Exact solution for the Shock-Rarefaction case at time sions for a fan region of a rarefaction wave moving to t = 0.25 for the parameters in Table I. the right (27,28,29) to calculate the exact solution

2.4.3. Case 3: Rarefaction-Rarefaction · µ ¶¸ 2Γ Γ−1 2 Γ−1 x−x0 pexact=p6 − v6− , A physical situation that provides this scenario is pL = pR, Γ+1 a6(Γ+1) t ρ = ρ and −v = +v > 0. In this case both, regions 2 · ¸ L R L R 2 1 x−x and 5 correspond to rarefaction waves. In this particular case v = −a + (Γ−1)v + 0 , exact Γ+1 6 2 6 t since one of the rarefaction waves moves to the left and the other one to the right, we distinguish them using the labels · µ ¶¸ 2 Γ−1 2 Γ−1 x−x0 for each of their parts. ρexact=ρ6 − v6− . Γ+1 a6(Γ+1) t Again the contact discontinuity defines a relationship be- tween velocity and pressure. In the present case, there is an expression for v in terms of v for a rarefaction wave mov- 6. Region 6 is defined by the condition tV < x − x . 3 1 h 0 ing to the left given by (19) and another one for v in terms The exact solution is given by the initial states at the 4 of v for a rarefaction wave moving to the right (22): right chamber. 6 "µ ¶ Γ−1 # 2Γ 2a1 p3 pexact = p6, v3 = v1 − − 1 , (55) Γ − 1 p1 vexact = v6, " µ ¶ Γ−1 # 2Γ ρexact = ρ6. 2a6 p4 v4 = v6 − 1 − . (56) Γ − 1 p6 An example is shown in Fig. 4 for initial data in Table I.

Rev. Mex. Fis. E 59 (2013) 28–50 36 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

∗ The condition v3 = v4 = v at the contact discontinuity im- 4. Region 4 is defined by the condition tVcontact < x − ∗ plies a trascendental equation for p = p3 = p4: x0 < tVt,5, where the velocity of the tail of the wave " µ ¶ Γ−1 # moving to the right Vt,5 is given by the eigenvalue (4) 2a p∗ 2Γ 6 1 − evaluated at the state left behind the rarefaction wave Γ − 1 p6 moving to the right, that is Vt,5 = v4 +a4, where again ∗ ∗ "µ ¶ Γ−1 # we point out that v4 = v and p4 = p are known ∗ 2Γ ∗ 2a1 p once p is calculated. The solution is obtained in the − − 1 + v1 − v6 = 0 (57) Γ − 1 p1 same way as for the previous region, but now the wave relates states in regions 4 and 6: Again, once p∗ is calculated numerically, the solution in p = p , all the regions of the domain can be calculated as follows. exact 4 ∗ The first implication is that p3 = p4 = p , and thus v3 and v4 vexact = v4. can be calculated using (55) and (56). The different regions µ ¶1/Γ are illustrated in Fig. 5. p4 ρexact = ρ6 , p6 1. Region 1 is defined by the condition x − x0 < tVh,2, where Vh,2 is the velocity of the head of the wave mov- ing to the left, and is obtained from the characteristic 5. Region 5 is defined by the condition tVt,5 < x − x0 < value of such rarefaction wave evaluated at the left in- Vh,5, where the velocity of the head of the wave mov- V = v +a terface, that is Vh,2 = v1 − a1. In this region the gas ing to the right is h,5 6 6, and the solution is ob- has not affected the initial state on the left, then the tained using the values of the state variables for the fan solution is of a rarefaction wave moving to the right (27,28,29):

· µ ¶¸ 2Γ pexact = p1, Γ−1 2 Γ − 1 x − x0 pexact=p6 − v6− , vexact = v1, Γ + 1 a6(Γ + 1) t · ¸ 2 1 x − x ρexact = ρ1. v = −a + (Γ − 1)v + 0 , exact Γ + 1 6 2 6 t

2. Region 2 is a fan region defined by the condition · µ ¶¸ 2 2 Γ − 1 x − x Γ−1 tVh,2 < x − x0 < tVt,2, where the velocity of the 0 ρexact=ρ6 − v6 − . tail Vt,2 is that of the state left behind by the wave, that Γ + 1 a6(Γ + 1) t is Vt,2 = v3 − a3. The exact solution is that of a fan region of a rarefac- 6. Finally, region 6 is defined by the condition Vh,5 < tion wave moving to the left (24-26) x − x0. The exact solution is given by the initial values · µ ¶¸ 2Γ at the chamber on the right because in this region the Γ−1 2 Γ−1 x − x0 gas has not been affected yet by the dynamics of the pexact=p1 + v1− , Γ+1 a1(Γ+1) t gas: · ¸ 2 1 x − x0 v = a + (Γ − 1)v + , pexact = p6, exact Γ+1 1 2 1 t v = v , · µ ¶¸ 2 exact 6 Γ−1 2 Γ − 1 x − x0 ρexact=ρ1 + v1− . Γ + 1 a1(Γ + 1) t

3. Region 3 is defined by the condition tVt,2 < x − x0 < tVcontact. The velocity of the contact discontinuity is ∗ Vcontact = v3 = v4 = v according to the eigen- ∗ ∗ value (3). In this region p3 = p and v3 = v are already known from p∗. Finally, the density is obtained from (13) for an isentropic process like the rarefaction wave for a constant C on both sides of such wave as found in the previous two cases. Thus the solution is

pexact = p3,

vexact = v3.

µ ¶1/Γ p3 ρexact = ρ1 , FIGURE 5. Description of the relevant regions for the Rarefaction- p1 Rarefaction case.

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 37

1. Region 1 is defined by the condition x − x0 < tVs,2, where the velocity of the shock moving to the left Vs,2 is given by (42) and reads s (Γ + 1)p3 Γ − 1 Vs,2 = v1 − a1 + . 2p1Γ 2Γ

The solution there is that of the initial values of the variables on the left chamber:

pexact = p1,

vexact = v1,

ρexact = ρ1. FIGURE 6. Exact solution for the Rarefaction-Rarefaction case at time t = 0.25 for the parameters in Table I. 2. There is no region 2.

3. Region 3 is defined by the condition tVs,2 < x − x0 ∗ < tVcontact, where Vcontact = v3 = v4 = v . Once (54) ρexact = ρ6. is solved one can calculate all the required informa- tion. Using (58) for v3 and (39) for ρ3 the solution in An example is shown in Fig. 6 for initial data in Table I. this region reads

2.4.4. Case 4: Shock-Shock pexact = p3,

A physical situation that provides this scenario corresponds vexact = v3 to two streams colliding with opposite directions. We choose p1(Γ − 1) + p3(Γ + 1) in this case pL = pR, ρL = ρR and −vL = +vR < 0. In this ρexact = ρ1 . case regions 2 and 5 are shock waves. p3(Γ − 1) + p1(Γ + 1) Again the contact discontinuity defines a relationship be- 4. Region 4 is defined by tV < x − x < tV , tween velocity and pressure. In the present case there is an contact 0 s,5 where the velocity of the shock moving to the right is expression for v in terms of v for a shock-wave moving to 3 1 given by (45) and reads the left given by (41) and another one for v4 in terms of v6 for a shock-wave moving to the right (43): s (Γ + 1)p4 Γ − 1 s Vs,5 = v6 + a6 + . 2p6Γ 2Γ A1 v3 = v1 − (p3 − p1) , (58) p3 + B1 Finally, using (59) for v4 and (44) for ρ4 the solution s in this region reads A6 v4 = v6 + (p4 − p6) . (59) p4 + B6 pexact = p4,

∗ v = v , The condition v3 = v4 = v at the contact discontinuity im- exact 4 plies a trascendental equation for p∗ = p = p : 3 4 p6(Γ − 1) + p4(Γ + 1) s ρexact = ρ6 . p4(Γ − 1) + p6(Γ + 1) ∗ A1 − (p − p1) ∗ p + B1 5. There is no region 5. s A 6. Finally region 6 is defined by the condition Vs,5 < − (p∗ − p ) 6 + v − v = 0. (60) 6 ∗ 1 6 x − x0. The exact solution is given by the initial values p + B6 at the chamber on the right: Again, once p∗ is calculated numerically, the solution in all the regions of the domain can be calculated as follows. pexact = p6, ∗ Immediately one has that p3 = p4 = p and v3 and v4 can be vexact = v6, calculated using (58) and (59). In this particular case regions 2 and 5 reduce to lines. The ρexact = ρ6. solution in each region reads as follows and the regions are illustrated in Fig. 7. An example is shown in Fig. 8.

Rev. Mex. Fis. E 59 (2013) 28–50 38 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´ √ µ x i where u = W (1, v , 0, 0) and W = 1/ 1 − v vi is the Lorentz factor and vx is the Eulerian velocity of the fluid el- ements. It is possible to arrange these equations as a flux balance set of equations as in the Newtonian case

∂tu + ∂xF(u) = 0, (62) where conservative variables are defined by u = (D,Sx, τ)T and the resulting fluxes are F = (Dv, Sv + p, S), where we assume that specifically v = vx and S = Sx, since we are only considering one spatial dimension. The conservative variables are defined in terms of the primitive ones as follows

D = ρ0W, 2 FIGURE 7. Description of the relevant regions for the Shock-Shock S = ρ0hW v, case. τ = ρ0hW − p. (63) The flux balance equations are explicitly:

∂tD + ∂x(Dv) = 0, (64)

∂tS + ∂x(Sv + p) = 0, (65)

∂tτ + ∂xS = 0. (66) The eigenvalues of the Jacobian matrix of this system of equations are v ± c λo = v, λ± = s . (67) 1 ± vcs Each of the characteristic values (67) may correspond to eigenvectors with different properties exactly as in the New- tonian case, that is, λ0 corresponds to a contact discontinuity, λ± FIGURE 8. Exact solution for the Shock-Shock case at time t=0.25 whereas the eigenvalues may correspond to rarefaction or for the parameters in Table I. shock waves. The shock tube problem in this case is defined as in the Newtonian case: ½ u , x < x u = L 0 (68) u , x > x . 3. Relativistic shock tube R 0 Next we describe the treatment of each of the wave or First of all one needs to define a model for the gas. In our case discontinuities that develop during the evolution. we use the perfect fluid defined because it has no viscosity nor heat transfer, is shear free and is non-compressible. Such 3.1. Rarefaction Waves system is described by the stress energy tensor Rarefaction waves are self-similar solutions of the flow equa- µν µ ν µν tions [4]. They are self-similar solutions in the sense that T = ρ0hu u + pη , (61) all quantities describing the fluid depend on the variable µ ξ = (x − x0)/t. In order to explore the change of all phys- where ρ0 is the rest mass density of a fluid element, u its ical quantities along the straight line ξ, we define the useful four velocity, p the pressure, h = 1 + ε + p/ρ0 is the specific enthalpy and ηµν are the components of the metric describing change on the derivative operators Minkowski space-time. 1 1 ∂ = − ξ∂ , ∂ = ∂ . (69) The set of relativistic Euler equations is obtained from the t t ξ x t ξ local conservation of the rest mass and the local conservation Using the advective derivative da = ∂t + v∂x, we obtain of the stress energy tensor of the fluid, which are respectively the expressions

µ (ρ0u ),µ = 0, ∂xp = −Dda(hW v), (70) µν (T ),ν = 0, ∂tp = Dda(hW ), (71)

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 39 where we have used the rest mass conservation law to sim- or in terms of the pressure instead of the density the speed of plify the expressions. From (69) we obtain for the advective sound reads derivative da = (1/t)(ξ − v)d/dξ, for which we will use 2 Γ − 1 d := d/dξ from now on. With this in mind we obtain from cs(p) = ¡ ¢ Γ−1 . (81) 1−Γ p Γ (70,71) the differential equation KΓ K + 1 (v − ξ)ρhW 2dv + (1 − ξv)dp = 0. (72) Conversely, if the speed of sound is known one can cal- culate the density using (80): On the other hand, the change of variable in (64) from t, x to ξ implies 1 ρ = h ³ ´i 1 . (82) 2 1 1 Γ−1 (v − ξ)dρ + ρW (1 − vξ)dv = 0. (73) KΓ 2 − cs Γ−1 and from Eqs. (72) and (73) we obtain a relation between the Then the integral can be written as density and pressure Z Z · µ ¶¸ 1 · ¸ c 1 1 Γ−1 dρ v − ξ 2 s dρ= c KΓ − dc . (83) dp = h dρ. (74) ρ s c2 Γ − 1 dc s 1 − vξ s s Since the process along ξ is isentropic [6] the sound speed is Integrating by parts and using (79) we find the useful con- ¯ straint ¯ 2 1 ∂p¯ ·√ ¸ cs = , 1 1 + v 1 Γ − 1 + c h ∂ρ¯ ln ± ln √ s = , s 1/2 constant 2 1 − v (Γ − 1) Γ − 1 − cs which combined with the previous expression implies the (84) speed of sound which in turn simplifies as follows ¯ ¯ ¯ v − ξ ¯ ¯ ¯ 1 + v ± cs(v, ξ) = . (75) A = constant, (85) ¯1 − vξ ¯ 1 − v Besides, we can find a useful expression for an isentropic pro- where A± is cess using p = KρΓ (we are using a politropic equation of ·√ ¸±2(Γ−1)−1/2 state). s Γ − 1 + cs A± = √ . (86) Γp c = . (76) Γ − 1 − cs s ρh Equation (85) is valid only across straight lines arising From system (67) we obtain the speed of sound in terms of from the origin (x0, t = 0) and evolving along ξ = (x−x0)/t the eigenvalues of the Jacobian matrix inside the rarefaction zone. For this family of straight lines ½ −(v − λ+)/(1 − vλ+) if ξ = λ+, the Riemann invariant is the same. This allows us to relate c = (77) s (v − λ−)/(1 − vλ−) if ξ = λ−. any two different states in the rarefaction zone, particularly we are going to take the states L and R as the states just next + Comparing with (75) we find that cs(v, λ ) is the speed to the left and to the right from the rarefaction wave. of sound for a rarefaction wave traveling to the right and − 1 + vL ± 1 + vR ± cs(v, λ ) for a wave traveling to the left. AL = AR. (87) According to this equation we get from (73) that 1 − vL 1 − vR

cs Assuming that when the wave is propagating to the left W 2dv ± dρ = 0. (78) ρ we account with information from the left state, we can cal- culate the velocity of the fluid on the region at the right from Here the + sign refers to the wave traveling to the left and the wave in terms of the state variables on the state at the left the − sign when it travels to the right. From this equation we and A+: obtain the Riemann invariant because this differential equa- x − t + + tion is valid along a straight line along the plane, as (1 + vL)AL − (1 − vL)AR long as it is not a shock. Integrating the first term of (78) we vR = + + . (88) (1 + vL)A + (1 − vL)A obatain Z L R 1 1 + v c ln ± s dρ = constant. (79) Analogously when the wave is moving to the right we 2 1 − v ρ expect to account with information on the state to the right. In order to calculate the integral we use the definition of the Then we can express the velocity on the left in terms of the sound speed and the polytropic equation of state p = KρΓ, variables on the state at the right and A− from which we obtain − − Γ−1 (1 + vR)AR − (1 − vR)AL KΓ(Γ − 1)ρ vL = . (89) c2(ρ) = , (80) (1 + v )A− + (1 − v )A− s Γ − 1 + KΓρΓ−1 R R R L

Rev. Mex. Fis. E 59 (2013) 28–50 40 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

3.1.1. The fan 3.2. Shock Waves

The fan is the region where the rarefaction takes place, prop- Shocks require the use of the relativistic Rankine-Hugoniot + µ µν agating with velocity either λ if the wave is moving to the jump conditions [ρ0u ]nµ = 0 and [T ]nν = 0 across the − µ right or λ when moving to the left. The fan will be bounded shock [6], where n = (−VsWs, W s, 0, 0) is a normal vec- by two values of ξ corresponding to the head and the tail of tor to the shock’s front, Ws is the shock’s Lorentz factor and the wave: Vs is the speed of the shock. Here we have used the nota- tion [F ] = FL − FR, where FL and FR are the values of the v ± c(L,R) ξ = L,R s , function F at both sides of the shock’s surface. These condi- h (L,R) (90) 1 ± vcs tions reduce to the following system of equations, in terms of (R,L) primitive and conservative variables, as vR,L ± cs ξt = , (91) (R,L) DLvL − DRvR = Vs(DL − DR), (96) 1 ± vcs where the − sign applies to waves traveling to the left and + SLvL + pL − (SRvR + pR) = Vs(SL − SR), (97) when the wave moves to the right. In order to construct the SL − SR = Vs(τL − τR). (98) solution inside the fan, we use the constraint (87). We have two cases according to the direction of the rarefaction wave. The subindices (L, R) represent two arbitrary states at left If the rarefaction wave travels to left we use and at the right from the shock. These equations can be writ- ten in the reference rest frame of the shock by considering a 1 + vL + 1 + vR + Lorentz transformation, that is AL − AR = 0 (92) 1 − vL 1 − vR Dˆ LvˆL = Dˆ RvˆR, (99) and solve the equation for vR. When the rarefaction wave ˆ ˆ travels to right we use SLvˆL + pL = SRvˆR + pR, (100) ˆ ˆ 1 + vL − 1 + vR − SL = SR, (101) AL − AR = 0, (93) 1 − vL 1 − vR where the hatted quantities are evaluated at the rest frame of ± and solve the equation for vL. We calculate in each case A the shock. Here using (86) in the appropriate region Vs − v(L,R) vˆ(L,R) = , 1 − Vsv(L,R) "√ #±2(Γ−1)−1/2 Γ − 1 + c± ± s,(L,R) ˆ ˆ A = √ , (94) D(L,R) = ρ(L,R)WL,R, (L,R) Γ − 1 − c± s,(L,R) ˆ ˆ 2 S(L,R) = ρ(L,R)h(L,R)W(L,R)vˆ(L,R) and where the sound speed is given by (75) and (77) 1 Wˆ = q . v − ξ (L,R) ± (L,R) 1 − vˆ2 cs,(L,R) = ± , (95) (L,R) 1 − v(L,R)ξ From (99), we can introduce the invariant relativistic where the + sign is used when the wave moves to the left mass flux across the shock as and − when moving to the right. Finally since we are in the rarefaction zone we can express a point (x, t) with j = WsDL(Vs − vL) = WsDR(Vs − vR), (102) p ξ = (x − x )/t in (95) and using this expression in (94) 2 0 where Ws = 1/ 1 − Vs . It is important to point out that and substituting into (92) or (93) depending on the direction when the shock moves to the right the mass flux is positive of propagation we finally obtain a trascendental equation for j > 0, whereas when the shock moves to the left it has to be the velocity v(L,R). We assume that if the wave moves to the negative j < 0. left we know the variables on the state to the left L and ignore Now, using the expression for the mass flux (102) into those of the state to the right R and viceversa. Then we look the Rankine-Hugoniot conditions (96,97,98) we can obtain for a solution of vL when the wave moves to the left and of the following system of equations in terms of a combination vR when moving to the right. Instead of looking for a closed of primitive and conservative variables solution to this equation we solve it numerically to obtain µ ¶ j 1 1 v(L,R) assuming we know v(R,L). Once v(L,R) is calculated vL − vR = − − , (103) we can substitute back, and using Eq. (95) obtain the sound Ws DL DR µ ¶ speed; next, using (82) obtain the density ρ; finally with the j SL SR Γ pL − pR = − , (104) help of the EOS we can calculate the pressure p = Kρ . This Ws DL DR completes the solution in the fan region. µ ¶ j τL τR The particular cases described later illustrate how to im- vLpL − vRpR = − . (105) plement this procedure. Ws DL DR

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 41

Considering the shock is moving to the right and thus that Considering that the state R is known, we will write an expression for the ve- locity v in terms of the state variables R and also in terms of 1 L q j, V and p . In order to do this, we rewrite expressions (104) WsW(L,R) = p s L 1 − V 2 1 − v2 and (105) using the definitions for the conservative variables s (L,R) in terms of the primitive variables (63) as follows 1 = q Ws vR 2 2 2 2 (pL − pR) = hLWL − hRWR , (106) 1 − Vs − v(L,R) + Vs v(L,R) jvL vL

Ws pL (vLpL − vRpR) = hLWL − the last equation takes the following form j ρLWL

pR 2 2 2 − hRWR + . (107) ρLhLWs WL(Vs − vL) ρRWR 2 2 2 Subtracting these expressions and dividing by pL we get − ρRhRWs WR(Vs − vR) = −(pL − pR). (114) µ ¶ Ws vRpR 1 pR vL − − + = (108) j pL vL vLpL As we can see from this equation, the definition of the con- µ ¶ served mass flux is present, then using Eq. (102) in this last h W v p 1 R R R − 1 + R − . equation, we obtain a useful expression for the square of the pL vL pLρRWR ρLWL flux Inserting this into (103) we finally obtain an expression for 2 −(pL − pR) the velocity vL j = ³ ´ , (115) hL hR W − s ρL ρR hRWRvR + j (pL − pR) vL = ³ ´. (109) WsvR 1 hRWR + (pL − pR) + j ρRWR where the positive root corresponds to a shock moving to the When the shock moves to the left and the state L is known, right whereas the negative root to a shock moving to the left. the velocity on the state to the right is Another useful expression comes from Eq. (101), which

Ws can be rewritten directly in the form hLWLvL + j (pR − pL) vR = ³ ´, (110) WsvL 1 hLWL + (pR − pL) j + ρ W L L hLWˆ L = hRWˆ R, (116) where the condition j < 0 has to be satisfied. In order to obtain the shock velocity Vs, we start form which combined with Eq. (115) implies the mass flux conservation across the shock (102), which relates the shock velocity with the mass flux. Substitut- µ ¶ p h h ing W = 1/ 1 − V 2, it is possible to solve the resulting h2 − h2 = (p − p ) L + R . (117) s s L R L R ρ ρ quadratic equation and obtain the two roots for the shock ve- L R locity p This last equation is commonly called the Taub’s adiabat. 2 2 4 2 2 ρRWRvR + j + j ρR Moreover Eqs. (115), (116) and (117) are known as relativis- Vs = 2 2 2 , (111) ρRWR + j tic Taub’s junction conditions for shock waves [6,7]. p ρ2 W 2v − j4 + j2ρ2 Finally, in order to obtain the density ρL and pressure pL V = L L L L , (112) s ρ2 W 2 + j2 for a shock moving to the right in terms of the variables in L L the region to the right, we consider the definition of the spe- which correspond respectively to a shock moving to the right cific internal enthalpy and that the fluid obeys and ideal gas and to the left. The signs of the quadratic formula are chosen equation of state. With these assumptions Eq. (117) can be such that they are physically possible, that is, for the case of a rewritten in the form shock moving to the right j > 0 we use (111) and for a shock moving to the left j < 0 we use (112) [3]. 1 σ 2 In order to solve completely the problem across the [pL(2σ−1)+pR]+ [p (σ − 1)+pLpR] ρ ρ2 L shock, we first express Eq. (100) as L L 1 σ ρ h (V − v )2 2 L L s L = [pR(2σ − 1)+pL]+ 2 [pR(σ−1)+pLpR], (118) 2 2 2 2 ρR ρR 1 − Vs − vL + Vs vL 2 ρRhR(Vs − vR) where σ = Γ/(Γ−1). The solution for the quadratic equation − 2 2 2 2 = −(pL − pR). (113) 1 − Vs − vR + Vs vR reads

Rev. Mex. Fis. E 59 (2013) 28–50 42 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

TABLE II. Initial data for the four different cases. We choose the spatial domain to be x ∈ [0, 1] and the location of the membrane at x0 = 0.5. In all cases we use Γ = 4/3.

Case pL pL υL υR ρL ρR Rarefaction-Shock 13.33 0 0 0 10 1 Shock-Rarefaction 0 13.33 0.0 0.0 1 10 Rarefaction-Rarefaction 0.05 -0.05 -0.2 0.2 0.1 0.1 Shock-Shock 3.333e-9 -3.333e-9 0.999999 0.999999 0.001 0.001

p 2 2 1 −[pL(2σ − 1) + pR] ± [pL(2σ − 1) + pR] + 4ζLσ[pL(σ − 1) + pLpR] = 2 , (119) ρL 2σ[pL(σ − 1) + pLpR] p 2 2 1 −[pR(2σ − 1) + pL] ± [pR(2σ − 1) + pL] + 4ζRσ[pR(σ − 1) + pRpL] = 2 , (120) ρR 2σ[pR(σ − 1) + pRpL] where the velocity on the state at the right from a rarefaction wave 1 σ 2 ζL = [pR(2σ − 1) + pL]+ 2 [pR(σ − 1) + pLpR], moving to the left: ρR ρR + + and (1 + v1)A1 − (1 − v1)A3 v3 = . (122) 1 σ (1 + v )A+ + (1 − v )A+ ζ = [p (2σ − 1) + p ]+ [p2 (σ − 1) + p p ]. 1 1 1 3 R ρ L R ρ2 L R L L L where according to (94) A physically acceptable solution requires ρ > 0, which re- "√ #+2(Γ−1)−1/2 stricts the sign to be positive one in both cases. Γ − 1 + c+ + s,(1,3) A(1,3) = √ + . (123) 3.3. Contact Wave Γ − 1 − cs,(1,3) p + The equations describing the jump conditions (96,97,98) ad- Here cs,1 := cs(p1) = Γp1/(ρ1h1), h1 = 1 + ◦ + mit the solution using Vs = vR = vL = λ = Vcontact where (p1Γ/ρ1(Γ − 1)) and cs,3 := cs(p3) is given by Eq. (81) v v R and L are the values of the velocity of the fluid at the right v u and at the left from the contact discontinuity. This represents u Γ − 1 p 0 + t 1 the contact wave traveling along the line x − x0 = λ t. cs,3(p3) = ¡ ¢ 1−Γ ,K = Γ , (124) Γ−1 p3 Γ ρ1 Then (96) is trivial and (97) reads KΓ K + 1

(SL − SR)Vs + pL − pR = (SL − SR)Vs, (121) where we remind the reader that in the rarefaction region the polytopic constant remains the same during the process, that which implies p = p and Eq. (98) is satisfied. R L is, it is the same in regions 1, 2 and 3. On the other hand the We are now in the position of analyzing each of the pos- velocity of the gas in region 4 corresponds to the velocity on sible combinations of shock and rarefaction waves in a Rie- the state at the left of a shock moving to the right (109) mann problem. We then proceed in the same way as in the

Newtonian case studying each combination. Ws,5 h6W6v6 + j (p4 − p6) v4 = ³ ´, (125) Ws,5v6 1 3.4. The four different cases h6W6 + (p4 − p6) + j ρ6W6 In what follows, as we did for the Newtonian case, we present q 2 the four combinations of rarefaction and shock waves associ- where Ws,5 = 1/ 1 − Vs,5 is the Lorentz factor of the ated to the relativistic Riemann problem. We illustrate each shock, where we use the subindex 5 in order to denote the case with a particular set of parameters contained in Table II. shock occurring in region 5. In order to obtain v4 in terms of p4 we need to perform the following steps: 3.4.1. Case 1: Rarefaction-Shock • The rest mass density ρ4 is given in terms of p4 and ∗ ∗ The contact wave conditions are v3=v4=v and p3=p4=p . other known information can be expressed using (119) The velocity in region 3 is given by Eq. (88) that provides as

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 43

p 2 2 1 −[p4(2σ − 1) + p6] + [p4(2σ − 1) + p6] + 4ζ4σ[p4(σ − 1) + p4p6] = 2 , (126) ρ4 2σ[p4(σ − 1) + p4p6]

1 σ 2 Γ ζ4 = [p6(2σ − 1) + p4] + 2 [p6(σ − 1) + p4p6], where σ = . (127) ρ6 ρ6 Γ − 1

• Once ρ4 is given in terms of p4 it is possible to compute the enthalpy in region 4 as h4 = 1 + σ(p4/ρ4). ξh = v1 − cs,1/1 − v1cs,1. The values of the physical • Then Eq. (115) reads variables are known from the initial conditions:

(p − p ) pexact = p1, (131) j2 = − 4 6 , (128) h4 − h6 ρ4 ρ6 vexact = v1, (132)

where h6 = 1 + σ(p6/ρ6). Something to remember ρexact = ρ1. (133) here is the fact that as the shock moves to the right, we consider j to be the positive square root. 2. Region 2 is defined by the condition tξh < x − x0 < tξ , where according to (91) ξ is the characteristic • Once j is obtained, the shock velocity can be found t t value again, but this time evaluated at the tail of the rar- from expression (111) as efaction wave, that is ξt = (v3 − cs,3)/(1 − v3cs,3). p 2 2 2 2 In order to compute v2 we use (92) ρ6W6 v6 + |j| j + ρ6 Vs,5 = 2 2 2 . (129) j + ρ6W6 1 + v1 + 1 + v2 + A1 − A2 (v2) = 0 (134) q 1 − v1 1 − v2 2 • Finally one calculates Ws,5 = 1/ 1 − V and in this s,5 considering Eqs. (76), (94) and (95) as follows way v4 in terms of p4 and the known state in region 6 using (125). "√ #+2(Γ−1)−1/2 Γ − 1 + c+ According to the contact discontinuity condition + s,(1,2) ∗ A = √ , (135) v3=v4=v , we equate (122) and (125) and obtain a tran- (1,2) Γ − 1 − c+ scendental equation for p∗: s,(1,2) s µ ¶ (1 + v )A+ − (1 − v )A+(p∗) + Γp1 p1 Γ 1 1 1 3 − cs,1 = , h1 = 1 + (136) + + ∗ ρ1h1 ρ1 Γ − 1 (1 + v1)A1 + (1 − v1)A3 (p ) + Ws ∗ v2 − ξ ξ + cs,2 h6W6v6 + j (p − p6) + ³ ´ = 0, cs,2 = ⇒ v2 = + . (137) (130) 1 − v2ξ 1 + c ξ ∗ Wsv6 1 s,2 h6W6 + (p − p6) + j ρ6W6 where ξ = (x − x0)/t. In this way, Eq. (134) is tran- which has to be solved using a root finder. scendental and has to be solved equivalently for v2 or Once this equation is solved, p3 and p4 are automati- + for cs,2 using a root finder for each point of region 2. cally known and v3 and v4 can be calculated using (122) + We recommend solving for cs,2 and then construct v2 and (125), respectively. It is possible to calculate ρ3 using using (137). Finally we calculate ρ2 using Eq. (82): the fact that in the rarefaction zone the process is adiabatic 1/Γ and then ρ3 = ρ1(p3/p1) . On the other hand we can also 1 p1 ρ2 = · µ ¶¸ 1 ,K = Γ . calculate ρ4 using (126). With this information it is already Γ−1 ρ 1 1 1 possible to construct the solution in the whole domain. KΓ + 2 − Γ−1 (cs,2) Up to this point we account with the known initial states (138) (p1, v1, ρ1) and (p6, v6, ρ6), the solution in regions 3 and 4 Finally we obtain p2 using the fact that in the process given by (p3, v3, ρ3) and (p4, v4, ρ4), and Vs,5 which repre- K is constant sents the velocity of propagation of the shock 5. The exact µ ¶Γ solution region by region is described next. ρ2 p2 = p1 . (139) ρ1 1. Region 1 is defined by the condition x − x0 < tξh, where according to (90) ξh is the velocity of 3. Region 3 is defined by the condition tξt < x − x0 < the head of the rarefaction wave traveling to the left tVcontact, where Vcontact = λo = v3 = v4. The solution there reads

Rev. Mex. Fis. E 59 (2013) 28–50 44 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

pexact = p3, (140)

vexact = v3, (141)

ρexact = ρ3. (142)

4. Region 4 is defined by the condition tVcontact < x − x0 < tVs,5, where Vs,5 is given by (129) and explicitly

pexact = p4, (143)

vexact = v4, (144)

ρexact = ρ4. (145)

5. There is no region 5. Only the shock traveling with speed Vs,5. FIGURE 9. Exact solution for the Rarefaction-Shock case at time 6. Region 6 is defined by tVs,5 < x − x0. In this region t = 0.35 for the parameters in Table II. the solution is simply and p = p = p∗. The velocity of the gas in region 3 cor- p = p , (146) 3 4 exact 6 responds to the velocity on the state at the right from a shock

vexact = v6, (147) moving to the left (110)

W ρexact = ρ6. (148) s,2 h1W1v1 + j (p3 − p1) v3 = ³ ´, (149) Ws,2v1 1 As an example we show in Fig. 9 the primitive variables h1W1 + (p3 − p1) + j ρ1W1 at t = 0.35 for the initial parameters in Table II. q 2 3.4.2. Case 2: Shock-Rarefaction where Ws,2 = 1/ 1 − Vs,2 is the Lorentz factor of the shock. In order to obtain v3 in terms of p3 and other known This is pretty much the previous case, except that one has to information we need to perform the following steps: be careful at using the correct signs and conditions. We then ∗ start again with the contact wave conditions v3 = v4 = v • The rest mass density is given in terms of p3 using the expression (120) as

p 2 2 1 −[p3(2σ − 1) + p1] + [p3(2σ − 1) + p1] + 4ζ3σ[p3(σ − 1) + p3p1] = 2 , (150) ρ3 2σ[p3(σ − 1) + p3p1]

1 σ 2 Γ ζ3 = [p1(2σ − 1) + p3] + 2 [p1(σ − 1) + p3p1], where σ = . (151) ρ1 ρ1 Γ − 1

• Once ρ3 is given in terms of p3 it is possible to compute the enthalpy in region 3 as h3 = 1 + σ(p3/ρ3). q 2 • Finally one calculates Ws,2 = 1/ 1 − Vs,2 and in this • Then from Eq. (115) we obtain way v3 in terms of p3 and the known state in region 1 using (149). (p − p ) j2 = − 3 1 , (152) h3 h1 The velocity in region 4 is given by Eq. (89) that pro- ρ − ρ 3 1 vides the velocity on the state at the left from a rarefaction where h1 = 1 + σ(p1/ρ1). As the shock is moving wave moving to the right: to the left we consider the negative root of the above expression for j. − − (1 + v6)A6 − (1 − v6)A4 v4 = − − , (154) • Once j is obtained, the shock velocity can be found (1 + v6)A6 + (1 − v6)A4 from expression (112) in terms of p3 as where following (94) p 2 2 2 2 ρ W v − |j| j + ρ −1/2 1 1 1 1 "√ − #−2(Γ−1) Vs,2 = . (153) 2 2 2 Γ − 1 + cs,(4,6) j + ρ1W1 − A(4,6) = √ − . (155) Γ − 1 − cs,(4,6)

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 45

Here p 4. Region 4 is defined by the condition tVcontact < x − cs,6 := cs(p6) = Γp6/(ρ6h6), −x0 < tξt, where according to (91) ξt is the characteristic value again, but this time eval- p6Γ h6 = 1 + uated at the tail of the rarefaction wave, that is ρ6(Γ − 1) ξt=(v4 + cs,4)/(1 + v4cs,4). The solution in this re- and − gion is cs,4 := cs(p4) is given by Eq. (81) pexact = p4, (164) v u v = v , (165) u Γ − 1 p exact 4 − t 6 cs,4(p4) = ¡ ¢ 1−Γ ,K = Γ . (156) Γ−1 p4 Γ ρ6 ρexact = ρ4. (166) KΓ K + 1 because K is the same in regions 4 and 6. 5. Region 5 is defined by the condition tξt < x − x0 < We obtain a transcendental equation for p∗ using the con- tξh, where according to (90) ξh is the velocity of ∗ tact discontinuity condition v3 = v4 = v , and equate (149) the head of the rarefaction wave traveling to the right and (154): ξh = (v6 + cs,6)/(1 + v6cs,6). In order to compute v5 (1 + v )A− − (1 − v )A−(p∗) we use (93) 6 6 6 4 − (1 + v )A− + (1 − v )A−(p∗) 6 6 6 4 1 + v6 − 1 + v5 − A6 − A5 (v5) = 0, (167) Ws ∗ 1 − v 1 − v h1W1v1 + (p − p1) 6 5 j³ ´ = 0, (157) ∗ Wsv1 1 whoch requires the information in (76), (94) and (95): h1W1 + (p − p1) + j ρ1W1 "√ # −1/2 which has to be solved using a root finder. − −2(Γ−1) Γ − 1 + cs,(5,6) Once this equation is solved, p and p are automati- A− = √ , (168) 3 4 (5,6) Γ − 1 − c− cally known and v3 and v4 can be calculated using (149) s,(5,6) and (154), respectively. It is possible to calculate ρ using s µ ¶ 4 Γp p Γ the fact that in the rarefaction zone the process is adiabatic − 6 6 cs,6 = , h6 = 1 + (169) 1/Γ ρ h ρ Γ − 1 and then ρ4 = ρ6(p4/p6) . We can also calculate ρ3 using 6 6 6 (150). With this information it is already possible to construct v − ξ ξ − c− the solution in the whole domain. c− = 5 ⇒ v = s,5 . (170) s,5 1 − v ξ 5 − Up to this point we have the known initial states 5 1 − cs,5ξ (p1, v1, ρ1) and (p6, v6, ρ6), the solution in regions 3 and 4 where ξ = (x − x0)/t. In this way, Eq. (167) is tran- given by (p3, v3, ρ3) and (p4, v4, ρ4), and Vs,2 which repre- scendental and has to be solved equivalently for v5 or sents the velocity of propagation of the shock 2. The exact − for cs,5 using a root finder for each point of region 5. solution region by region is described next. − We recommend solving for cs,5 and then construct v5 1. Region 1 is defined by the condition x − x0 < tVs,2, using (170). Finally we calculate ρ5 using Eq. (82): where Vs,2 is given by (153) and the solution there is that of the initial state on the left chamber 1 p6 ρ5 = · µ ¶¸ 1 ,K = Γ , Γ−1 ρ 1 1 6 pexact = p1, (158) KΓ − 2 − Γ−1 (cs,5) (171) vexact = v1, (159) since K is the same in regions 5 and 6, and by the same ρexact = ρ1. (160) reason we obtain p5 using

µ ¶Γ 2. There is no region 2. Only the shock traveling with ρ5 p5 = p6 . (172) speed Vs,2. ρ6

3. Region 3 is defined by the condition tVs,2 < x − x0 < 6. Region 6 is defined by tξ < x − x . In this region the tVcontact, where Vcontact = λo = v3 = v4. The solution h 0 is solution is simply

pexact = p3, (161) pexact = p6, (173)

vexact = v3, (162) vexact = v6, (174)

ρexact = ρ3. (163) ρexact = ρ6. (175)

Rev. Mex. Fis. E 59 (2013) 28–50 46 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

where according to (94)

"√ #−2(Γ−1)−1/2 Γ − 1 + c− − s,(4,6) A(4,6) = √ − , (180) Γ − 1 − cs,(4,6)

and the speed of sound in region 4 is given by v u u Γ − 1 p − t 6 cs,4(p4) = ¡ ¢ 1−Γ ,K = Γ . (181) Γ−1 p4 Γ ρ6 KΓ K + 1

Then using the contact discontinuity condition v3 = v4 = v∗, we equate (176) and (179) and obtain a transcendental ∗ FIGURE 10. Exact solution for the Shock-Rarefaction case at time equation for p : t = 0.35 for the parameters in Table II. (1 + v )A+ − (1 − v )A+(p∗) 1 1 1 3 − + + ∗ As an example we show in Fig. 10 the primitive variables (1 + v1)A1 + (1 − v1)A3 (p ) at t = 0.35 for the initial data in Table II. (1 + v )A− − (1 − v )A−(p∗) 6 6 6 4 = 0, (182) − − ∗ 3.4.3. Case 3: Rarefaction-Rarefaction (1 + v6)A6 + (1 − v6)A4 (p )

In this case the transcendental equation for the pressure at the which has to be solved using a root finder. p p contact discontinuity is given again by the condition v3 = v4 Once this equation is solved, 3 and 4 are automatically where both velocities are constructed using the information known and v3 and v4 can be calculated using (176) and (179), of the unknown state aside rarefaction waves. The velocity in respectively. As in the previous two cases, it is possible to region 3 is given by Eq. (88) for the velocity on the state at calculate ρ3 and ρ4 using the fact that in the rarefaction zone 1/Γ the right from a rarefaction wave moving to the left: the process is adiabatic and then ρ3 = ρ1(p3/p1) and 1/Γ ρ4 = ρ6(p4/p6) . Thus we have the known initial states + + (1 + v1)A1 − (1 − v1)A3 (p1, v1, ρ1), (p6, v6, ρ6) and the solution in regions 3 and 4 v3 = , (176) + + given by (p3, v3, ρ3) and (p4, v4, ρ4). The solution in each (1 + v1)A1 + (1 − v1)A3 of the fan regions aside the rarefaction zones has to be con- where according to (94) structed in terms of the position and time ξ = (x − x0)/t as described below for regions 2 and 5. "√ #+2(Γ−1)−1/2 Γ − 1 + c+ A+ = √ s,(1,3) . (177) (1,3) + 1. Region one is defined by the condition x − x0 < tξh2, Γ − 1 − cs,(1,3) where according to (90) ξh2 is the velocity of the head of the rarefaction wave traveling to the left ξ = Here p h2 + (v1 − cs,1)/(1 − v1cs,1). The values of the physical cs,1 := cs(p1) = Γp1/(ρ1h1), variables are known from the initial conditions: p1Γ h1 = 1 + ρ1(Γ − 1) pexact = p1, (183) and vexact = v1, (184) + cs,3 := cs(p3) ρexact = ρ1. (185) is given by Eq. (81) v u u Γ − 1 p 2. Region 2 is defined by the condition tξh2 < x − x0 < + t 1 cs,3(p3) = ¡ ¢ 1−Γ ,K = Γ . (178) tξt2, where according to (91) ξt2 is the characteristic Γ−1 p3 Γ ρ1 KΓ K + 1 value again, but this time evaluated at the tail of the rar- efaction wave, that is ξt2 = (v3 − cs,3)/(1 − v3cs,3). On the other hand the velocity of the gas in region 4 cor- In order to compute v2 we use (92) responds to the velocity on the state at the left of a rarefaction wave moving to the right (89) 1 + v1 + 1 + v2 + A1 − A2 (v2) = 0, (186) 1 − v1 1 − v2 (1 + v )A− − (1 − v )A− v = 6 6 6 4 , (179) 4 − − where using (76), (94) and (95) (1 + v6)A6 + (1 − v6)A4

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 47

where according to (76), (94) and (95)

"√ #+2(Γ−1)−1/2 + "√ #−2(Γ−1)−1/2 Γ − 1 + cs,(1,2) − + Γ − 1 + cs,(5,6) A(1,2) = √ + , (187) − Γ − 1 − c A(5,6) = √ − , (199) s,(1,2) Γ − 1 − c s s,(5,6) µ ¶ s µ ¶ + Γp1 p1 Γ Γp p Γ cs,1 = , h1 = 1 + (188) − 6 6 ρ1h1 ρ1 Γ − 1 cs,6 = , h6 = 1 + , (200) ρ6h6 ρ6 Γ − 1 + ξ + c − + v2 − ξ s,2 ξ − c c = ⇒ v2 = . (189) − v5 − ξ s,5 s,2 + c = − ⇒ v5 = , (201) 1 − v2ξ 1 + cs,2ξ s,5 − 1 − v5ξ 1 − cs,5ξ

where ξ = (x − x0)/t. In this way, Eq. (186) is tran- where ξ = (x − x0)/t. Again (198) is a transcendental scendental and has to be solved equivalently for v2 or − − + equation either for v5 or for cs,5. Once cs,5 has been for cs,2 using a root finder for each point of region 2. + calculated use (201) to construct v5 or directly solve We solve for cs,2 and construct v2 using (189). Finally (198) for v5. It is possible to calculate ρ5 using (82): we calculate ρ2 using Eq. (82):

1 1 p6 ρ = , ρ5 = · µ ¶¸ 1 ,K = Γ , 2 · µ ¶¸ 1 Γ−1 ρ Γ−1 1 1 6 1 1 KΓ − − KΓ + − (c )2 Γ−1 (c )2 Γ−1 s,5 s,2 (202) p1 and finally the pressure K = Γ . (190) ρ1 µ ¶Γ ρ5 Finally we obtain p2 using p5 = p6 . (203) ρ6 µ ¶ ρ Γ p = p 2 . (191) 2 1 ρ 1 6. Region 6 is defined by tξh5 < x − x0. In this region the solution is simply 3. Region 3 is defined by the condition tξt2 < x − x0 <

tVcontact, where Vcontact = λo = v3 = v4. The solution pexact = p6, (204) there reads vexact = v6, (205)

pexact = p3, (192) ρexact = ρ6. (206)

vexact = v3, (193)

ρexact = ρ3. (194) As an example we show in Fig. 11 the primitive variables at t = 0.25, for the initial parameters in Table II.

4. Region 4 is defined by the condition tVcontact < x − x0 < tξt5, where ξt5 is the third characteristic value calculated at the tail of rarefaction moving to the right, and according to (91) ξt5 = (v4 + cs,4)/(1 + v4cs,4). In this region thus

pexact = p4, (195)

vexact = v4, (196)

ρexact = ρ4. (197)

5. Region 5 is defined by the condition tξt5 < x − x0 < tξh5, where ξh5 = (v6 + cs,6)/(1 + v6cs,6) according to (90). In order to compute v5 we use (93)

IGURE 1 + v5 − 1 + v6 − F 11. Exact solution for the Rarefaction-Rarefaction case at A5 (v5) − A6 = 0, (198) time t = 0.25 for the parameters in Table II. 1 − v5 1 − v6

Rev. Mex. Fis. E 59 (2013) 28–50 48 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´ q 3.4.4. Shock-Shock 2 where Ws,2 = 1/ 1 − Vs,2 is the Lorentz factor of the shock moving to the left. In this particular case we dis- We proceed as always, by establishing a relationship between tinguish between the two values of j depending using the the velocity in regions 3 and 4. We start by expressing v as 3 subindices 2 and 5. In order to obtain v in terms of p we the velocity of the gas on a region at the right from a shock 3 3 can proceed following these steps: moving to the left, that is, according to (110) Ws,2 • The rest mass density is given in terms of p using the h1W1v1 + (p3 − p1) 3 j2 v3 = ³ ´, (207) expression (120) as Ws,2v1 1 h1W1 + (p3 − p1) + j2 ρ1W1

p 2 2 1 −[p3(2σ − 1) + p1] + [p3(2σ − 1) + p1] + 4ζ3σ[p3(σ − 1) + p3p1] = 2 , (208) ρ3 2σ[p3(σ − 1) + p3p1]

1 σ 2 Γ ζ3 = [p1(2σ − 1) + p3] + 2 [p1(σ − 1) + p3p1], where σ = . (209) ρ1 ρ1 Γ − 1

• Once ρ3 is given in terms of p3 it is possible to compute enthalpy in region 3 as h3 = 1 + σ(p3/ρ3). in terms of p3 and the known state in region 1 using • Then from Eq. (115) we obtain (207).

2 (p3 − p1) Using the information of the shock moving to the right j2 = − h h , (210) 3 − 1 we obtain the velocity at the left from the shock, that is v4 ρ3 ρ1 using (109) where we choose j2 to be the negative root since the Ws,5 shock is moving to the left; here h1 = 1 + σ(p1/ρ1). h6W6v6 + (p4 − p6) j5 v4 = ³ ´, (212) Ws,5v6 1 • Once j2 is obtained, the shock velocity can be found h6W6 + (p4 − p6) + j5 ρ6W6 from expression (112) in terms of p3 as p q 2 2 2 2 2 ρ W v − |j | j + ρ where Ws,5 = 1/ 1 − Vs,5 is the Lorentz factor of the V = 1 1 1 2 2 1 . (211) s,2 2 2 2 shock. In order to obtain v in terms of p we need to perform j2 + ρ1W1 4 4 q the following steps: 2 • Finally we calculate Ws,2 = 1/ 1 − Vs,2 and thus v3 • The rest mass density is given in terms of p4 using the expression (119) as

p 2 2 1 −[p4(2σ − 1) + p6] + [p4(2σ − 1) + p6] + 4ζ4σ[p4(σ − 1) + p4p6] = 2 , (213) ρ4 2σ[p4(σ − 1) + p4p6]

1 σ 2 Γ ζ4 = [p6(2σ − 1) + p4] + 2 [p6(σ − 1) + p4p6], where σ = . (214) ρ6 ρ6 Γ − 1

• Once ρ4 is given in terms of p4, we are able to compute p enthalpy in region 4 as h4 = 1 + σ(p4/ρ4). 2 2 2 2 ρ6W6 v6 + |j5| j5 + ρ6 Vs,5 = 2 2 2 . (216) • Then Eq. (115) reads j5 + ρ6W6 (p − p ) j2 = − 4 6 , (215) q 5 h4 h6 2 − • Finally we calculate Ws,5 = 1/ 1 − Vs,5 and in this ρ4 ρ6 way we can obtain v in terms of p with (212) and the here h = 1+σ(p /ρ ). In this case, since the shock is 4 4 6 6 6 known state in region 6. moving to the right we choose the j5 to be the positive root. According to the contact discontinuity condition v3 = ∗ • Once j5 is obtained, the shock velocity can be found v4 = v , we equate (207) and (212) and obtain a transcen- from expression (111) dental equation for p∗:

Rev. Mex. Fis. E 59 (2013) 28–50 EXACT SOLUTION OF THE 1D RIEMANN PROBLEM IN NEWTONIAN AND RELATIVISTIC HYDRODYNAMICS 49

ρexact = ρ3.

4. Region 4 is defined by tVcontact < x − x0 < tVs,5 and the solution is

pexact = p4,

vexact = v4,

ρexact = ρ4.

5. There is no region 5, only the shock wave traveling with speed Vs,5.

FIGURE 12. Exact solution for a Shock-Shock case at time t = 0.5 6. Finally region 6 is defined by the condition Vs,5 < for the parameters in Table II. x − x0. The exact solution is given by the initial values at the chamber at the right:

Ws,2 ∗ pexact = p6, h1W1v1 + (p − p1) j³2 ´− ∗ Ws,2v1 1 vexact = v6, h1W1 + (p − p1) + j2 ρ1W1 ρ = ρ . Ws ∗ exact 6 h6W6v6 + (p − p6) j5³ ´ = 0, (217) ∗ Wsv6 1 As an example we show in Fig. 12 the primitive variables h6W6 + (p − p6) + j5 ρ6W6 at t = 0.55, for the initial parameters in Table II. which has to be solved using a root finder. Once this equation is solved, p and p are automati- 3 4 4. Final comments cally known, and v3 and v4 can be calculated using (207) ρ ρ and (212), respectively. It is possible to calculate 3 and 4 In this academic article we have described in detail the im- using (208) and (213), respectively. With this information plementation of the exact solution of the 1D Riemann in it is already possible to construct the solution in the whole the newtonian and relativistic regimes, which according to domain. our experience is not presented in a straightforward enough Up to this point we have the known initial states recipe in literature. (p , v , ρ ) (p , v , ρ ) 1 1 1 and 6 6 6 , the solution in regions 3 and The contents in this article can be used in various man- (p , v , ρ ) (p , v , ρ ) V 4 given by 3 3 3 and 4 4 4 , together with s,2 ners, specially to: i) test numerical solutions of the Newto- V and s,5 which represent the velocities of propagation of the nian Riemann problem in basic courses of hydrodynamics, shocks. ii) test numerical implementations of codes solving hydro- 1. Region 1 is defined by the condition x − x0 < tVs,2, dynamical relativistic equations, iii) understand the different where the velocity of the shock is (211). The solution properties of the propagation of the different type of waves there is that of the initial values of the variables on the developing in a gas and the different conditions on the hydro- left chamber: dynamical variables in each case. It is also helpful because with our approach it is possible p = p , exact 1 to straightforwardly implement the exact solution, and this vexact = v1, will save some time to a student starting a career in astro- physics involving hydrodynamical processes. ρexact = ρ1. 2. There is no region 2, only the shock wave traveling at Acknowledgments speed Vs,2. This research is partly supported by grants: CIC-UMSNH- 3. Region 3 is defined by the condition tVs,2 < x − x0 < 4.9,4.23 and CONACyT 106466. (J.P.C-P and F.D.L-C) tVcontact, where the velocity of the contact discontinu- acknowledge support from the CONACyT scholarship pro- 0 ity is the characteristic value λ = v evaluated in this gram. ∗ region Vcontact = v3 = v4 = v .

pexact = p3,

vexact = v3

Rev. Mex. Fis. E 59 (2013) 28–50 50 F. D. LORA-CLAVIJO, J. P. CRUZ-PEREZ,´ F. SIDDHARTHA GUZMAN,´ AND J. A. GONZALEZ´

1. E. F. Toro, Riemann solvers and numerical methods for fluid 4. R. J. LeVeque, in Numerical methods for conservation laws. dynamics. (Springer-Verlag Berlin-Heidelberg, 2009). (Birkhauser, Basel, 1992). 2. J. Ma. Mart´ı, E. Muller,¨ Living Rev. Relativity 6 (2003) 7. 5. G. A. Sod, J. Comp. Phys. 27 (1978) 1-31. http://www.livingreviews.org/lrr-2003-7 6. A. Taub, Phys. Rev. 74 (1948) 328-334. 3. J. Ma. Mart´ı, E. Muller,¨ J. Fluid. Mech. 258 (1994) 317-333. 7. K. S. Thorne, Astrophys. J. 179 (1973) 897-907.

Rev. Mex. Fis. E 59 (2013) 28–50