# Initialize a traveling wave in a 1D gas?

I am trying to initialize a traveling wave for a 1d simulation as one can see from the attached figure.

Such that it will be traveling to the right. However, I cannot initialize the right velocity profile, and this makes the initial pressure distribution tends to be more uniform to reach the same pressure of the surrounding fluid !

Can any one provide some support?

-
can show a diagram of how it breaks into two rarefaction waves? – udiboy1209 Nov 14 '13 at 14:38
@udiboy, sorry, I missexplained myself. see the Update – user2536125 Nov 14 '13 at 14:51
What is the medium in which the wave is propagating? And, more specifically, which model are you using for your simulation? – user23660 Nov 14 '13 at 15:08
@user23660 I am using the 1d euler equation, and the gas is simply air (ideal ). – user2536125 Nov 14 '13 at 15:10
Would scicomp.stackexchange.com be a better home for this question? – Qmechanic Nov 14 '13 at 17:50

We are trying to get the simple wave solution, so one can assume the dependence of the functions defining the solution (namely $u$, $p$ and $\rho$) only on a single combination of variables $x$ and $t$. In case of weak sound wave this combination would be $x - c t$, but nonlinear effects would makes this more complicated. Nevertheless, we still can choose one of the functions, for example $\rho$, as an independent variable on which the other two would depend and write $$\rho = \rho(x,t),\quad p= p(\rho), \quad u = u(\rho) .$$
We can than substitute these into continuity equation and Euler equation: $$\dot{\rho}+\rho' u + \rho \frac{d u}{d\rho} \rho ' = 0, \tag{1}$$ $$\frac{du}{d\rho}\dot{\rho}+ u \frac{du}{d\rho} \rho' + \frac{c^2(\rho)}{\rho}\rho ' =0,\tag{2}$$ where $\rho'= \dfrac{\partial \rho}{\partial x}$, $\dot{\rho}= \dfrac{\partial \rho}{\partial t}$. The local speed of sound is defined by $c^2(\rho)= \dfrac{d p}{d \rho}$ and could be found using adiabatic equation for an ideal gas.
For the initial conditions on the velocity $u$ we could solve (1) and (2) for $\frac{du}{d\rho}$ (also eliminating $\dot{\rho}$): $$\dfrac {du}{d\rho} = \pm \frac{c(\rho)}{\rho},$$ where two sign choices correspond to simple waves traveling to the right (+) and left (-). Integrating we obtain: $$u = \pm \int \frac{c}{\rho} d\rho = \pm \int \frac{dp}{\rho c}.$$ The final explicit result could be obtained by using the adiabatic process equation: $p \rho^{-\gamma}= p_0 \rho_0^{-\gamma}$.
That's what I used. Only instead of energy equation I used (equivalent for our purposes) adiabatic condition. The fact that the wave is traveling in one direction is expressed in dependence $u(\rho)$ and $p(\rho)$. – user23660 Nov 14 '13 at 17:30