Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
haranjackson committed Nov 27, 2019
1 parent 2aa3325 commit 5019cda
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions docs/pages/example_code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Example Code
See more examples `here
<https://github.com/haranjackson/PyPDE/tree/master/pypde/tests>`_.

Reactive Euler
--------------
Reactive Euler (1D, S≠0)
------------------------

We must define our fluxes and source vector:

Expand All @@ -21,15 +21,18 @@ We must define our fluxes and source vector:
K0 = 250
gam = 1.4
@njit
def internal_energy(E, v, lam):
return E - (v[0]**2 + v[1]**2 + v[2]**2) / 2 - Qc * (lam - 1)
def F(Q, i):
r = Q[0]
E = Q[1] / r
v = Q[2:5] / r
lam = Q[5] / r
# internal energy
e = E - (v[0]**2 + v[1]**2 + v[2]**2) / 2 - Qc * (lam - 1)
e = internal_energy(E, v, lam)
# pressure
p = (gam - 1) * r * e
Expand Down Expand Up @@ -78,6 +81,8 @@ We now set out the initial conditions for the 1D detonation wave test. We use

.. code-block:: python
from numpy import inner, array
def energy(r, p, v, lam):
return p / ((gam - 1) * r) + inner(v, v) / 2 + Qc * (lam - 1)
Expand All @@ -97,8 +102,8 @@ We now set out the initial conditions for the 1D detonation wave test. We use
lamR = 1
ER = energy(rR, pR, vR, lamR)
QL = rL * ([1, EL] + vL)
QR = rR * ([1, ER] + vR)
QL = rL * array([1, EL] + vL + [lamL])
QR = rR * array([1, ER] + vR + [lamR])
u = zeros([nx, 6])
for i in range(nx):
Expand Down

0 comments on commit 5019cda

Please sign in to comment.