Interacting Binaries & Accretors (flexmesa.binary)¶
Frozen & Unverified JAX Binary Helpers (#166)
The JAX binary modules (jax_kernels, jax_orbit_mdot,
jax_jdot_tides) are frozen and unverified
(JAX_ENGINE_STATUS = "frozen-unverified-until-#143") until the canonical
Safe Rust engine passes the upstream MESA 26.4.1 history harness
(#143). BinarySystem wraps the Rust driver, and these JAX helpers must
not be modified before #143 passes.
The flexmesa.binary subpackage ports upstream MESA's binary/ module in canonical Safe Rust (crates/flexmesa-binary) alongside frozen (float64) JAX helper kernels. It models detached, semi-detached, and compact-object binary evolution by coupling one or two StarModel instances (or a donor star and a point-mass Neutron Star or Kerr Black Hole accretor) to orbital angular momentum and eccentricity evolution:
- Roche-Lobe Geometry & Mass-Transfer Schemes: Keplerian separation \(a(M_1, M_2, P)\), Eggleton (1983) volume-equivalent Roche-lobe radius \(R_{\mathrm{RL},1}/a\) (
eval_rlobe), periastron overflow gap (eval_rl_relative_gap), explicit Ritter (1988) optically thin atmospheric mass transfer (eval_ritter_mdot_thin), Kolb & Ritter (1990) optically thick adiabatic overflow integration (eval_kolb_mdot_thick), and implicit bisection/secant \(\dot{M}_{\mathrm{RLOF}}\) solvers. - Compact-Object Accretion & Kerr Spin Evolution: Eddington-limited mass transfer, radiation pressure wind retention (
alpha,beta,delta,gamma), and exact Bardeen (1970) / Thorne (1974) Innermost Stable Circular Orbit (ISCO) dimensionless spin \(a_* \in [0, 0.998]\) and radiative efficiency \(\eta_{\mathrm{ISCO}}\) (eval_bh_spin_and_edd_jax). - Orbital Angular Momentum & Hut (1981) Tides: Peters (1964) gravitational-wave radiation (
eval_jdot_gr_jax), Rappaport, Verbunt & Joss (1983) magnetic braking (eval_jdot_mb_jax), L2/circumbinary mass-loss fraction (eval_l2_mass_loss_fraction), and Hut (1981) weak-friction tidal eccentricity evolution (eval_edot_tidal_hut_jax). - Checkpoints, Counters,
BinaryExtrasHooks,binary_history.dataWriters &binary/test_suiteRunner: Full coupled binary checkpoints (FMBINCP1v3 viaBinarySystem.to_photo_bytes/from_photo_bytesin Python andto_checkpoint_bytes/from_checkpoint_bytes/save_checkpoint/load_checkpointin Rust) preserving orbital state, controls, and retry-proofBinaryStepCounters(num_retries,num_implicit_trials,num_dt_cuts,num_hard_limit_retries), customBinaryExtras(other_wind_msun_yr,check_model,finish_step,extra_binary_history_columns,extra_star_history_columns,BinaryExtrasAction,DefaultBinaryExtras) viastep_with_extras/try_step_with_extrasinflexmesa-binary, incremental MESA26.4.1binary_history.datawriters (BinaryLogsWriter,IncrementalBinaryHistoryWriter,run_binary_test_suite_case_with_logs, withappend_to_star_historyforwarding toLOGS1/andLOGS2/; theedot,edot_tidalandedot_enhancecolumns report the terms the orbital update applied, stored inBinarySystem::last_edotas anEdotBreakdownfromeval_coupled_edot_breakdown), and thebinary/test_suiterunner (run_binary_test_suite_case, accepting optional caller-supplied test-sideextrascallbacks; coupled binary evolution is currently unverified against real MESA output, pending #143 and #160).
For governing equations and physical derivations, see Interacting Binaries & Accretors and Tutorial 4: Interacting Binaries & Accretors.
Quick Usage Example¶
import flexmesa.binary as binary
import flexmesa.star as star
from flexmesa import constants
# Initialize a 4.0 Msun ZAMS donor + 1.4 Msun NS X-ray binary in a 1.5-day orbit
donor = star.StarModel.from_zams(initial_mass=4.0, initial_z=0.02)
sys_bin = binary.BinarySystem.from_point_mass(
donor,
companion_mass_msun=1.4,
initial_period_days=1.5,
eccentricity=0.05,
)
print(
f"a={sys_bin.separation / constants.RSUN:.3f} Rsun, "
f"R_RL1={sys_bin.rl[0] / constants.RSUN:.3f} Rsun"
)
Package Overview (flexmesa.binary)¶
flexmesa.binary
¶
Binary orbital mechanics, Roche-lobe overflow, \(L_2\) disk mass loss,
angular momentum loss, tidal evolution, and coupled binary star evolution
(flexmesa.binary).
Corresponds to the upstream Fortran MESA binary/ module. The coupled
BinarySystem evolution driver and binary/test_suite runner are unverified
against real MESA output (pending #143, #154, and #160).
Note
The JAX binary helper kernels (jax_kernels, jax_orbit_mdot,
jax_jdot_tides; JAX_ENGINE_STATUS == "frozen-unverified-until-#143")
are frozen and unverified under #166 (DECISIONS #17) until the
canonical Rust engine passes the #143 upstream MESA 26.4.1 history
harness.
Coupled Binary System Driver (flexmesa.binary.system)¶
flexmesa.binary.system
¶
Coupled BinarySystem evolution wrapper (flexmesa.binary).
BinarySystem
¶
Coupled binary system (Donor + PointMass or Donor + Accretor).
Note
The coupled step sequence, orbital integrator, and implicit RLOF search are unverified against real MESA output (pending #143 and #160).
angular_momentum_j
property
¶
Orbital angular momentum \(J_{\mathrm{orb}}\) (g cm^2 s^-1).
mtransfer_rate
property
¶
Current RLOF rate \(\dot{M}_{\mathrm{tr}} \le 0\) (g s^-1).
num_implicit_trials
property
¶
Cumulative coupled implicit mass-transfer trials.
num_hard_limit_retries
property
¶
Cumulative hard-limit retries preserved across rollbacks.
from_point_mass
classmethod
¶
from_point_mass(
donor,
companion_mass_msun,
initial_period_days,
*,
eccentricity=0.0,
is_black_hole=False,
initial_bh_spin=0.0,
)
Construct a coupled Donor + PointMass binary system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
donor
|
StarModel
|
Donor |
required |
companion_mass_msun
|
float
|
Companion mass (\(M_\odot\)). |
required |
initial_period_days
|
float
|
Initial orbital period (days). |
required |
eccentricity
|
float
|
Initial orbital eccentricity. |
0.0
|
is_black_hole
|
bool
|
Whether the companion is an accreting Kerr BH. |
False
|
initial_bh_spin
|
float
|
Initial dimensionless BH spin \(a \in [0, 1]\). |
0.0
|
Returns:
| Type | Description |
|---|---|
BinarySystem
|
Initialized |
from_two_stars
classmethod
¶
Construct a coupled Donor + Accretor two-star binary system.
from_photo_bytes
classmethod
¶
Restore a BinarySystem from serialized binary checkpoint bytes.
run_binary_test_suite_case
¶
run_binary_test_suite_case(
case_dir,
max_steps_cap=None,
allow_unsupported_controls=False,
extras=None,
)
Execute a single binary/test_suite/<case> directory through coupled
BinarySystem + StarModel evolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case_dir
|
str | Path
|
Path to the |
required |
max_steps_cap
|
int | None
|
Optional maximum coupled binary steps ( |
None
|
allow_unsupported_controls
|
bool
|
When |
False
|
extras
|
Any
|
Optional Python |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
|
Roche-Lobe & Mass-Transfer Wrappers (flexmesa.binary.orbit_mdot)¶
flexmesa.binary.orbit_mdot
¶
Backend-dispatched orbital mechanics, Roche-lobe overflow, \(L_2\) mass loss,
and binary timestep functions (flexmesa.binary).
eval_rlobe
¶
Evaluate Eggleton (1983) Roche-lobe radius \(R_{L,1}\) (cm).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
float | Array
|
Primary mass (g). |
required |
m2
|
float | Array
|
Companion mass (g). |
required |
a
|
float | Array
|
Orbital separation (cm). |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Roche-lobe radius \(R_{L,1}\) (cm). |
eval_rl_relative_gap
¶
Evaluate periastron relative Roche-lobe gap \((R - R_{L,p}) / R_{L,p}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
float | Array
|
Stellar radius (cm). |
required |
rl
|
float | Array
|
Circular Roche-lobe radius (cm). |
required |
eccentricity
|
float | Array
|
Orbital eccentricity \(e\). |
0.0
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Dimensionless relative Roche-lobe gap. |
separation_from_period
¶
Compute orbital separation \(a\) (cm) from period \(P\) (s) and masses (g).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
float | Array
|
Primary mass (g). |
required |
m2
|
float | Array
|
Companion mass (g). |
required |
period
|
float | Array
|
Orbital period (s). |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Orbital separation \(a\) (cm). |
period_from_separation
¶
Compute orbital period \(P\) (s) from separation \(a\) (cm) and masses (g).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
float | Array
|
Primary mass (g). |
required |
m2
|
float | Array
|
Companion mass (g). |
required |
separation
|
float | Array
|
Orbital separation (cm). |
required |
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Orbital period \(P\) (s). |
eval_j_orb
¶
Compute orbital angular momentum \(J_{\mathrm{orb}}\) in CGS units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
float | Array
|
Primary mass (g). |
required |
m2
|
float | Array
|
Companion mass (g). |
required |
separation
|
float | Array
|
Orbital separation (cm). |
required |
eccentricity
|
float | Array
|
Orbital eccentricity \(e\). |
0.0
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Orbital angular momentum \(J_{\mathrm{orb}}\) ( |
separation_from_j_orb
¶
Compute orbital separation \(a\) (cm) from \(J_{\mathrm{orb}}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
float | Array
|
Primary mass (g). |
required |
m2
|
float | Array
|
Companion mass (g). |
required |
j_orb
|
float | Array
|
Orbital angular momentum ( |
required |
eccentricity
|
float | Array
|
Orbital eccentricity \(e\). |
0.0
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Orbital separation \(a\) (cm). |
eval_ritter_mdot_thin
¶
eval_ritter_mdot_thin(
m_donor,
m_accretor,
r_donor,
rl_donor,
rho_surf,
p_surf,
t_surf,
mu_surf,
*,
is_kolb_scheme=False,
backend="auto",
)
Evaluate Ritter (1988) optically thin RLOF rate (g s^-1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_donor
|
float | Array
|
Donor mass (g). |
required |
m_accretor
|
float | Array
|
Accretor mass (g). |
required |
r_donor
|
float | Array
|
Donor photospheric radius (cm). |
required |
rl_donor
|
float | Array
|
Donor Roche-lobe radius (cm). |
required |
rho_surf
|
float | Array
|
Surface cell density ( |
required |
p_surf
|
float | Array
|
Surface cell pressure ( |
required |
t_surf
|
float | Array
|
Surface cell temperature (K). |
required |
mu_surf
|
float | Array
|
Surface mean molecular weight. |
required |
is_kolb_scheme
|
bool
|
Cap exponential factor at unity when \(R_d > R_{L,d}\). |
False
|
backend
|
Backend
|
Execution backend ( |
'auto'
|
Returns:
| Type | Description |
|---|---|
float | Array
|
Optically thin rate \(\dot{M}_{\mathrm{thin}} \le 0\) ( |
eval_kolb_mdot_thick
¶
eval_kolb_mdot_thick(
m_donor,
m_accretor,
rl_donor,
r_profile,
p_profile,
t_profile,
mu_profile,
gamma1_profile,
)
Evaluate Kolb & Ritter (1990) optically thick RLOF rate (g s^-1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_donor
|
float
|
Donor mass (g). |
required |
m_accretor
|
float
|
Accretor mass (g). |
required |
rl_donor
|
float
|
Donor Roche-lobe radius (cm). |
required |
r_profile
|
ArrayLike
|
Outer-to-inner radius array |
required |
p_profile
|
ArrayLike
|
Outer-to-inner pressure array |
required |
t_profile
|
ArrayLike
|
Outer-to-inner temperature array |
required |
mu_profile
|
ArrayLike
|
Outer-to-inner mean molecular weight array |
required |
gamma1_profile
|
ArrayLike
|
Outer-to-inner \(\Gamma_1\) array |
required |
Returns:
| Type | Description |
|---|---|
float
|
Optically thick rate \(\dot{M}_{\mathrm{thick}} \le 0\) ( |
eval_l2_mass_loss_fraction
¶
eval_l2_mass_loss_fraction(
donor_mass_msun,
accretor_mass_msun,
mass_transfer_rate_msun_yr,
orbital_separation_rsun,
disk_alpha=0.1,
disk_mu=0.6,
)
Evaluate Lu et al. (2023) thin-disk outer \(L_2\) mass-loss fraction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
donor_mass_msun
|
float
|
Donor mass (\(M_\odot\)). |
required |
accretor_mass_msun
|
float
|
Accretor mass (\(M_\odot\)). |
required |
mass_transfer_rate_msun_yr
|
float
|
Mass transfer rate ( |
required |
orbital_separation_rsun
|
float
|
Orbital separation (\(R_\odot\)). |
required |
disk_alpha
|
float
|
Shakura-Sunyaev \(\alpha\) viscosity parameter. |
0.1
|
disk_mu
|
float
|
Disk mean molecular weight. |
0.6
|
Returns:
| Type | Description |
|---|---|
float
|
Outer \(L_2\) mass-loss fraction \(f_{L2} \in [0, 1]\). |
pick_next_timestep_rl
¶
pick_next_timestep_rl(
donor_time_step_yr,
max_timestep_sec,
rl_gap_old_donor,
rl_gap_donor,
*,
fr=0.01,
fr_limit=0.01,
fr_dt_limit=0.0,
dt_softening_factor=0.0,
time_delta_coeff=1.0,
)
Evaluate binary_pick_next_timestep for a relative Roche-lobe gap step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
donor_time_step_yr
|
float
|
Completed donor timestep (yr). |
required |
max_timestep_sec
|
float
|
Previous maximum binary timestep (s). |
required |
rl_gap_old_donor
|
float
|
Previous relative Roche-lobe gap. |
required |
rl_gap_donor
|
float
|
Current relative Roche-lobe gap. |
required |
fr
|
float
|
Relative Roche-lobe gap limit ( |
0.01
|
fr_limit
|
float
|
Floor on \(|g_d|\) ( |
0.01
|
fr_dt_limit
|
float
|
Minimum timestep floor (yr). |
0.0
|
dt_softening_factor
|
float
|
Log-space softening weight. |
0.0
|
time_delta_coeff
|
float
|
Global scaling coefficient ( |
1.0
|
Returns:
| Type | Description |
|---|---|
tuple[float, int]
|
Tuple |
Differentiable Roche-Lobe & Kerr BH Kernels (flexmesa.binary.jax_orbit_mdot)¶
flexmesa.binary.jax_orbit_mdot
¶
Differentiable JAX (float64) kernels for binary orbital geometry and
explicit/implicit Roche-lobe overflow (flexmesa.binary).
Corresponds to binary/private/binary_utils.f90 and binary_mdot.f90.
eval_rlobe_jax
¶
Evaluate Eggleton (1983) Roche-lobe radius \(R_{L,1}\) (cm).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
Array | float
|
Primary mass (g). |
required |
m2
|
Array | float
|
Companion mass (g). |
required |
a
|
Array | float
|
Orbital separation (cm). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Roche-lobe radius \(R_{L,1}\) (cm). |
eval_rl_relative_gap_jax
¶
Evaluate periastron relative Roche-lobe gap \((R - R_{L,p}) / R_{L,p}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
Array | float
|
Stellar photospheric radius (cm). |
required |
rl
|
Array | float
|
Circular Roche-lobe radius (cm). |
required |
eccentricity
|
Array | float
|
Orbital eccentricity \(e \in [0, 1)\). |
0.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Dimensionless relative Roche-lobe gap. |
separation_from_period_jax
¶
Compute orbital separation \(a\) (cm) from period \(P\) (s) and masses (g).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
Array | float
|
Primary mass (g). |
required |
m2
|
Array | float
|
Companion mass (g). |
required |
period
|
Array | float
|
Orbital period (s). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Orbital separation \(a\) (cm). |
period_from_separation_jax
¶
Compute orbital period \(P\) (s) from separation \(a\) (cm) and masses (g).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
Array | float
|
Primary mass (g). |
required |
m2
|
Array | float
|
Companion mass (g). |
required |
separation
|
Array | float
|
Orbital separation (cm). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Orbital period \(P\) (s). |
eval_j_orb_jax
¶
Compute orbital angular momentum \(J_{\mathrm{orb}}\) in CGS units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
Array | float
|
Primary mass (g). |
required |
m2
|
Array | float
|
Companion mass (g). |
required |
separation
|
Array | float
|
Orbital separation (cm). |
required |
eccentricity
|
Array | float
|
Orbital eccentricity \(e\). |
0.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Orbital angular momentum \(J_{\mathrm{orb}}\) ( |
separation_from_j_orb_jax
¶
Compute orbital separation \(a\) (cm) from \(J_{\mathrm{orb}}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m1
|
Array | float
|
Primary mass (g). |
required |
m2
|
Array | float
|
Companion mass (g). |
required |
j_orb
|
Array | float
|
Orbital angular momentum (\(\mathrm{g\,cm^2\,s^{-1}}\)). |
required |
eccentricity
|
Array | float
|
Orbital eccentricity \(e\). |
0.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Orbital separation \(a\) (cm). |
eval_ritter_mdot_thin_jax
¶
eval_ritter_mdot_thin_jax(
m_donor,
m_accretor,
r_donor,
rl_donor,
rho_surf,
p_surf,
t_surf,
mu_surf,
is_kolb_scheme=False,
)
Evaluate Ritter (1988) optically thin RLOF rate (\(\mathrm{g\,s^{-1}}\)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_donor
|
Array | float
|
Donor mass (g). |
required |
m_accretor
|
Array | float
|
Accretor mass (g). |
required |
r_donor
|
Array | float
|
Donor photospheric radius (cm). |
required |
rl_donor
|
Array | float
|
Donor Roche-lobe radius (cm). |
required |
rho_surf
|
Array | float
|
Surface cell density (\(\mathrm{g\,cm^{-3}}\)). |
required |
p_surf
|
Array | float
|
Surface cell pressure (\(\mathrm{dyn\,cm^{-2}}\)). |
required |
t_surf
|
Array | float
|
Surface cell temperature (K). |
required |
mu_surf
|
Array | float
|
Surface mean molecular weight. |
required |
is_kolb_scheme
|
bool
|
Cap exponential factor at unity when \(R_d > R_{L,d}\). |
False
|
Returns:
| Type | Description |
|---|---|
Array
|
Optically thin rate \(\dot{M}_{\mathrm{thin}} \le 0\) ( |
solve_roche_lobe_mdot_jax
¶
Solve implicit Roche-lobe overflow \(R_d(\dot{M}) = R_{L,d}(\dot{M})\)
with an analytical Implicit Function Theorem custom_vjp rule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_donor
|
Array | float
|
Donor mass (g). |
required |
m_accretor
|
Array | float
|
Accretor mass (g). |
required |
r_donor
|
Array | float
|
Initial donor photospheric radius (cm). |
required |
separation
|
Array | float
|
Orbital separation (cm). |
required |
dt
|
Array | float
|
Timestep duration (s). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Implicit mass transfer rate \(\dot{M}_{\mathrm{tr}} \le 0\) ( |
Differentiable \(\dot{J}\) & Hut Tidal Kernels (flexmesa.binary.jax_jdot_tides)¶
flexmesa.binary.jax_jdot_tides
¶
Differentiable JAX (float64) kernels for Kerr black hole ISCO/Eddington
accretion, orbital angular momentum loss, and Hut (1981) tidal evolution.
Corresponds to binary/private/binary_edot.f90, binary_jdot.f90,
binary_tides.f90, and binary_wind.f90.
eval_bh_spin_and_edd_jax
¶
Evaluate Kerr BH ISCO mass, spin, Eddington rate, and efficiency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_bh_init
|
Array | float
|
Initial black hole mass (g). |
required |
a_spin_init
|
Array | float
|
Initial dimensionless Kerr spin \(a \in [0, 1]\). |
required |
m_bh_current
|
Array | float
|
Current black hole mass (g). |
required |
kappa_surf
|
Array | float
|
Donor surface opacity (\(\mathrm{cm^2\,g^{-1}}\)). |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array, Array]
|
Tuple |
eval_jdot_gr_jax
¶
Evaluate gravitational wave torque \(\dot{J}_{\mathrm{gr}}\) in CGS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_donor
|
Array | float
|
Donor mass (g). |
required |
m_accretor
|
Array | float
|
Accretor mass (g). |
required |
separation
|
Array | float
|
Orbital separation (cm). |
required |
j_orb
|
Array | float
|
Orbital angular momentum (\(\mathrm{g\,cm^2\,s^{-1}}\)). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Gravitational wave torque \(\dot{J}_{\mathrm{gr}}\) ( |
eval_jdot_mb_jax
¶
eval_jdot_mb_jax(
m_star,
r_star,
rl_star,
period,
gamma_mb=3.0,
q_conv_env=0.05,
scale_for_low_qconv_env=True,
)
Evaluate Rappaport-Verbunt-Joss (1983) magnetic braking torque.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_star
|
Array | float
|
Stellar mass (g). |
required |
r_star
|
Array | float
|
Stellar radius (cm). |
required |
rl_star
|
Array | float
|
Roche-lobe radius (cm). |
required |
period
|
Array | float
|
Orbital period (s). |
required |
gamma_mb
|
Array | float
|
Magnetic braking index (default |
3.0
|
q_conv_env
|
Array | float
|
Convective envelope mass fraction. |
0.05
|
scale_for_low_qconv_env
|
bool
|
Damp when \(q_{\mathrm{conv,env}} < 0.02\). |
True
|
Returns:
| Type | Description |
|---|---|
Array
|
Magnetic braking torque \(\dot{J}_{\mathrm{mb}}\) ( |
eval_edot_tidal_hut_jax
¶
eval_edot_tidal_hut_jax(
k_div_t,
m_star,
m_companion,
r_phot,
separation,
eccentricity,
omega_star,
period,
f_tid=1.0,
)
Evaluate Hut (1981) tidal circularization rate (s^-1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k_div_t
|
Array | float
|
Tidal dissipation ratio \((k/T)\) (\(\mathrm{s}^{-1}\)). |
required |
m_star
|
Array | float
|
Stellar mass (g). |
required |
m_companion
|
Array | float
|
Companion mass (g). |
required |
r_phot
|
Array | float
|
Photospheric radius (cm). |
required |
separation
|
Array | float
|
Orbital separation (cm). |
required |
eccentricity
|
Array | float
|
Orbital eccentricity \(e\). |
required |
omega_star
|
Array | float
|
Surface spin angular velocity (\(\mathrm{rad\,s^{-1}}\)). |
required |
period
|
Array | float
|
Orbital period (s). |
required |
f_tid
|
Array | float
|
Tidal scaling factor ( |
1.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Tidal eccentricity derivative \(\dot{e}_{\mathrm{tidal}}\) ( |
Compiled Rust Extension Bridge (flexmesa._rust)¶
Low-level Safe Rust PyO3 bindings exposed via flexmesa._rust for interacting binaries (_ArrF64 denotes a float64 NumPy ndarray).
binary_py and extras_py¶
RustBinarySystem(class RustBinarySystem; static constructorsnew_point_mass,new_two_stars,from_photo_bytes; methodsto_photo_bytes,step): Python wrapper aroundflexmesa_binary::BinarySystemexposing donor/accretor states, orbital separation, period, eccentricity, \(J_{\mathrm{orb}}\), Roche radii, relative gaps, \(\dot{M}\), and \(\dot{J}\).binary_build_anomaly_grid((anomaly_steps: int, eccentricity: float) -> tuple[_ArrF64, _ArrF64]): Builds the eccentric true-anomaly and normalized time grid(theta_co, time_co).binary_eval_accreted_material_j((m_donor: float, m_accretor: float, r_accretor: float, separation: float) -> tuple[float, int]): Evaluates de Mink et al. (2013) accreted specific angular momentum(j_acc, mode).binary_eval_arras_mdot_thin((m_donor: float, m_accretor: float, separation: float, r_donor: float, rho_surf: float, t_surf: float, mu_surf: float) -> float): Evaluates the Arras optically thin RLOF mass transfer rate (\(\mathrm{g\,s^{-1}}\)).binary_eval_bh_spin_and_edd((m_bh_init: float, a_spin_init: float, m_bh_current: float, kappa_surf: float) -> tuple[float, float, float, float]): Computes Kerr BH equivalent initial non-rotating mass, current spin, and Eddington accretion quantities from(m_bh_init, a_spin_init, m_bh_current, kappa_surf).binary_eval_j_orb((m1: float, m2: float, separation: float, eccentricity: float) -> float): Computes orbital angular momentum \(J_{\mathrm{orb}}\) (\(\mathrm{g\,cm^2\,s^{-1}}\)).binary_eval_jdot_gr((m_donor: float, m_accretor: float, separation: float, j_orb: float) -> float): Evaluates gravitational wave \(\dot{J}_{\mathrm{gr}}\) (\(\mathrm{g\,cm^2\,s^{-2}}\)).binary_eval_jdot_ls((s_donor_old: float, s_donor: float, s_accretor_old: float, s_accretor: float, dt: float) -> float): Evaluates spin-orbit tidal torque \(\dot{J}_{\mathrm{ls}}\) (\(\mathrm{g\,cm^2\,s^{-2}}\)).binary_eval_jdot_mb((m_star: float, r_star: float, rl_star: float, period: float, gamma_mb: float, q_conv_env: float, scale_for_low_qconv_env: bool) -> float): Evaluates Rappaport-Verbunt-Joss (1983) magnetic braking \(\dot{J}_{\mathrm{mb}}\).binary_eval_jdot_ml((m_donor: float, m_accretor: float, separation: float, period: float, eccentricity: float, mdot_sys_tr_donor: float, mdot_sys_wind_donor: float, mdot_sys_tr_accretor: float, mdot_sys_wind_accretor: float, mdot_sys_cct: float, gamma_mt: float) -> float): Evaluates system mass-loss \(\dot{J}_{\mathrm{ml}}\) (\(\mathrm{g\,cm^2\,s^{-2}}\)).binary_eval_kolb_mdot_thick((m_donor: float, m_accretor: float, rl_donor: float, r_profile: _ArrF64, p_profile: _ArrF64, t_profile: _ArrF64, mu_profile: _ArrF64, gamma1_profile: _ArrF64) -> float): Evaluates the Kolb & Ritter (1990) optically thick RLOF mass transfer rate (\(\mathrm{g\,s^{-1}}\)).binary_eval_l2_mass_loss_fraction((donor_mass_msun: float, accretor_mass_msun: float, mass_transfer_rate_msun_yr: float, orbital_separation_rsun: float, disk_alpha: float, disk_mu: float) -> float): Evaluates the Lu et al. (2023) thin-disk outer \(L_2\) mass-loss fraction \(f_{L2}\).binary_eval_l2_overflow_limit((m1: float, m2: float) -> float): Evaluates the Marchant et al. (2016) contact binary \(L_2\) overflow limit.binary_eval_ritter_mdot_thin((m_donor: float, m_accretor: float, r_donor: float, rl_donor: float, rho_surf: float, p_surf: float, t_surf: float, mu_surf: float, is_kolb_scheme: bool) -> float): Evaluates the Ritter (1988) optically thin RLOF mass transfer rate (\(\mathrm{g\,s^{-1}}\)).binary_eval_rl_relative_gap((r: float, rl: float, eccentricity: float) -> float): Evaluates periastron relative Roche-lobe gap \((R - R_L(1-e)) / (R_L(1-e))\).binary_eval_rlobe((m1: float, m2: float, a: float) -> float): Evaluates Eggleton (1983) Roche-lobe radius \(R_{L,1}(m_1, m_2, a)\) (\(\mathrm{cm}\)).binary_eval_tides_hut((m_star: float, m_companion: float, r_phot: float, separation: float, eccentricity: float, period: float, omega_star: float, m_env_msun: float, r_env_rsun: float, l_phot_lsun: float, r_gyr_sq: float, f_tid: float, has_convective_envelope: bool) -> tuple[float, float, float, float, float, float, float]): Evaluates Hut (1981) eccentricity polynomials and tidal rates.binary_eval_wind_transfer((m_donor: float, m_accretor: float, r_donor: float, rl_donor: float, separation: float, eccentricity: float, b_wind: float, alpha_bh: float, beta_bh: float, max_frac: float) -> tuple[float, float]): Evaluates Tout & Eggleton (1988) wind enhancement and Hurley et al. (2002) Bondi-Hoyle fraction.binary_period_from_separation((m1: float, m2: float, separation: float) -> float): Computes orbital period \(P\) (\(\mathrm{s}\)) from separation \(a\) (\(\mathrm{cm}\)) and masses \(m_1, m_2\) (\(\mathrm{g}\)).binary_pick_next_timestep_rl((donor_time_step_yr: float, max_timestep_sec: float, rl_gap_old_donor: float, rl_gap_donor: float, fr: float = 0.01, fr_limit: float = 0.01, fr_dt_limit: float = 0.0, dt_softening_factor: float = 0.0, time_delta_coeff: float = 1.0) -> tuple[float, int]): Evaluatesbinary_pick_next_timestepmatching upstreambinary/test/src/test_binary.f90.binary_separation_from_j_orb((m1: float, m2: float, j_orb: float, eccentricity: float) -> float): Computes orbital separation \(a\) (\(\mathrm{cm}\)) from \(J_{\mathrm{orb}}\) (\(\mathrm{g\,cm^2\,s^{-1}}\)).binary_separation_from_period((m1: float, m2: float, period: float) -> float): Computes orbital separation \(a\) (\(\mathrm{cm}\)) from period \(P\) (\(\mathrm{s}\)) and masses \(m_1, m_2\) (\(\mathrm{g}\)).binary_extras_snapshot((bin: RustBinarySystem, case_dir: str = "") -> dict[str, Any]): Builds the MESAbinary_infoextras snapshot dictionary for aRustBinarySystemwithout running a full trace (#148,#231).
Frozen JAX Engine Status (flexmesa.binary.JAX_ENGINE_STATUS)¶
JAX_ENGINE_STATUS(str,"frozen-unverified-until-#143"): Marks the derived JAXbinaryengine twins as frozen and not an upstream parity oracle until the canonical Rust engine passes the upstream-history harness (#143,#166).