Numerical Methods for Conservation Laws.

Page 29

viscousShockPlot[wl_, wr_, ϵ_] := 
      Plot[wr + 
          (((wl - wr))/2) 
            (1 - Tanh[(((wl - wr))/(4 ϵ)) θ ]), {
          θ, -3, 3}];

Table[viscousShockPlot[2, 0, (1/(10^i))], {i, 0, 3}];

Page 72

\(Solve[{m\&~ - m\&^ == s \((ρ\&~ - ρ\&^)\), 
		
          \((m\&~\^2\/ρ\&~ + \(a\^2\) ρ\&~)\) - 
              \((m\&^\^2\/ρ\&^ + \(a\^2\) ρ\&^)\) == 
            s \((m\&~ - m\&^)\)}, 
	{m\&~, s}] // Simplify\)

\({{m\&~ -> 
          \(m\&^\ ρ\&~\)\/ρ\&^ + 
            \((a\ \((ρ\&^ - ρ\&~)\)\ \@ρ\&~)\)\/\@ρ\&^, 
        s -> m\&^\/ρ\&^ - \(a\ \@ρ\&~\)\/\@ρ\&^}, {
        m\&~ -> 
          \(m\&^\ ρ\&~\)\/ρ\&^ - 
            \((a\ \((ρ\&^ - ρ\&~)\)\ \@ρ\&~)\)\/\@ρ\&^, 
        s -> m\&^\/ρ\&^ + \(a\ \@ρ\&~\)\/\@ρ\&^}}\)

Eigensystem[{{v, 1}, {ϕ, v}}]

\(Solve[

        	{\(v\&^\)\^2\/2 + \(ϕ\&^\) + \(-\(v\&~\)\^2\)\/2 - 
              \(ϕ\&~\) == s \((\(v\&^\) - \(v\&~\))\), 

          \(v\&^\)\ \(ϕ\&^\) - \(v\&~\)\ \(ϕ\&~\) == 
            s \((\(ϕ\&^\) - \(ϕ\&~\))\)}, 
{\(v\&~\), s}] // 
      Simplify\)

\(\(Out[2] /. {\(ϕ\&~\) -> \(ϕ\&^\) \((1 + ξ)\)} // Simplify
        \) // PowerExpand\)

Plot[ρ + (ρ - 1) (Sqrt[ρ]), {ρ, 0, 3}];

\(\(Plot[{ρ - ρ\ Log[ρ], 
		
        ρ + ρ\ Log[ρ]}, {ρ, 10\^\(-2\), 3}]; \)\)

\(DSolve[{\(ρ'\)[ξ] == ρ[ξ]\/a, 
        \(m'\)[ξ] == m[ξ]\/a + ρ[ξ], 
		
        ρ[ξ\_1] == rowl, m[ξ\_1] == mleft}, {ρ[ξ], 
        m[ξ]}, ξ]\)

Solve[
        -a Log[((Subscript[ρ, m])/(Subscript[ρ, l]))] + ((Subscript[m, l])/(Subscript[ρ, l])) == 
          a Log[((Subscript[ρ, m])/(Subscript[ρ, r]))] + ((Subscript[m, r])/(Subscript[ρ, r])), (Subscript[ρ, m])] // 
      Simplify

\(m = {{0, 1, 0}, 

            		{\(1\/2\) \((γ - 3)\) v\^2, \((3 - γ)\) v, 
              \((γ - 1)\)}, 

            		{\(1\/2\) \((γ - 1)\) v\^3 - v \((e + p)\)\/ρ, 
              \((e + p)\)\/ρ - \((γ - 1)\) v\^2, γ\ v}}
             /. {e -> p\/\(γ - 1\) + \(1\/2\) ρ\ v\^2} // 
        Simplify; 
Eigenvectors[m] // Simplify\)

Out[30] /. {e -> (p/(γ - 1)) + (1/2) ρ (v^2)} // 
      Simplify

PowerExpand[Out[32]] // Simplify

Solve[
      ((Subscript[ρ, m]) ((Subscript[m, l])/(Subscript[ρ, l])) - 
              (Sqrt[((Subscript[ρ, m])/(Subscript[ρ, l]))]) ((Subscript[ρ, m]) - (Subscript[ρ, l])) == 
            (Subscript[ρ, m]) ((Subscript[m, r])/(Subscript[ρ, r])) + 
              (Sqrt[((Subscript[ρ, m])/(Subscript[ρ, r]))]) ((Subscript[ρ, m]) - (Subscript[ρ, r])))
           /. {(Subscript[ρ, l]) -> .28260, (Subscript[m, l]) -> .098185, (Subscript[ρ, r]) -> .2, 
          (Subscript[m, r]) -> 0}, {(Subscript[ρ, m])}]

(Subscript[ρ, m]) ((Subscript[m, l])/(Subscript[ρ, l])) - 
        (Sqrt[((Subscript[ρ, m])/(Subscript[ρ, l]))]) ((Subscript[ρ, m]) - (Subscript[ρ, l])) /. 
      Join[{(Subscript[ρ, l]) -> .28260, (Subscript[m, l]) -> .098185, (Subscript[ρ, r]) -> .2, 
          (Subscript[m, r]) -> 0}, Out[2][[2]]]

Page 79

Eigensystem[{{v, 1}, {ϕ, v}}]

\(\(eqs = {
        \(v\&~\)\^2\/2 + \(ϕ\&~\) - \(v\&^\)\^2\/2 - \(ϕ\&^\) == 
          s \((\(v\&~\) - \(v\&^\))\), 
        \(ϕ\&~\)\ \(v\&~\) - \(ϕ\&^\)\ \(v\&^\) == 
          s \((\(ϕ\&~\) - \(ϕ\&^\))\)}; \)\)

\(Solve[eqs, {\(v\&~\), \(ϕ\&~\)}] // Simplify\)

\(Solve[eqs, {\(v\&~\), s}] // Simplify\)

\(Solve[eqs, {\(ϕ\&~\), s}] // Simplify\)

It looks like the second expression is the cleanest...

\(D[{\(v\&^\) + \(\@\(ϕ\&^\)\) ξ\/\@\(1 + ξ\/2\), 
          \(ϕ\&^\) \((1 + ξ)\)}, ξ] /. {ξ -> 0}\)\(D[{\(v\&^\) - \(\@\(ϕ\&^\)\) ξ\/\@\(1 + ξ\/2\), 
          \(ϕ\&^\) \((1 + ξ)\)}, ξ] /. {ξ -> 0}\)

Solve[
        (Subscript[v, l]) - (Sqrt[2]) 
              ((((Subscript[ϕ, m]) - (Subscript[ϕ, l])))/(Sqrt[(Subscript[ϕ, l]) + (Subscript[ϕ, m])])) == 
          (Subscript[v, r]) + (Sqrt[2]) 
              ((((Subscript[ϕ, m]) - (Subscript[ϕ, r])))/(Sqrt[(Subscript[ϕ, r]) + (Subscript[ϕ, m])])), 
        (Subscript[ϕ, m])] // Simplify

Page 84

For isothermal equations the eigenvalues and eigenvectors are

Eigensystem[{{0, 1}, {(a^2) - ((m^2)/(ρ^2)), 2  (m/ρ)}}] // 
      Simplify

Then ∇(Subscript[λ, 1]) =

grad1 = {(∂_ρ) (Subscript[λ, 1]), (∂_m) (Subscript[λ, 1])}

\(denom1 = grad1 . {ρ\/\(m - a\ ρ\), 1} // Simplify; 

    denom1 = denom1 /. {ρ -> ρ[ξ], m -> m[ξ]}\)

The first differential equation is

((ρ[ξ]/(m[ξ] - a ρ[ξ]))/denom1) // Simplify

same as equation 8.12

(1/denom1) // Simplify

Page 127

(1/k) (Series[u[x, t + k], {k, 0, 3}] - u[x, t]) + 
      (1/h) u[x, t] (u[x, t] - Series[u[x - h, t], {h, 0, 4}])

(1/k) (Series[u[x, t + k], {k, 0, 3}] - u[x, t]) + 
      (1/(2 h)) 
        (Series[f[u[x + h, t]], {h, 0, 3}] - 
            Series[f[u[x - h, t]], {h, 0, 3}])

\(Series[
        \(1\/k\) \((u[x, t + k] - u[x, t])\) + 
          \(1\/\(2\ h\)\) \((f[u[x + h, t]] - f[u[x - h, t]])\) - 
          \(k\/\(2\ h\^2\)\) 
            \((\(f'\)[\(1\/2\) \((u[x, t] + u[x + h, t])\)]\ 
                  \((f[u[x + h, t]] - f[u[x, t]])\) - 
                \(f'\)[\(1\/2\) \((u[x, t] + u[x - h, t])\)]\ 
                  \((f[u[x, t]] - f[u[x - h, t]])\))\), 

        		{k, 0, 2}, {h, 0, 2}] // Simplify\)

Coefficient[Out[21], (h^1)]

Out[21]/.{Derivative[0, 1][u][x, t]->-f'[u[x, t]] Derivative[1, 0][u][x, t]}//Simplify

Out[23]/.{Derivative[0, 2][u][x, t]->2 f''[u[x, t]] f'[u[x, t]] ((Derivative[1, 0][u][x, t])^2)+f'[u[x, t]]^2Derivative[2, 0][u][x, t]}//Simplify

Series[f'[(1/2) (u[x, t] + u[x - h, t])], {h, 0, 2}]

u[x, t] + Series[u[x + h, t], {h, 0, 3}]

Factor[2 - 3  x + (x^2)]

Plot[%, {x, 0, 4}];

(1/k) 
        (Series[u[x, t + k], {k, 0, 3}] - 
            (1/2) 
              (Series[u[x - h, t], {h, 0, 3}] + 
                  Series[u[x + h, t], {h, 0, 3}])) + 
      (1/(2  h)) A 
        (Series[u[x + h, t], {h, 0, 3}] - Series[u[x - h, t], {h, 0, 3}])