Skip to content

Commit

Permalink
Release 1.7
Browse files Browse the repository at this point in the history
* Tuned various details of TOV/tidal deformability computation to improve accuracy
  and robustness
* Improved error model for TOV solutions, calibrated with many tests
* One can now specify the desired accuracy for TOV properties (no more exposure to
  accuracy-related technical parameters of the implementation)
* Finding stable TOV branch now more robust in corner cases
* Fixed issue #34. Tidal deformability now accurate also for very small compactness.
* Added small collection of EOS files from nuclear physics
* Documentation: corrections and improvements
* Use keyword-only arguments in parts of Python API to prevent common typos

Backward-incompatible interface changes for TOV solvers, TOV accuracy
specification, and NS TOV branch finding.
  • Loading branch information
Wolfgang Kastaun committed Feb 4, 2024
1 parent f52a46e commit 750f466
Show file tree
Hide file tree
Showing 124 changed files with 2,600 additions and 1,122 deletions.
54 changes: 42 additions & 12 deletions EOS/create/make_read_pp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/env python
import numpy as np
import pyreprimand as pyr

Expand Down Expand Up @@ -45,13 +44,11 @@ def matching_ds(rho_bnd, ds_j, ga_j, ga_i):



def make_read_eos(name, p1_cgs, ga, rho_max_si=1e20):
def make_pp_eos(p1_si, rho_b_si, ga, rho_max_si=1e20):

p1_si = p1_cgs * CGS_PRESS

sly_ds_si, sly_ga, sly_rho_b_si = prep_sly()

rho_b_si = np.array([10**14.7, 1e15]) * CGS_DENS

dsx = sly_ds_si[-1]
gax = sly_ga[-1]
Expand All @@ -62,25 +59,52 @@ def make_read_eos(name, p1_cgs, ga, rho_max_si=1e20):
ga = np.hstack((sly_ga, ga))


path = f"{name}.eos.h5"

uc = pyr.units.geom_solar()
rho_poly = sly_ds_si[0] / uc.density
rho_b = rho_b_si / uc.density
rho_max = rho_max_si / uc.density

eos = pyr.make_eos_barotr_pwpoly(rho_poly, rho_b, ga, rho_max, uc)
pyr.save_eos_barotr(path, eos, "A piecewise polytropic EOS from [Read et al]")
eos_pp = pyr.make_eos_barotr_pwpoly(rho_poly, rho_b, ga, rho_max, uc)

rgrho2 = pyr.range(rho_b[1] / 2, eos.range_rho.max / 1.0000001)
rgrho2 = pyr.range(rho_b[1] / 2, eos_pp.range_rho.max / 1.0000001)
polyn2 = 1./ (ga[0] - 1.)
ppm2 = 200
eos2 = pyr.make_eos_barotr_spline(eos, rgrho2, polyn2, ppm2)
path2 = f"{name}.spline.eos.h5"
pyr.save_eos_barotr(path2, eos2, "A spline representation of a piecewise polytropic EOS from [Read et al]")
eos_tab = pyr.make_eos_barotr_spline(eos_pp, rgrho2, polyn2, ppm2)

return eos_pp, eos_tab
#

def make_read_eos(p1_cgs, ga):
p1_si = p1_cgs * CGS_PRESS
rho_b_si = np.array([10**14.7, 1e15]) * CGS_DENS
return make_pp_eos(p1_si, rho_b_si, ga)
#


def make_apr4_epp_eos():
ga = np.array([
2.830, 3.445, 3.348, # APR4 [Read]
3.0, 2.0 # ensure causality
])
p1_cgs = 10**34.269
p1_si = p1_cgs * CGS_PRESS
rho_b_si = np.array([10**14.7, 1e+15, 1.4e+15, 1.61e+15]) * CGS_DENS
return make_pp_eos(p1_si, rho_b_si, ga)
#

def save_eos(name, eos_pp,eos_tab):
path = f"{name}.eos.h5"
pyr.save_eos_barotr(path, eos_pp, "A piecewise polytropic EOS from [Read et al]")


path2 = f"{name}.spline.eos.h5"
pyr.save_eos_barotr(path2, eos_tab,
"A spline representation of a piecewise polytropic EOS from [Read et al]")
#



def make_read_cat():
params = {
'APR4':(10**34.269, [2.830, 3.445, 3.348]),
Expand All @@ -97,7 +121,13 @@ def make_read_cat():

for n,p in params.items():
name = f"{n}_Read_PP"
make_read_eos(name, *p)
eos = make_read_eos(*p)
save_eos(name, *eos)

def make_other_cat():
eos = make_apr4_epp_eos()
save_eos('APR4_Read_EPP', *eos)
print(*eos)

make_read_cat()
make_other_cat()
1 change: 0 additions & 1 deletion EOS/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

eos_dir = meson.current_source_dir()
subdir('create')
1 change: 1 addition & 0 deletions EOS/nuclear_physics_eos_collection/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* export-ignore
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified ET_interface/thorns/RePrimAnd/dist/RePrimAnd.tar
Binary file not shown.
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ library code is not platform-specific and should also work on Macs.
Windows and AIX are not supported. For use in HPC, users need to build
the library from source. For use in postprocessing, the Python intferface
can also be installed via pip (binary wheel of the library available for
Linux). Conda packages for the C++ library and Python intface are planned
but not available yet.
Linux). There is also an experimental conda package for the C++
library (Python interface not included yet).

## Requirements

Expand All @@ -41,8 +41,7 @@ To build the library,
```bash
cd <repository>
meson mbuild --buildtype=release --prefix=<custom install location>
cd mbuild
ninja
ninja -C mbuild
```

This will compile with optimization and without debug symbols. Other
Expand All @@ -52,18 +51,29 @@ with `CC=clang CXX=clang++`.
See [here](https://mesonbuild.com/Running-Meson.html) for general
Meson usage.

Note on Conda environments: if you build for a conda environment and meson
does not detect the boost library or the wrong version, use

```bash
BOOST_ROOT=$CONDA_PREFIX meson setup --prefix=$CONDA_PREFIX mbuild
```

Note on HDF5: meson and hdf5 do not play along nicely (partly caused by bad hdf5
packaging). Make sure there is a pkg-config file for the version you want to build
with. Another common cause is that you are building within a conda environment.
In that case prefixing `LD_LIBRARY_PATH` with `$CONDA_PREFIX/lib` might help.


## Installing

To install the library, use

```bash
cd mbuild
ninja install
ninja -C mbuild install
```

This will install in a user-defined location if the `--prefix` option
was given during the build setup, otherwise systemwide.
was given during the build setup, otherwise systemwide (not recommended).


## Using the Library
Expand Down Expand Up @@ -98,7 +108,7 @@ cd bindings/python
pip install .
```

This will also pip install packages numpy and pybind11>=2.6.0.
This will also pip install packages `numpy` and `pybind11>=2.6.0`.
When using conda environment, it may be better to install those
first using conda.

Expand All @@ -109,16 +119,14 @@ The Python extension module is called `pyreprimand`.
## Einstein Toolkit Support

RePrimAnd does provide a thorn that builds the library within
an EinsteinToolkit (ET) environment, using the ExternalLibraries mechanism. The
thorn can be found in the folder `ET_interface/thorns/RePrimAnd/`. The thorn
an EinsteinToolkit (ET) environment, using the ExternalLibraries mechanism.
The thorn is part of the official ET framework. The version in the master
brach of this repository may however be ahead of the ET version.
It can be found in the folder `ET_interface/thorns/RePrimAnd/`. The thorn
depends on the HDF5, GSL, and BOOST ExternalLibraries thorns. Building it via
the ET build system does not require meseon. Note this only builds the library,
the ET build system does not require meson. Note this only builds the library,
but not the tests and Python bindings.

The thorn is also part of the official ET framework. The version in the master
brach will typically by ahead of the ET version, but is not guaranteed to be
stable or compatible.

There are two experimental (and largely undocumented for now) thorns
that aim to simplifying the usage.
`RePrimAnd_Global_EOS` provides a centralized selection of a global thermal
Expand Down Expand Up @@ -192,7 +200,7 @@ The resulting pdf figures are placed in the build directory under

This requires Python+matplotlib.

### Visualizing Master Function
### Visualizing Con2Prim Master Function

In addition, there is code to sample the primitive recovery master
function (the central ingredient of the con2prim scheme) for various cases,
Expand Down
Loading

0 comments on commit 750f466

Please sign in to comment.