Special Relativistic Riemann Problem Solver
One-dimensional Riemann problems have been proven to be useful tools to benchmark numerical hydrodynamic codes since they can be solved to arbitrary precision. This library implements such a solver for special relativistic hydrodynamics based on the scheme presented by Rezzolla et al. (2003) [doi: 10.1017/S0022112002003506].
Installation
This package can be obtained via pypi
pip install srrp
Example Usage
The solution of a Riemann Problem producing a rarefaction-shock pattern could look like the following code (see also examples/rarefaction-shock.py)
import matplotlib.pyplot as plt
import numpy as np
import srrp
'''
Reproduction of (parts of) Figure 3 from
Rezzolla, Zanott, Pons (2003), J.Fluid Mech. 479, 199
DOI: 10.1017/S0022112002003506
'''
if __name__ == '__main__':
gamma = 5/3
stateL = srrp.State(rho=1, pressure=1, vx=0.5, vt=0)
stateR = srrp.State(rho=0.125, pressure=0.1, vx=0, vt=0)
xs = np.linspace(0, 1, 500)
t = 0.4
x0 = 0.5
solver = srrp.Solver()
solution = solver.solve(stateL, stateR, gamma)
for wave in solution.waves:
print(wave)
for idx, state in enumerate(solution.states):
print(f'{idx}: {state}')
xis = (xs - x0) / t
states = solution.getState(xis)
plt.plot(xs, states.rho, label="rho")
plt.plot(xs, states.pressure, label="pressure")
plt.plot(xs, states.vx, label="vx")
plt.plot(xs, states.vt, label="vt")
plt.legend(loc='upper right')
plt.grid(True, ls='--')
plt.xlabel('x')
plt.show()
For more examples visit the examples folder.
Release files for srrp 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| srrp-1.0.1.tar.gz | 8.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| srrp-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.1 kB
Release files / srrp-1.0.1.tar.gz
| Download URL | srrp-1.0.1.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59c0e7e44d0a8560b322e4cd7014c85a3b1cc4fca9ccd441cde4adf534c0c9bb
|
|
BLAKE2b-256 checksum How to use checksums |
a23a603b70a351ba945f1d52a5f5b1da1c48702e93ec2067d8b765c797661163
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5
|
Release files / srrp-1.0.1-py3-none-any.whl
| Download URL | srrp-1.0.1-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ca9c8d4ddfd403ee6b96379b0e125146590ed54aa0bd2538fce72371e783e22
|
|
BLAKE2b-256 checksum How to use checksums |
937eca2e3fd9f07f2dbd6248317dca7a1dcc1328f0d9b58425d00540dbbc27e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5
|