[Mesa-users] theta_co and time_co not reinitialised upon restarting
Glenn-Michael Oomen
glennmichael.oomen at kuleuven.be
Fri Aug 16 06:12:14 EDT 2019
Hi MESA,
I was having some trouble restarting a binary model from a photo in MESA version r-11701. After some digging, I found out that the problem was in the Tout_enhance_wind function, because theta_co contained completely random values and several NaNs. It turns out that theta_co and time_co are only properly initialised at the start of a binary model in binarydata_init of binary_evolve.f90, but not when restarting a model.
I applied a quick fix in my copy of the code by also reinitialising these arrays after restarting. I did this by adding the following to run_binary_support (just after theta_co and time_co are allocated):
! Set all parameters necessary for integration over the binary orbit
! 1) true anomaly = polar angle from periastron 0 -> 2pi
if (doing_restart) then
do i = 1,b% anomaly_steps
b% theta_co(i) = (i-1) * (2 * pi) / b% anomaly_steps
end do
! 2) time between periastron and polar angle theta 0 -> 1 (fraction of the
! orbital period)
do i = 1,b% anomaly_steps ! time between periastron and polar angle theta
b% time_co(i) = ( 2 * atan_cr( sqrt( (1-b% eccentricity)/(1 + b% eccentricity) ) * &
tan_cr(b% theta_co(i)/2d0) ) - b% eccentricity * &
sqrt(1 - b% eccentricity**2) * sin_cr(b% theta_co(i)) / &
(1 + b% eccentricity * cos_cr(b% theta_co(i)) ) ) /2. /pi
if (i > b% anomaly_steps/2+1) then
b% time_co(i) = b% time_co(i) + b% time_co(b% anomaly_steps/2+1) * 2
end if
end do
end if
I basically copied this piece of code from binary_evolve to run_binary_support.
Best regards,
Glenn-Michael Oomen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20190816/13a005c2/attachment.html>
More information about the Mesa-users
mailing list