next up previous
Next: Boundary Conditions Up: Project Lagrangian Previous: Project Lagrangian

The Difference Equations

The difference equations are,
$\displaystyle u_{n+\frac{1}{2}}^{(m+\frac{1}{2})}$ $\textstyle =$ $\displaystyle u_{n+\frac{1}{2}}^{(m-\frac{1}{2})} +
(P_{n}^{(m)} - P_{n+1}^{(m)})\delta t / \Delta m$ (2.51)
$\displaystyle x_{n+\frac{1}{2}}^{(m+1)}$ $\textstyle =$ $\displaystyle x_{n+\frac{1}{2}}^{(m)} +
u_{n+\frac{1}{2}}^{(m+\frac{1}{2})}
\delta t \quad ,$ (2.52)

where,
\begin{displaymath}
P_{n}^{(m)} = \mbox{constant} \times (\rho_{n}^{(m)})^\gamma \quad .
\end{displaymath} (2.53)

and,
\begin{displaymath}
\rho_{n}^{(m)} = \Delta m / {(x_{n+\frac{1}{2}}^{(m)} -
x_{n-\frac{1}{2}}^{(m)})} \quad ,
\end{displaymath} (2.54)

$x_{n+\frac{1}{2}}^{(m)}$ and $u_{n+\frac{1}{2}}^{(m)}$ are the positions and velocities of the cell boundaries. $\rho_{n}^{(m)}$ and $P_{n}^{(m)}$ are the densities and pressures in the cells. $\Delta m$ is the mass in each cell. It is useful for the purpose of programming to redefine things to get rid of the various half integer indices. Hence we can write the equations as
$\displaystyle u_{n}'^{(m+1)}$ $\textstyle =$ $\displaystyle u_{n}'^{(m)} +
(P_{n}^{(m)} - P_{n+1}^{(m)})\delta t / \Delta m$ (2.55)
$\displaystyle x_{n}'^{(m+1)}$ $\textstyle =$ $\displaystyle x_{n}'^{(m)} +
u_{n}'^{(m+1)}
\delta t$ (2.56)
$\displaystyle \rho_{n}^{(m)}$ $\textstyle =$ $\displaystyle \Delta m / {(x_{n}'^{(m)} -
x_{n-1}'^{(m)})} \qquad ,$ (2.57)

which maps more easily onto the arrays in a program.
next up previous
Next: Boundary Conditions Up: Project Lagrangian Previous: Project Lagrangian