Skip to content

Commit

Permalink
Service release 1.5.1
Browse files Browse the repository at this point in the history
This fixes issues #26, issue #27, and issue #28
  • Loading branch information
Wolfgang Kastaun committed Feb 4, 2023
1 parent bf6370f commit 9ca95ef
Show file tree
Hide file tree
Showing 27 changed files with 49 additions and 40 deletions.
Binary file modified ET_interface/thorns/RePrimAnd/dist/RePrimAnd.tar
Binary file not shown.
4 changes: 4 additions & 0 deletions bindings/python/pyreprimand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,10 @@ All quantities are in the same geometric units used by the EOS.
py::vectorize(&etk::spherical_star::lambda_from_rc),
"Metric function lambda at circumf. radius",
py::arg("rc"))
.def("gm1_from_rc",
py::vectorize(&etk::spherical_star::gm1_from_rc),
"Pseudo enthalpy g - 1 at circumf. radius",
py::arg("rc"))
.def("mbary_from_rc",
py::vectorize(&etk::spherical_star::mbary_from_rc),
"Baryonic mass within circumf. radius",
Expand Down
4 changes: 2 additions & 2 deletions library/BasicStuff/include/unitconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class units {
static units geom_udensity(double udensity,
double g_si=G_SI)
{
return geom_ulength( c_SI / std::sqrt(g_si * udensity));
return geom_ulength( c_SI / std::sqrt(g_si * udensity), g_si);
}

/**\brief Compute units with G=c=1 and given mass unit
Expand All @@ -118,7 +118,7 @@ class units {
**/
static constexpr units geom_umass(double umass, double g_si=G_SI)
{
return geom_ulength(umass * g_si /(c_SI*c_SI));
return geom_ulength(umass * g_si /(c_SI*c_SI), g_si);
}

/**\brief Compute units with G=c=1 and the mass unit is the solar mass
Expand Down
5 changes: 2 additions & 3 deletions library/EOS_Barotropic/eos_barotr_gpoly.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ real_t eos_barotr_gpoly::hm1(real_t gm1) const
}

/**
\return Soundspeed squared \f$ c_s^2 = \frac{h-1}{nh} \f$
\return Soundspeed squared \f$ c_s^2 = \frac{g-1}{ng} \f$
*/
real_t eos_barotr_gpoly::csnd(real_t gm1) const
{
real_t h1 = hm1(gm1);
real_t cs2 = h1/(n*(h1+1));
real_t cs2 = gm1/(n*(gm1+1));
return sqrt(cs2);
}

Expand Down
56 changes: 39 additions & 17 deletions library/NeutronStar/TOV/tidal_deform_ode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,47 @@ tidal_ode::tidal_ode(eos_barotr eos_, real_t gm1_center_,
"computed for isentropic EOS"));
}

std::vector<real_t> revrho;
for (auto i = dnu_.rbegin(); i != dnu_.rend(); ++i)
std::vector<real_t> revrho, revlambda, revdnu, revrsqr, revmbr3;

auto ilambda = lambda_.rbegin();
auto irsqr = rsqr_.rbegin();
for (auto idnu = dnu_.rbegin(); idnu != dnu_.rend(); ++idnu)
{
real_t gm1{ gm1_from_dnu(*i) };
assert(ilambda != lambda_.rend());
assert(irsqr != rsqr_.rend());

real_t dnu{ *idnu };
real_t lambda{ *ilambda++ };
real_t rsqr{ *irsqr++ };

real_t gm1{ gm1_from_dnu(dnu) };
auto s{ eos.at_gm1(eos.range_gm1().limit_to(gm1)) };

assert(s);
revrho.push_back(s.rho());
assert(lambda >= 0.0);
assert(rsqr >= 0.0);

real_t rho{ s.rho() };
real_t rho_e{ rho * (1.0 + s.eps()) };
real_t mbr3{ m_by_r3(rsqr, lambda, rho_e) };

revrho.push_back(rho);
revlambda.push_back(lambda);
revdnu.push_back(dnu);
revrsqr.push_back(rsqr);
revmbr3.push_back(mbr3);
}


const std::vector<real_t> revdnu(dnu_.rbegin(), dnu_.rend());

const std::vector<real_t> revlambda(lambda_.rbegin(), lambda_.rend());
const std::vector<real_t> revrsqr(rsqr_.rbegin(), rsqr_.rend());

dnu_rho = make_interpol_pchip_spline(revrho, revdnu);

lambda_rho = make_interpol_pchip_spline(revrho, revlambda);

rsqr_rho = make_interpol_pchip_spline(revrho, revrsqr);

mbr3_rho = make_interpol_pchip_spline(revrho, revmbr3);


assert(x_start()>x_end());
}

Expand Down Expand Up @@ -111,21 +132,20 @@ auto tidal_ode::drho_y(real_t rho_, real_t ym2) const -> real_t
real_t cs2{ std::pow(s.csnd(), 2) };

real_t rho_e{ rho * (1.0 + eps) };

real_t lambda{ lambda_rho(rho) };
assert(lambda_rho.range_x().contains(rho));
real_t lambda{ std::max(0.0, lambda_rho(rho)) };
real_t e2l{ std::exp(2.0 * lambda) };
real_t rsqr{ rsqr_rho(rho) };
real_t wtfac{ cs2 / rho };


real_t mbyr3{ m_by_r3(rsqr, lambda, rho_e) };
real_t mbyr3{ mbr3_rho(rho) };

real_t a{ 4.0*PI * p + mbyr3 };
real_t b{ 2.0 * rsqr * (mbyr3 + 2.0*PI * (p - rho_e)) };
real_t c{ 4.0*PI * (3.0 * rho_e + 11.0 * p) - 8.0 * mbyr3 };
real_t d{ 4.0 * rsqr * wtfac * e2l * a };
real_t g{ (ym2+2.0 + 3.0) / e2l + b };


real_t f{0.0};
if (rsqr>0) {
f = wtfac * ym2 / rsqr;
Expand All @@ -134,9 +154,11 @@ auto tidal_ode::drho_y(real_t rho_, real_t ym2) const -> real_t
f = (-4.0*PI/7.0) * (
(11.0 * h - (32.0/3.0) * (1.0 + eps) ) * cs2 + h);
}


return (4.0*PI * h + (f * g + wtfac * c)) / a - d;


real_t res{ (4.0*PI * h + (f * g + wtfac * c)) / a - d };
assert(std::isfinite(res));
return res;
}

auto tidal_ode::initial_data() const -> state_t
Expand Down
1 change: 1 addition & 0 deletions library/NeutronStar/TOV/tidal_deform_ode.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class tidal_ode {
interpolator dnu_rho;
interpolator lambda_rho;
interpolator rsqr_rho;
interpolator mbr3_rho;

auto gm1_from_dnu(real_t dnu) const -> real_t;

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

project('RePrimAnd', ['cpp','c'], default_options : ['cpp_std=c++11'],
version : '1.5', license : 'CC BY-NC-SA 4.0')
version : '1.5.1', license : 'CC BY-NC-SA 4.0')

project_headers_dest = 'reprimand'

Expand Down
Binary file modified tests/data/ref_tov_m14_APR4_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_m14_H4_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_m14_H4_Read_PP.spline.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_m14_MPA1_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_m14_MS1_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_m14_WFF1_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_max_APR4_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_max_H4_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_max_H4_Read_PP.spline.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_max_MPA1_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_max_MS1_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tov_max_WFF1_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tovseq_APR4_EPP.h5
Binary file not shown.
Binary file modified tests/data/ref_tovseq_APR4_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tovseq_H4_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tovseq_H4_Read_PP.spline.h5
Binary file not shown.
Binary file modified tests/data/ref_tovseq_MPA1_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tovseq_MS1_Read_PP.h5
Binary file not shown.
Binary file modified tests/data/ref_tovseq_WFF1_Read_PP.h5
Binary file not shown.
17 changes: 0 additions & 17 deletions tests/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,3 @@ src_gen_tov = ['gen_tov_ref_data.cc']
exe_gen_tov = executable('gen_tov_ref_data', sources : src_gen_tov,
dependencies : [dep_reprim, dep_json])


if get_option('build_python_api')
if py3_inst.found()
pytov_test_script = files('test_python_tov.py')
test('PYTOV',
py3_inst,
args : [pytov_test_script, eos_dir],
env : ['PYTHONPATH=' + pyreprimand_path])

pyeos_test_script = files('test_python_eos.py')
test('PYEOS',
py3_inst,
args : [pyeos_test_script, eos_dir],
env : ['PYTHONPATH=' + pyreprimand_path])

endif
endif

0 comments on commit 9ca95ef

Please sign in to comment.