Numerical scheme to 1D advection equation

604 Views Asked by At

I am trying to numerically solve a system of equations which model the early universe in 1D. The equations I am stuck on are;

$$ (1)\quad \partial\rho/\partial t + \partial(\rho v)/\partial x = 0 $$ $$ (2)\quad \rho(\partial v/\partial t)+\rho v(\partial v/\partial x) = \rho g-T(\partial\rho/\partial x) $$ where $\rho$ (density), $\ v$ (a velocity) and $\ g$ (gravitational field) are functions of $\ (x,t)$ and $\ T$ is a constant temperature.

I have $\ g$, but I do not know where to go in $\ (2)$. I have studied a simple upwind scheme, and a Lax-Wendroff scheme for linear equations, but this is the first non-linear equation I have attempted to solve. I have derived schemes similar to these with my equations, but have noticed that these are not considered as 'conservative', which I think is needed in my model.

My attempts

I have found conservative schemes (in particular, one called Lax-Wendroff!), which I believe I am able to apply to $\ (1)$, but not $\ (2)$. I have a problem with the $\rho$ term which is appearing in $\ (2)$, but I am hoping I can divide through by the $\rho$ term and derive an equation. Also, I am not quite sure on how to deal with the non-zero source term. I can follow the derivation of this scheme with my slightly different equation, however, I cannot derive any stability or correctness from this with my knowledge. So I am wondering if someone could help with any appropriate schemes.

Edit

So far, I have solved for (2) using the Lax-Wendroff scheme which is conservative by rewriting it to look like Burger's equation with a source term. Now, I am having problems solving (1)! I do not think I can use the same approach, as if I write f($\rho$) = $\rho v$, I then need to find f', which I suppose should be $\ v$. But this seems very wrong to me. In the derivation of Lax-Wendroff, it says this is an approximation of the change of f with respect to $\rho$. Can anyone tell me if $\ v$ is appropriate here?

Also, at the moment, the system is moving to the one side, which I know is not is not correct. Does anyone know why this would be happening?