An exact solver for special relativistic riemann problems
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file srrp-1.0.1.tar.gz
.
File metadata
- Download URL: srrp-1.0.1.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
59c0e7e44d0a8560b322e4cd7014c85a3b1cc4fca9ccd441cde4adf534c0c9bb
|
|
MD5 |
7ef160d88c178c8b6e10ba44bd2e6b6f
|
|
BLAKE2b-256 |
a23a603b70a351ba945f1d52a5f5b1da1c48702e93ec2067d8b765c797661163
|
File details
Details for the file srrp-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: srrp-1.0.1-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1ca9c8d4ddfd403ee6b96379b0e125146590ed54aa0bd2538fce72371e783e22
|
|
MD5 |
4519e18cea0c44ab9040101d56d05539
|
|
BLAKE2b-256 |
937eca2e3fd9f07f2dbd6248317dca7a1dcc1328f0d9b58425d00540dbbc27e9
|