Skip to content

Commit 9ca95ef

Browse files
author
Wolfgang Kastaun
committed
Service release 1.5.1
This fixes issues #26, issue #27, and issue #28
1 parent bf6370f commit 9ca95ef

27 files changed

+49
-40
lines changed
0 Bytes
Binary file not shown.

bindings/python/pyreprimand.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,10 @@ All quantities are in the same geometric units used by the EOS.
917917
py::vectorize(&etk::spherical_star::lambda_from_rc),
918918
"Metric function lambda at circumf. radius",
919919
py::arg("rc"))
920+
.def("gm1_from_rc",
921+
py::vectorize(&etk::spherical_star::gm1_from_rc),
922+
"Pseudo enthalpy g - 1 at circumf. radius",
923+
py::arg("rc"))
920924
.def("mbary_from_rc",
921925
py::vectorize(&etk::spherical_star::mbary_from_rc),
922926
"Baryonic mass within circumf. radius",

library/BasicStuff/include/unitconv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class units {
107107
static units geom_udensity(double udensity,
108108
double g_si=G_SI)
109109
{
110-
return geom_ulength( c_SI / std::sqrt(g_si * udensity));
110+
return geom_ulength( c_SI / std::sqrt(g_si * udensity), g_si);
111111
}
112112

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

124124
/**\brief Compute units with G=c=1 and the mass unit is the solar mass

library/EOS_Barotropic/eos_barotr_gpoly.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,11 @@ real_t eos_barotr_gpoly::hm1(real_t gm1) const
6868
}
6969

7070
/**
71-
\return Soundspeed squared \f$ c_s^2 = \frac{h-1}{nh} \f$
71+
\return Soundspeed squared \f$ c_s^2 = \frac{g-1}{ng} \f$
7272
*/
7373
real_t eos_barotr_gpoly::csnd(real_t gm1) const
7474
{
75-
real_t h1 = hm1(gm1);
76-
real_t cs2 = h1/(n*(h1+1));
75+
real_t cs2 = gm1/(n*(gm1+1));
7776
return sqrt(cs2);
7877
}
7978

library/NeutronStar/TOV/tidal_deform_ode.cc

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,47 @@ tidal_ode::tidal_ode(eos_barotr eos_, real_t gm1_center_,
6464
"computed for isentropic EOS"));
6565
}
6666

67-
std::vector<real_t> revrho;
68-
for (auto i = dnu_.rbegin(); i != dnu_.rend(); ++i)
67+
std::vector<real_t> revrho, revlambda, revdnu, revrsqr, revmbr3;
68+
69+
auto ilambda = lambda_.rbegin();
70+
auto irsqr = rsqr_.rbegin();
71+
for (auto idnu = dnu_.rbegin(); idnu != dnu_.rend(); ++idnu)
6972
{
70-
real_t gm1{ gm1_from_dnu(*i) };
73+
assert(ilambda != lambda_.rend());
74+
assert(irsqr != rsqr_.rend());
75+
76+
real_t dnu{ *idnu };
77+
real_t lambda{ *ilambda++ };
78+
real_t rsqr{ *irsqr++ };
79+
80+
real_t gm1{ gm1_from_dnu(dnu) };
7181
auto s{ eos.at_gm1(eos.range_gm1().limit_to(gm1)) };
82+
7283
assert(s);
73-
revrho.push_back(s.rho());
84+
assert(lambda >= 0.0);
85+
assert(rsqr >= 0.0);
86+
87+
real_t rho{ s.rho() };
88+
real_t rho_e{ rho * (1.0 + s.eps()) };
89+
real_t mbr3{ m_by_r3(rsqr, lambda, rho_e) };
90+
91+
revrho.push_back(rho);
92+
revlambda.push_back(lambda);
93+
revdnu.push_back(dnu);
94+
revrsqr.push_back(rsqr);
95+
revmbr3.push_back(mbr3);
7496
}
7597

7698

77-
const std::vector<real_t> revdnu(dnu_.rbegin(), dnu_.rend());
78-
79-
const std::vector<real_t> revlambda(lambda_.rbegin(), lambda_.rend());
80-
const std::vector<real_t> revrsqr(rsqr_.rbegin(), rsqr_.rend());
81-
8299
dnu_rho = make_interpol_pchip_spline(revrho, revdnu);
83100

84101
lambda_rho = make_interpol_pchip_spline(revrho, revlambda);
85102

86103
rsqr_rho = make_interpol_pchip_spline(revrho, revrsqr);
104+
105+
mbr3_rho = make_interpol_pchip_spline(revrho, revmbr3);
106+
107+
87108
assert(x_start()>x_end());
88109
}
89110

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

113134
real_t rho_e{ rho * (1.0 + eps) };
114-
115-
real_t lambda{ lambda_rho(rho) };
135+
assert(lambda_rho.range_x().contains(rho));
136+
real_t lambda{ std::max(0.0, lambda_rho(rho)) };
116137
real_t e2l{ std::exp(2.0 * lambda) };
117138
real_t rsqr{ rsqr_rho(rho) };
118139
real_t wtfac{ cs2 / rho };
119-
120-
121-
real_t mbyr3{ m_by_r3(rsqr, lambda, rho_e) };
140+
real_t mbyr3{ mbr3_rho(rho) };
122141

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

148+
129149
real_t f{0.0};
130150
if (rsqr>0) {
131151
f = wtfac * ym2 / rsqr;
@@ -134,9 +154,11 @@ auto tidal_ode::drho_y(real_t rho_, real_t ym2) const -> real_t
134154
f = (-4.0*PI/7.0) * (
135155
(11.0 * h - (32.0/3.0) * (1.0 + eps) ) * cs2 + h);
136156
}
137-
138-
139-
return (4.0*PI * h + (f * g + wtfac * c)) / a - d;
157+
158+
159+
real_t res{ (4.0*PI * h + (f * g + wtfac * c)) / a - d };
160+
assert(std::isfinite(res));
161+
return res;
140162
}
141163

142164
auto tidal_ode::initial_data() const -> state_t

library/NeutronStar/TOV/tidal_deform_ode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class tidal_ode {
1717
interpolator dnu_rho;
1818
interpolator lambda_rho;
1919
interpolator rsqr_rho;
20+
interpolator mbr3_rho;
2021

2122
auto gm1_from_dnu(real_t dnu) const -> real_t;
2223

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

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

55
project_headers_dest = 'reprimand'
66

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)