https://github.com/jborrow/sph1dtests
Tests for various SPH schemes ('classical' and 'Pressure-Entropy') in 1D.
https://github.com/jborrow/sph1dtests
Last synced: 3 months ago
JSON representation
Tests for various SPH schemes ('classical' and 'Pressure-Entropy') in 1D.
- Host: GitHub
- URL: https://github.com/jborrow/sph1dtests
- Owner: JBorrow
- Created: 2017-11-13T18:24:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-05T11:41:36.000Z (over 7 years ago)
- Last Synced: 2024-12-27T06:41:29.605Z (5 months ago)
- Language: Jupyter Notebook
- Size: 611 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
SPH Tests
=========Several SPH tests that look at the diferences between tradiational and 'Pressure-Entropy' SPH.
This module and the notebooks included require `python3`.
To use the API objects, you can do the following:
```python
from sphtests import PressureEntropyDatadata = PressureEntropyData(
positions, # A list of positions in 1D,
energies=E, # A list of internal energies of your particles,
eta=eta, # The kernel eta (for the GADGET2 Kernel -- try 50. Default is 5.)
)# You can then access the TSPH properties as follows:
tsph_data = data.gadget
# This object contains:
densities = tsph.densities
pressures = tsph.pressures
hsml = tsph.smoothing_lengths# Then, the Pressure Entropy stuff can be accessed as follows:
adiabats = data.adiabats
smoothed_P = data.smoothed_pressures
smoothed_rho = data.smoothed_densities# Note that you can also specify adiabats rather than energy as follows:
data_adiabat = PressureEntropyData(
positions,
adiabats=A,
eta=eta,
)
```Users can also choose their own Kernels. There are two Kernels available with
this module; the one used in GADGET-2 (re-normalized for 1D use), or the C_2
kernel used in ANARCHY. They can be used as follows:```python
import sphtests.sph as sphdata = PressureEntropyData(
...
kernel=sph.gadget_kernel,
)# or
data = PressureEntropyData(
...
kernel=sph.ANARCHY_kernel,
)
```Users can also define their own kernels. Note that their functions should have
units of 1/length, and have the following structure:```python
def my_kernel(r, h):
"""
+ r is the interparticle separation,
+ h is the smoothing length,
"""
return ...
```