1D Stellar Structure & Evolution (flexmesa.star)¶
Frozen & Unverified JAX Star Helpers (#166)
The JAX star modules (jax_kernels, jax_winds_mix, jax_evolve,
jax_diffusion_rot, jax_hydro_pulse, jax_rsp) 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). No JAX stellar evolution step exists (StarModel wraps
the Rust solver), and these helpers must not be modified before #143
passes.
The flexmesa.star subpackage implements the 1D Lagrangian stellar structure and evolution engine, bridging the Safe Rust core (crates/flexmesa-star) with frozen (float64) JAX structure, wind, mixing, hydrodynamic, and pulsation formula kernels. It provides:
- Model Initialization & I/O: Zero-Age Main Sequence (
StarModel.from_zams), the MESA 26.4.1 pre-main-sequence builder (StarModel.from_pre_ms,build_pre_ms_model), upstream ASCII.modreaders/writers (from_mod_file,from_mod_str,write_mod_file,to_mod_str), generated little-endianserdebinary.photocheckpoints (FMPHOTO2v30 viato_photo_bytes,try_write_photo_bytes,from_photo_bytes,load_photo_bytes,verify_photo_restart, saving primary/start/old arrays pluscontrols,job,rsp, energy-accounting scalars, and cumulative solver counters while skipping ephemeralMicrophysicsCachehit/miss counters so restarts remain bit-exact against uninterrupted runs;FlexMESA.photobytes remain internal and are not binary-compatible with Fortran MESAphotos/), and MESA26.4.1LOGS/history.data,LOGS/profileN.data(StarModel.to_profile_str), andLOGS/profiles.indexcolumn evaluators (includingphase_of_evolutionand upstream energy-conservation columns), incremental writers (StarLogsWriter,IncrementalHistoryWriter,run_inlist_stage_with_logs,run_test_suite_case_with_logs), and lossless ASCII readers (read_mesa_log_file,read_profiles_index_file), withHistoryRow.log_lhreporting hydrogen-burning luminosity (pp + cno) separately from helium, metal, and net nuclear burning (#159,#163).&controlsand&star_jobdefaults match MESA26.4.1(#149,#151,#152,#155,#156,#159,#161,#299), using upstream scalar sentinels (1e36,11.0,12.0,99.0,3e7,0.99,0.0,-1,-111), explicitset_*/set_initial_*rotation booleans, and explicit&kap::zbase(-1default without silent cross-namelist copying). - Coupled Henyey Solver & Time Evolution: Staggered 1D cell/face grids, 24-slot 3-cell stencil automatic differentiation (
StarAdOrder1), coupled block-tridiagonal Newton-Raphson relaxation (solve_henyey,step_struct_burn_mix,evolve) porting MESA26.4.1'sdo_solver_work,adjust_correction,Bdomain,scale_correction_norm, retry-dependentmax_triesschedule,solver_itermin, high-\(T\) correction tolerance relaxation,check_after_converge, andsizequ/sizeBnorms (#152,#177,#251,#252,#260), structuredStarError::{StepFailure, Terminated}diagnostics (StepFailureInfocarrying zone, equation, paired variable, value, norms, and retry cause, with zero-retry fast-fail onInvalidInput/IoError/Terminated), in-placePrimaryStateBufferrollback (restore_mesh_on_retry), 2-slot bit-exactMicrophysicsCachereuse (micro_cache_hits,micro_cache_misses), retry-proof solver/redo counters (total_num_solver_calls,num_redos,num_retries), optional JSONL step telemetry (FLEXMESA_STEP_TRACE/FLEXMESA_STEP_TRACE_FILE), MESA26.4.1end-of-step total-energy conservation accounting (eval_total_energy_integralswithQuadPE/KE, rotational,TDC,RSP2, andRSPterms, plus Phase 1 and Phase 2update_step_energy_conservationfor bothdedtandeps_grav;#151), MESA26.4.1adaptive mesh planning, burning/composition gradient multipliers, conservative energy/momentum/angular-momentum remapping, andsplit_merge_amr(do_adjust_mesh,do_mesh_plan,set_mesh_function_data,get_gval_info,remap_onto_dq,remesh_split_merge,do_prune_mesh_surface;#153), MESA26.4.13-regiondo_adjust_mass_step(compute_delta_m,get_xa_for_accretion,set_omega_adjust_mass,adjust_j_lost,smooth_outer_xa, andeps_mdotmass-change heating;#159),select_mdot_actionrotational-wind redo/retry control (#139,#152), MESA26.4.1do_check_limitswithwhen_to_stop_{rtol,atol}target-hitting redos (redo_limit),set_phase_of_evolutionacross all 13stop_at_phase_*phases, exacttime_secmax_age/ gradednum_adjusted_dt_steps_before_max_ageapproach (#159), sub-cellCoreMassesandPowerCategoriesreporting, and Söderlind-Wang H211 PI timestep control (timestep_controller,eval_h211_timestep_jax) with fulltimestep.f90soft/hard limiters andmin_timestep_limit/max_number_retries/redo_limittermination (#151,#152,#177,#253). - Advanced Stellar Physics (partial/unverified against MESA
26.4.1;#154,#157-#158): 16-set exponential and step convective overshooting (overshoot.rs) with'none'short-circuiting, 3-cell log-\(H_P\) boundary interpolation,cospimass ramp, andunsmoothed_brunt_Bcutoff, verbatim predictive mixing (predictive_mix.rs) and convective premixing (conv_premix.rs), threshold-gated binomialbrunt_BandgradL_composition_termsmoothing (#155), Reimers/Blocker/Vink/Björklund/Nugis-Lamers/Dutch/'other'stellar winds (do_set_mdot,do_set_mdot_with_extras), super-Eddington wind (eval_super_eddington_windwith0.5 * vesc2and start-of-stepprev_Ledd), single-star RLO wind (eval_rlo_wind), central-temperature/envelope/timestep wind gates, and surface-averagedv_div_v_critrotational enhancement shared withflexmesa-binary(#159), Burgers multi-fluid atomic diffusion (do_element_diffusion_step,do_solve_diffusion,get_matrix_coeffs,paquette_coefficients, supporting Paquette et al. 1986 splines, Stanton & Murillo 2016, Caplan, Bauer, & Freeman 2022 OCP blending, Thoul/Hu and CGS Burgers solvers, backward-EulerBE_solveand block-tridiagonal Rosenbrocksolve_with_isolve, andeps_diffusion/eps_WD_sedimentationheating; partly ported from MESA26.4.1in#156with routine-level evidence innotes/audit/routine_table.md, whileop_monoradiative levitation fails loudly pending C10), white-dwarf crystallization phase separation (do_phase_separation_stepwith Blouin et al. 2021a,b'CO'and'ONe'shifts, EOSphase > 0.9front, constant-PgasSkye updates,mix_outward, andeps_phase_separation; partly ported from MESA26.4.1in#156; routine-level evidence innotes/audit/routine_table.md), shellular Roche rotation, angular momentum mixing (solve_omega_mix), Spruit-Tayler magnetic dynamos (#158), coupled 3-cellStarAdOrder1spherical HLLC Riemannu_flaghydrodynamics (riemann_ad) and Duffell (2016) Rayleigh-Tayloralpha_rtishock mixing (hydro_rti),RSP2radial pulsation equations (#153), andGYRE/FGONG/OSCstructure exporters (to_gyre_str,to_fgong_str,to_osc_str, plusflexmesa_star::pulse_fgong::get_fgong_datawith'T_tau'build_atmsupport forflexmesa-adipls). - Inlist &
test_suiteRunners: Recursive Fortraninlistbundle parsing (parse_inlist_bundle; full&controls/&star_jobwiring tracked in#147),rnstage extraction (parse_rn_stages), internal linear oscillation stub andRSPLINA/envelope builders (eval_linear_oscillation_modes,eval_target_mode_frequency_and_growth, andeval_astero_scaling_dnu_numax_uhzpendingGYRE/ADIPLSin#170/#171,eval_rsp_lina_modes,build_rsp_envelope_model), and thestar/test_suiterunner (run_test_suite_case, accepting optional caller-supplied test-sideextrascallbacks while canonical MESA26.4.1trajectory comparison lives inflexmesa.testing.history_compare).
For governing equations and numerical architecture, see 1D Stellar Structure, Henyey & Hydrodynamics and Convection, Diffusion, Rotation & Dynamos.
Quick Usage Example¶
import flexmesa.star as star
# Load a 1.0 Msun, Z = 0.02 Zero-Age Main Sequence model
model = star.StarModel.from_zams(initial_mass=1.0, initial_z=0.02)
model.eval_hydro_vars()
print(f"nz={model.nz}, Teff={model.teff:.1f} K, log10(T_c)={model.ln_t[-1] / 2.302585093:.4f}")
Package Overview (flexmesa.star)¶
flexmesa.star
¶
1D stellar structure, ZAMS/pre-MS initialization, .mod/.photo I/O,
zone/face microphysics, coupled Henyey solver, convective mixing/overshooting,
stellar winds, adaptive remeshing, H211 timestep control, and the evolution
driver (flexmesa.star).
Note
The JAX star helper kernels (jax_kernels, jax_winds_mix, jax_evolve,
jax_diffusion_rot, jax_hydro_pulse, jax_rsp;
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. No JAX stellar
evolution step exists (StarModel wraps the Rust solver).
Stellar Model Driver (flexmesa.star.model)¶
flexmesa.star.model
¶
Python and JAX hybrid stellar structure model (StarModel).
Wraps flexmesa._rust.RustStarModel (Tier A/B Safe Rust engine) and exposes
both zero-copy NumPy arrays and pure @jax.jit staggered-grid, face-gradient,
Henyey residual, diffusive mixing, and stellar wind kernels.
StarModel
¶
Bases: StarModelArrays
1D Lagrangian stellar structure and evolution model (Star_Info).
Provides a unified Python/JAX interface backed by RustStarModel
(flexmesa-star) for ZAMS interpolation, \(n=1.5\) pre-MS polytrope
construction, ASCII .mod and binary .photo I/O, parallelized zone/face
microphysics evaluation, convective boundary overshooting, operator-split
and coupled structure-burn-mix solves, and stellar winds.
copy
¶
Return an independent copy of the full model state.
Unlike set_primary_state, the copy also carries the start-of-step,
solver and mixing state (for example the TDC mlt_vc that a step
starts from), so a step taken on each copy starts from the same state.
from_zams
classmethod
¶
Load a Zero-Age Main Sequence (ZAMS) model (get_zams_model).
from_pre_ms
classmethod
¶
from_pre_ms(
initial_mass=1.0,
initial_z=0.02,
initial_y=-1.0,
t_c=300000.0,
d_log10_p=0.0,
eval_hydro=True,
)
Construct an \(n = 1.5\) pre-main-sequence polytrope model.
from_mod_str
classmethod
¶
Parse an upstream MESA ASCII .mod string into a StarModel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Contents of the |
required |
eval_hydro
|
bool
|
Evaluate hydro variables after loading. |
False
|
search_dir
|
str | Path | None
|
Directory searched first for the model's network
file (for example a test case's own |
None
|
Returns:
| Type | Description |
|---|---|
StarModel
|
The loaded |
from_mod_file
classmethod
¶
Read an ASCII .mod file from disk into a StarModel.
The model's network is looked up first in the file's own directory, then in the built-in network bundle.
from_photo_bytes
classmethod
¶
Restore a StarModel from binary .photo restart bytes.
eval_hydro_vars
¶
Evaluate zone and face microphysics (set_hydro_vars).
set_phot_info
¶
Set and return teff (K) from the photosphere (set_phot_info).
eval_hydro_vars does not set teff: upstream sets it in
set_phot_info (star/private/star_utils.f90:1094-1125), called from
do_report (star/private/report.f90:327).
set_primary_state
¶
Replace primary state arrays and synchronize staggered geometry.
save_start_values
¶
Snapshot current state arrays as start-of-step *_start values.
record_start_of_step_energy_integrals
¶
Record the start-of-step energy integrals for a standalone solve.
The step driver records them after set_mdot
(star/private/evolve.f90:427-453); call this after
:meth:save_start_values and before :meth:eval_equations or
:meth:solve_henyey outside the step driver.
set_evolve_controls
¶
Set mesh_delta_coeff and varcontrol_target on controls.
eval_equations
¶
Evaluate 1D Henyey residuals and block-tridiagonal Jacobian.
solve_henyey
¶
Execute a damped Newton-Raphson Henyey step for the current dt.
update_mixing
¶
Clean mixing glitches, locate boundaries, and apply overshooting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float
|
Timestep in seconds ( |
required |
overshoot_f
|
float
|
Overshoot decay scale |
0.0
|
overshoot_f0
|
float
|
Anchor step distance |
0.004
|
scheme
|
str
|
|
'exponential'
|
Returns:
| Type | Description |
|---|---|
int
|
Number of detected convective boundaries ( |
run_omega_mix
¶
Solve substepped rotational angular momentum diffusion.
step_struct_burn_mix
¶
step_struct_burn_mix(
dt,
op_split_burn=False,
use_bcyclic=True,
overshoot_f=0.0,
overshoot_f0=0.004,
)
Execute a do_struct_burn_mix step (coupled or operator-split).
apply_wind_and_adjust_mass
¶
Evaluate wind mass-loss rate and optionally adjust 3-region mass.
pick_next_timestep
¶
Compute (dt_next, varcontrol, dt_limit_ratio) via H211 filter.
evolve_step
¶
Execute a single evolutionary step (star_evolve_step).
evolve
¶
Evolve the model for up to max_steps steps (star_evolve).
eval_mesh_gval_jax
¶
Evaluate dimensionless mesh spacing variation g_k via JAX.
eval_face_mlt_jax
¶
Evaluate face temperature gradients, MLT, and Brunt N^2 via JAX.
eval_hydro_residuals_jax
¶
Evaluate the 4-equation hydrostatic residual array (nz, 4).
do_element_diffusion
¶
Run multi-species Burgers element diffusion over dt (s).
set_rotation_mixing_info
¶
Run MESA's set_rotation_mixing_info on the current model.
Returns:
| Type | Description |
|---|---|
_ArrF64
|
|
_ArrF64
|
nu_ST, B_phi, B_r) |
_ArrF64
|
in Gauss. All zero when |
Raises:
| Type | Description |
|---|---|
ValueError
|
On the explicit-error paths of the Rust routine. |
do_conv_premix
¶
Run iterative convective premixing (do_conv_premix).
add_predictive_mixing
¶
Apply predictive mixing at convective boundaries.
do_phase_separation
¶
Execute white-dwarf crystallization phase separation over dt.
eval_riemann_profile
¶
Evaluate HLLC Riemann face states (nz, 7) and residuals (nz,).
build_pulse_points
¶
Build the (n_pts, 26) pulsation structure matrix.
to_gyre_str
¶
Export the model as GYRE text (star_export_pulse_data).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
add_center_point
|
bool
|
Add a point at the centre. |
True
|
keep_surface_point
|
bool
|
Keep the outermost face. |
False
|
add_atmosphere
|
bool
|
Attach an atmosphere (not ported; raises). |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The file text, as MESA 26.4.1's |
Raises:
| Type | Description |
|---|---|
ValueError
|
Where upstream stops, or for a path not ported. |
to_fgong_str
¶
Export the model as FGONG text (star_export_pulse_data).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
add_center_point
|
bool
|
Add a point at the centre. |
True
|
keep_surface_point
|
bool
|
Keep the outermost face. |
False
|
add_atmosphere
|
bool
|
Attach an atmosphere (not ported; raises). |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The file text, as MESA 26.4.1's |
Raises:
| Type | Description |
|---|---|
ValueError
|
Where upstream stops, or for a path not ported. |
to_osc_str
¶
Export the model as OSC text (star_export_pulse_data).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
add_center_point
|
bool
|
Add a point at the centre. |
True
|
keep_surface_point
|
bool
|
Keep the outermost face. |
False
|
add_atmosphere
|
bool
|
Attach an atmosphere (not ported; raises). |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The file text, as MESA 26.4.1's |
Raises:
| Type | Description |
|---|---|
ValueError
|
Where upstream stops, or for a path not ported. |
to_gsm_bytes
¶
Export the model in GYRE GSM v110 format (pulse_gsm.f90).
to_saio_str
¶
Export the model in SAIO ASCII format (pulse_saio.f90).
to_cafein_str
¶
Export the model in CAFEIN ASCII format (pulse_cafein.f90).
to_gr1d_str
¶
Export the model in GR1D ASCII format (pulse_gr1d.f90).
to_pulse_str
¶
Export the model in pulsation format fmt (pulse.f90).
verify_photo_restart
¶
Verify bit-identical .photo restart parity over n_steps steps.
yrs_for_init_timestep
¶
Compute the initial ZAMS timestep in years (yrs_for_init_timestep).
Structure Reports & State Containers (flexmesa.star._arrays)¶
flexmesa.star._arrays
¶
Zero-copy NumPy array property mixin (StarModelArrays) and result types.
JaxStarState
dataclass
¶
Immutable JAX PyTree snapshot of a 1D stellar structure model.
Attributes:
| Name | Type | Description |
|---|---|---|
lnd |
Array
|
Cell natural log density of shape |
ln_t |
Array
|
Cell natural log temperature of shape |
ln_r |
Array
|
Face natural log radius of shape |
lum |
Array
|
Face luminosity of shape |
dq |
Array
|
Cell relative mass fractions of shape |
xa |
Array
|
Cell species mass fractions of shape |
mstar |
float
|
Total stellar mass in grams ( |
HenyeySystemResult
dataclass
¶
Assembled 1D Henyey residual vector and block-tridiagonal Jacobian.
Attributes:
| Name | Type | Description |
|---|---|---|
equ |
_ArrF64
|
Residual array of shape |
lblk |
_ArrF64
|
Sub-diagonal Jacobian blocks of shape |
dblk |
_ArrF64
|
Diagonal Jacobian blocks of shape |
ublk |
_ArrF64
|
Super-diagonal Jacobian blocks of shape |
x_scale |
_ArrF64
|
Variable scaling array of shape |
HenyeySolverReport
dataclass
¶
Convergence report returned by StarModel.solve_henyey.
Attributes:
| Name | Type | Description |
|---|---|---|
converged |
bool
|
Whether convergence tolerances were satisfied. |
iterations |
int
|
Number of Newton-Raphson iterations executed. |
residual_norm |
float
|
Mean absolute residual |
max_residual |
float
|
Maximum absolute residual |
correction_norm |
float
|
Mean absolute scaled correction. |
max_correction |
float
|
Maximum absolute scaled correction. |
EvolveStepReport
dataclass
¶
Diagnostic summary returned by StarModel.evolve_step.
Attributes:
| Name | Type | Description |
|---|---|---|
model_number |
int
|
Evolutionary step counter after completion. |
star_age |
float
|
Stellar age in years ( |
dt |
float
|
Timestep taken in seconds ( |
dt_next |
float
|
Proposed next timestep in seconds ( |
iterations |
int
|
Number of Henyey Newton-Raphson iterations. |
retries |
int
|
Number of step retries ( |
num_splits |
int
|
Number of zone splits during remeshing. |
num_merges |
int
|
Number of zone merges during remeshing. |
varcontrol |
float
|
Measured normalized structural variation. |
converged |
bool
|
Whether the step converged. |
HistoryRow
dataclass
¶
Scalar evolutionary summary corresponding to a history.data line.
StarModelArrays
¶
Mixin exposing scalar and 1D/2D NumPy array properties on StarModel.
total_num_solver_iterations
property
¶
Cumulative Henyey Newton iterations across the run.
total_num_solver_calls
property
¶
Cumulative Henyey solver invocations across the run.
micro_cache_misses
property
¶
Cumulative microphysics cache misses in set_hydro_vars.
non_nuc_neu_start
property
¶
Start-of-step cell thermal neutrino loss rate (erg g^-1 s^-1).
Differentiable Structure & Henyey Kernels (flexmesa.star.jax_kernels)¶
flexmesa.star.jax_kernels
¶
Differentiable JAX (float64) staggered-grid and face-microphysics kernels.
Provides pure branchless @jax.jit kernels for staggered cell/face geometry,
mass-weighted face interpolation (get_face_weights), optical depth
integration (get_tau), Brunt-Väisälä composition and buoyancy frequency
(do_brunt_B, do_brunt_N2), and Cox & Giuli (1968) Mixing-Length Theory
(set_mlt_vars) across all nz stellar zones.
compute_staggered_grid_jax
¶
Compute staggered Lagrangian grid quantities across nz zones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dq
|
Array
|
Cell relative mass fractions of shape |
required |
ln_r
|
Array
|
Face natural log radius of shape |
required |
mstar
|
float | Array
|
Total stellar mass in grams ( |
required |
m_center
|
float | Array
|
Inner core mass in grams ( |
0.0
|
r_center
|
float | Array
|
Inner core radius in centimeters ( |
0.0
|
cgrav
|
float | Array
|
Gravitational constant in |
_G_CGS
|
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dictionary with keys `("dq", "q", "xq", "dm", "dm_bar", "m", "r", |
dict[str, Array]
|
"rmid", "grav") |
face_weights_jax
¶
Compute mass-weighted face interpolation coefficients (alfa, beta).
At face k > 0, f_face[k] = alfa[k] * f[k] + beta[k] * f[k - 1], with
alfa[k] = dq[k - 1] / (dq[k - 1] + dq[k]) and beta[k] = 1 - alfa[k].
At surface face k = 0, alfa[0] = 1.0, beta[0] = 0.0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dq
|
Array
|
Cell relative mass fractions of shape |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array]
|
Tuple |
interp_cell_to_face_jax
¶
Interpolate a cell-centered array of shape (nz,) to faces (nz,).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dq
|
Array
|
Cell relative mass fractions of shape |
required |
cell_val
|
Array
|
Cell-centered quantity of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Face-centered array of shape |
eval_optical_depth_jax
¶
Integrate optical depth tau inward from the surface across nz zones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dm
|
Array
|
Cell masses of shape |
required |
rmid
|
Array
|
Cell mid-radii of shape |
required |
opacity
|
Array
|
Cell Rosseland mean opacities of shape |
required |
tau_surf
|
float | Array
|
Surface optical depth |
2.0 / 3.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Face optical depth |
eval_face_mlt_and_brunt_jax
¶
eval_face_mlt_and_brunt_jax(
dq,
ln_r,
lum,
m_grav,
rho,
t,
peos,
ln_peos,
grada,
cp,
chi_rho,
chi_t,
mu,
opacity,
tau_0=2.0 / 3.0,
mixing_length_alpha=2.0,
use_ledoux_criterion=False,
cgrav=_G_CGS,
brunt_b=None,
)
Evaluate face temperature gradients, Cox MLT, and Brunt-Väisälä N^2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dq
|
Array
|
Cell relative mass fractions of shape |
required |
ln_r
|
Array
|
Face natural log radius of shape |
required |
lum
|
Array
|
Face luminosity of shape |
required |
m_grav
|
Array
|
Face enclosed gravitational mass of shape |
required |
rho
|
Array
|
Cell density of shape |
required |
t
|
Array
|
Cell temperature of shape |
required |
peos
|
Array
|
Cell total pressure of shape |
required |
ln_peos
|
Array
|
Cell natural log pressure of shape |
required |
grada
|
Array
|
Cell adiabatic temperature gradient of shape |
required |
cp
|
Array
|
Cell specific heat at constant pressure of shape |
required |
chi_rho
|
Array
|
Cell |
required |
chi_t
|
Array
|
Cell |
required |
mu
|
Array
|
Cell mean molecular weight of shape |
required |
opacity
|
Array
|
Cell opacity of shape |
required |
tau_0
|
float | Array
|
Surface optical depth |
2.0 / 3.0
|
mixing_length_alpha
|
float
|
Mixing-length parameter |
2.0
|
use_ledoux_criterion
|
bool
|
Whether to include |
False
|
cgrav
|
float | Array
|
Gravitational constant ( |
_G_CGS
|
brunt_b
|
Array | None
|
Optional precomputed Brunt composition term of shape |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dictionary containing `("scale_height", "gradr", "gradl", "gradt", |
dict[str, Array]
|
"mlt_vc", "mlt_d", "mlt_cdc", "brunt_b", "brunt_n2") |
eval_hydro_residuals_jax
¶
eval_hydro_residuals_jax(
dq,
dm,
dm_bar,
m_grav,
lnd,
ln_t,
ln_r,
lum,
lnd_start,
ln_peos,
ln_e,
energy_start,
gradt,
eps_nuc,
non_nuc_neu,
eps_mdot,
ln_peos_surf,
ln_t_surf,
dt,
r_center=0.0,
l_center=0.0,
cgrav=_G_CGS,
non_nuc_neu_start=None,
dedt_eqn_r_scale=100000000.0,
use_momentum_outer_bc=False,
ln_r_start=None,
m_center=0.0,
v_center=0.0,
peos_start=None,
)
Evaluate the 4-equation hydrostatic Henyey residual array (nz, 4).
Computes the dimensionless residual slots (i_equ_l, i_dv_dt, i_dlnd_dt,
i_dlne_dt) across all nz zones in pure differentiable JAX (float64),
matching eval_henyey_equations in flexmesa-star.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dq
|
Array
|
Cell relative mass fractions of shape |
required |
dm
|
Array
|
Cell masses of shape |
required |
dm_bar
|
Array
|
Face control-volume masses of shape |
required |
m_grav
|
Array
|
Face enclosed gravitational masses of shape |
required |
lnd
|
Array
|
Cell natural log densities of shape |
required |
ln_t
|
Array
|
Cell natural log temperatures of shape |
required |
ln_r
|
Array
|
Face natural log radii of shape |
required |
lum
|
Array
|
Face luminosities of shape |
required |
lnd_start
|
Array
|
Start-of-step cell |
required |
ln_peos
|
Array
|
Cell natural log total pressure of shape |
required |
ln_e
|
Array
|
Cell natural log specific internal energy of shape |
required |
energy_start
|
Array
|
Start-of-step specific internal energy of shape |
required |
gradt
|
Array
|
Face actual temperature gradient of shape |
required |
eps_nuc
|
Array
|
Cell nuclear energy generation rate of shape |
required |
non_nuc_neu
|
Array
|
Cell thermal neutrino loss rate of shape |
required |
eps_mdot
|
Array
|
Cell mass-adjustment energy rate of shape |
required |
ln_peos_surf
|
float | Array
|
Surface natural log pressure from atmosphere BC. |
required |
ln_t_surf
|
float | Array
|
Surface natural log temperature from atmosphere BC. |
required |
dt
|
float | Array
|
Timestep in seconds ( |
required |
r_center
|
float | Array
|
Inner core radius in centimeters ( |
0.0
|
l_center
|
float | Array
|
Inner core luminosity in |
0.0
|
cgrav
|
float | Array
|
Gravitational constant ( |
_G_CGS
|
non_nuc_neu_start
|
Array | None
|
Optional start-of-step cell thermal neutrino loss
rate of shape |
None
|
dedt_eqn_r_scale
|
float | Array
|
Energy equation relative cell-fraction scale cap
( |
100000000.0
|
use_momentum_outer_bc
|
bool | Array
|
When |
False
|
ln_r_start
|
Array | None
|
Optional start-of-step face |
None
|
m_center
|
float | Array
|
Inner core mass in grams ( |
0.0
|
v_center
|
float | Array
|
Inner core boundary velocity in |
0.0
|
peos_start
|
Array | None
|
Optional start-of-step cell pressure of shape |
None
|
Returns:
| Type | Description |
|---|---|
Array
|
Dimensionless residual matrix |
solve_henyey_linear_jax
¶
Solve the scaled Henyey linear system J dx_scaled = -equ.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lblk
|
Array
|
Sub-diagonal blocks of shape |
required |
dblk
|
Array
|
Diagonal blocks of shape |
required |
ublk
|
Array
|
Super-diagonal blocks of shape |
required |
equ
|
Array
|
Residual vector of shape |
required |
solver_mode
|
str
|
|
'pcr'
|
Returns:
| Type | Description |
|---|---|
Array
|
Scaled Newton step |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Winds & Convective Mixing Kernels (flexmesa.star.jax_winds_mix)¶
flexmesa.star.jax_winds_mix
¶
Differentiable JAX kernels for stellar winds, Lagrangian mixing coupling
(sig), and conservative species diffusion (flexmesa.star, Wave 4.3).
eval_convection_sigmas_jax
¶
eval_convection_sigmas_jax(
r,
rho,
dq,
d_mix,
xmstar,
dt,
mix_factor=1.0,
sig_term_limit=10000000000.0,
)
Compute Lagrangian face mixing coupling factors sig ((nz,)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
Array
|
Face radii of shape |
required |
rho
|
Array
|
Cell densities of shape |
required |
dq
|
Array
|
Cell relative mass fractions of shape |
required |
d_mix
|
Array
|
Face diffusion coefficients of shape |
required |
xmstar
|
float
|
Enveloped mass |
required |
dt
|
float
|
Timestep in seconds ( |
required |
mix_factor
|
float
|
Global diffusivity multiplier ( |
1.0
|
sig_term_limit
|
float
|
Stability limiter factor ( |
10000000000.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Face coupling factors |
eval_dxdt_mix_jax
¶
Evaluate explicit mass-conserving diffusive species mixing rates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xa
|
Array
|
Cell species mass fractions of shape |
required |
sig
|
Array
|
Face Lagrangian coupling factors of shape |
required |
dm
|
Array
|
Cell masses of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Diffusive rates |
eval_winds_jax
¶
Evaluate differentiable wind mass-loss rates (M_sun yr^-1, g s^-1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l_surf
|
float | Array
|
Surface luminosity in |
required |
m_surf
|
float | Array
|
Stellar mass in grams ( |
required |
t_surf
|
float | Array
|
Effective temperature in Kelvin ( |
required |
x_surf
|
float | Array
|
Surface hydrogen mass fraction |
0.7
|
y_surf
|
float | Array
|
Surface helium mass fraction |
0.28
|
z_surf
|
float | Array
|
Surface metal mass fraction |
0.02
|
eta
|
float
|
Wind scaling multiplier ( |
1.0
|
Returns:
| Type | Description |
|---|---|
dict[str, Array]
|
Dictionary of arrays with shape |
dict[str, Array]
|
inputs) containing |
dict[str, Array]
|
|
dict[str, Array]
|
|
Mesh & Timestep Control Kernels (flexmesa.star.jax_evolve)¶
flexmesa.star.jax_evolve
¶
Differentiable JAX kernels for adaptive mesh spacing variation (g_k),
structural variation (varcontrol), and the Söderlind & Wang (2006) H211PI
digital timestep filter (flexmesa.star, Wave 4.4).
eval_mesh_gval_jax
¶
eval_mesh_gval_jax(
ln_peos,
ln_t,
mesh_delta_coeff=1.0,
p_function_weight=40.0,
t_function1_weight=110.0,
)
Compute dimensionless mesh variation indicator g_k ((nz,)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ln_peos
|
Array
|
Cell logarithmic pressures of shape |
required |
ln_t
|
Array
|
Cell logarithmic temperatures of shape |
required |
mesh_delta_coeff
|
float
|
Global mesh spacing factor ( |
1.0
|
p_function_weight
|
float
|
Pressure spacing weight ( |
40.0
|
t_function1_weight
|
float
|
Temperature spacing weight ( |
110.0
|
Returns:
| Type | Description |
|---|---|
Array
|
Dimensionless mesh variation array |
eval_varcontrol_jax
¶
Evaluate normalized structural variation varcontrol (timestep.f90).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lnd
|
Array
|
Current cell log-densities of shape |
required |
ln_t
|
Array
|
Current cell log-temperatures of shape |
required |
ln_r
|
Array
|
Current face log-radii of shape |
required |
lum
|
Array
|
Current face luminosities of shape |
required |
lnd_old
|
Array
|
Previous step cell log-densities of shape |
required |
ln_t_old
|
Array
|
Previous step cell log-temperatures of shape |
required |
ln_r_old
|
Array
|
Previous step face log-radii of shape |
required |
lum_old
|
Array
|
Previous step face luminosities of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Scalar JAX array holding |
eval_h211_timestep_jax
¶
eval_h211_timestep_jax(
dt,
dt_old,
dt_limit_ratio,
dt_limit_ratio_old=1.0,
max_timestep_factor=1.2,
min_timestep_factor=0.5,
)
Evaluate Söderlind & Wang (2006) H211PI next timestep dt_next (s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float | Array
|
Current timestep in seconds ( |
required |
dt_old
|
float | Array
|
Previous timestep in seconds ( |
required |
dt_limit_ratio
|
float | Array
|
Current step variation ratio |
required |
dt_limit_ratio_old
|
float | Array
|
Previous step variation ratio |
1.0
|
max_timestep_factor
|
float
|
Upper multiplier cap ( |
1.2
|
min_timestep_factor
|
float
|
Lower multiplier floor ( |
0.5
|
Returns:
| Type | Description |
|---|---|
Array
|
Proposed next timestep |
Diffusion, Phase Separation & Rotation Kernels (flexmesa.star.jax_diffusion_rot)¶
flexmesa.star.jax_diffusion_rot
¶
Differentiable JAX kernels for Wave 5.1 stellar diffusion, shellular rotation, Spruit-Tayler magnetic dynamo, and crystallization phase separation.
eval_rotation_fp_ft_jax
¶
Evaluates Fabry et al. (2022) / Paxton et al. (2019) Roche rotational
distortion polynomials (f_P, f_T, i_rot / r^2).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
w_div_w_crit
|
Array
|
Dimensionless angular velocity |
required |
fp_min
|
float
|
Floor on |
0.75
|
ft_min
|
float
|
Floor on |
0.95
|
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array]
|
Tuple |
eval_omega_crit_jax
¶
Evaluates the critical Roche angular velocity Omega_crit (rad/s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cgrav
|
Array
|
Local gravitational constant (cm^3 g^-1 s^-2). |
required |
m_grav
|
Array
|
Enclosed gravitational mass (g). |
required |
r_polar
|
Array
|
Polar/spherical radius (cm). |
required |
lum
|
Array
|
Radiative luminosity (erg/s). |
required |
opacity
|
Array
|
Rosseland mean opacity (cm^2/g). |
required |
max_gamma_edd
|
float
|
Cap on Eddington factor |
0.99
|
Returns:
| Type | Description |
|---|---|
Array
|
Critical angular velocity |
eval_rotational_mixing_zone_jax
¶
eval_rotational_mixing_zone_jax(
r,
hp,
grav,
rho,
t,
cp,
opacity,
chi_t,
chi_rho,
grada,
gradt,
brunt_n2_t,
brunt_n2_mu,
omega,
dln_omega_dln_r,
abar,
zbar,
)
Evaluates the five hydrodynamic rotational instabilities (DSI, SH, SSI, ES, GSF) and Spruit-Tayler (2002) magnetic dynamo in JAX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
Array
|
Shell radius (cm). |
required |
hp
|
Array
|
Pressure scale height (cm). |
required |
grav
|
Array
|
Effective gravity (cm/s^2). |
required |
rho
|
Array
|
Mass density (g/cm^3). |
required |
t
|
Array
|
Temperature (K). |
required |
cp
|
Array
|
Isobaric specific heat (erg g^-1 K^-1). |
required |
opacity
|
Array
|
Rosseland mean opacity (cm^2/g). |
required |
chi_t
|
Array
|
|
required |
chi_rho
|
Array
|
|
required |
grada
|
Array
|
Adiabatic temperature gradient (dimensionless). |
required |
gradt
|
Array
|
Actual temperature gradient (dimensionless). |
required |
brunt_n2_t
|
Array
|
Thermal Brunt-Vaisala component |
required |
brunt_n2_mu
|
Array
|
Composition Brunt-Vaisala component |
required |
omega
|
Array
|
Angular velocity |
required |
dln_omega_dln_r
|
Array
|
Dimensionless shear |
required |
abar
|
Array
|
Mean atomic mass number |
required |
zbar
|
Array
|
Mean ionic charge |
required |
Returns:
| Type | Description |
|---|---|
tuple[Array, Array, Array, Array, Array, Array, Array, Array, Array]
|
Tuple |
eval_caplan_ocp_dstar_jax
¶
Evaluates the Caplan, Bauer & Freeman (2022) strong-coupling OCP
dimensionless self-diffusion coefficient D*(Gamma, kappa).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gamma_i
|
Array
|
Coulomb coupling parameter |
required |
kappa
|
Array
|
Screening parameter |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Dimensionless self-diffusion coefficient |
eval_burgers_velocities_jax
¶
Solves the full-rank (2m + 2) x (2m + 2) Thoul, Bahcall & Loeb (1994)
multi-species Burgers system in JAX with Stanton & Murillo (2016) Yukawa
collision integrals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
Array
|
Atomic mass numbers |
required |
z
|
Array
|
Ionic charges |
required |
x_mass
|
Array
|
Species mass fractions |
required |
rho
|
Array
|
Mass density (g/cm^3). |
required |
t
|
Array
|
Temperature (K). |
required |
dlnt_dr
|
Array
|
Temperature gradient |
required |
g_grav
|
Array
|
Gravitational acceleration (cm/s^2). |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Tuple |
Array
|
shape |
eval_phase_separation_shift_jax
¶
Evaluates the Blouin et al. (2020, 2021) 5th-order polynomial
solid-liquid distillation shift Delta x_heavy in JAX.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_heavy
|
Array
|
Mass fraction of the heavier ion species (O16 or Ne20). |
required |
is_one_mixture
|
bool
|
|
False
|
Returns:
| Type | Description |
|---|---|
Array
|
Solid-minus-liquid mass-fraction enrichment |
HLLC Hydrodynamics & Pulsation Kernels (flexmesa.star.jax_hydro_pulse)¶
flexmesa.star.jax_hydro_pulse
¶
Branchless @jax.jit kernels for Wave 5.2: HLLC Riemann hydrodynamics,
Dziembowski pulsation variables, STELLA Sobolev optical depths, and GYRE /
ADIPLS BVP wrappers (hydro_riemann.f90, hydro_momentum.f90,
pulse_utils.f90, and parse_swd_vel_feii.f90).
RSP2 time-dependent turbulent convection kernels are defined in
flexmesa.star.jax_rsp and re-exported here for backwards compatibility.
eval_hllc_face_jax
¶
eval_hllc_face_jax(
p_l,
rho_l,
cs_l,
u_l,
dm_l,
p_r,
rho_r,
cs_r,
u_r,
dm_r,
r_face,
m_grav_face,
cgrav_face,
)
Evaluate the well-balanced Lagrangian HLLC Riemann state at interior
faces (do1_Riemann_Types in star/private/hydro_riemann.f90).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_l, rho_l, cs_l, u_l, dm_l
|
Left (inner) cell pressure ( |
required | |
p_r, rho_r, cs_r, u_r, dm_r
|
Right (outer) cell state, shape
|
required | |
r_face, m_grav_face, cgrav_face
|
Face radius ( |
required |
Returns:
| Type | Description |
|---|---|
_Arr7
|
7-tuple |
_Arr7
|
shape |
eval_hllc_surface_face_jax
¶
eval_hllc_surface_face_jax(
p_surf_cell,
rho_surf,
cs_surf,
u_surf,
dm_surf,
r_surf,
m_surf,
cgrav_surf,
p_bc,
)
Evaluate the surface (\(k = 0\)) HLLC Riemann boundary state
(setup_for_surf_Riemann in star/private/hydro_riemann.f90).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_surf_cell, rho_surf, cs_surf, u_surf, dm_surf
|
Outermost cell
pressure ( |
required | |
r_surf, m_surf, cgrav_surf
|
Surface radius ( |
required | |
p_bc
|
Array
|
Exterior surface boundary pressure ( |
required |
Returns:
| Type | Description |
|---|---|
_Arr7
|
7-tuple |
_Arr7
|
shape |
eval_riemann_momentum_residual_jax
¶
eval_riemann_momentum_residual_jax(
u_k,
u_old_k,
dt,
dm_k,
r_outer,
r_inner,
p_face_outer,
p_face_inner,
p_cell_k,
g_cell_k,
)
Evaluate the spherical Lagrangian HLLC momentum residual
(do1_momentum_eqn in star/private/hydro_momentum.f90).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u_k, u_old_k
|
Current and old cell velocities ( |
required | |
dt
|
Array
|
Timestep ( |
required |
dm_k
|
Array
|
Cell mass ( |
required |
r_outer, r_inner
|
Outer and inner face radii ( |
required | |
p_face_outer, p_face_inner
|
Outer and inner HLLC contact pressures
( |
required | |
p_cell_k
|
Array
|
Cell total pressure ( |
required |
g_cell_k
|
Array
|
Cell gravitational acceleration ( |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Momentum equation residual ( |
eval_dziembowski_variables_jax
¶
Evaluate the 5 dimensionless Dziembowski pulsation variables
\((V, V_g, A_*, U, c_1)\) across a stellar profile (pulse_utils.f90).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r, m, p, rho, gamma1, n2, cgrav
|
Zone radius ( |
required | |
r_tot, m_tot
|
Total stellar radius \(R\) ( |
required |
Returns:
| Type | Description |
|---|---|
_Arr5
|
5-tuple |
eval_sobolev_feii_5169_tau_jax
¶
Evaluate the STELLA homologous Sobolev optical depth
\(\tau_{\mathrm{Sob}}\) for Fe II 5169 (parse_swd_vel_feii.f90).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rho
|
Array
|
Zone mass density ( |
required |
x_fe
|
Array
|
Iron mass fraction ( |
required |
eta
|
Array
|
Population fraction \(\eta(\rho, T)\) of shape |
required |
t_exp_s
|
float | Array
|
Time since shock breakout ( |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Sobolev optical depth \(\tau_{\mathrm{Sob}}\) of shape |
solve_gyre_mesa_modes
¶
Solve the 4th/6th-order GYRE BVP on a GYRE MESA model string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesa_str
|
str
|
|
required |
l_deg
|
int
|
Spherical harmonic degree \(\ell\). |
required |
omega_min, omega_max
|
Dimensionless frequency scan bounds. |
required | |
n_scan
|
int
|
Number of scan intervals. |
200
|
nonadiabatic
|
bool
|
Whether to include radiative cooling perturbations. |
True
|
Returns:
| Type | Description |
|---|---|
list[tuple[int, int, int, int, float, float, float, float, float]]
|
List of eigenmode tuples `(l, n_p, n_g, n_pg, omega_re, omega_im, |
list[tuple[int, int, int, int, float, float, float, float, float]]
|
freq_uhz, inertia, eta_growth)`. |
solve_adipls_fgong_modes
¶
Solve the 4th/6th-order ADIPLS BVP on an FGONG model string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fgong_str
|
str
|
|
required |
l_deg
|
int
|
Spherical harmonic degree \(\ell\). |
required |
freq_min_uhz, freq_max_uhz
|
Frequency scan bounds ( |
required | |
n_scan
|
int
|
Number of scan intervals. |
500
|
Returns:
| Type | Description |
|---|---|
list[tuple[int, int, int, int, float, float, float, float]]
|
List of eigenmode tuples `(l, n_p, n_g, n_pg, sigma2, freq_uhz, |
list[tuple[int, int, int, int, float, float, float, float]]
|
inertia, delta_nu_share)`. |
run_stella_from_hyd_abn
¶
Run the STELLA bolometric light-curve and Fe II 5169 solver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hyd_str
|
str
|
|
required |
abn_str
|
str
|
|
required |
eta_str
|
str
|
|
required |
times_days
|
list[float]
|
Post-breakout epochs ( |
required |
Returns:
| Type | Description |
|---|---|
tuple[list[tuple[float, float]], list[tuple[float, float, float, float]]]
|
2-tuple |
RSP & RSP2 Turbulent Pulsation Kernels (flexmesa.star.jax_rsp)¶
flexmesa.star.jax_rsp
¶
Branchless @jax.jit (float64) kernels for RSP and RSP2 radial
stellar pulsation and time-dependent turbulent convection (hydro_rsp2.f90
and rsp/eval_equations.inc, resolving Issue #5).
rsp2_flux_limiter_jax
¶
Evaluate the quintic \(C^2\) smootherstep enthalpy flux limiter
(flux_limiter_function in star/private/hydro_rsp2.f90:610-642).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
Dimensionless convective-to-enthalpy flux ratio \(X = G/F\) of shape
|
required |
Returns:
| Type | Description |
|---|---|
_Arr2
|
2-tuple |
_Arr2
|
\(\mathrm{FL}(X)\) and analytical derivative \(\mathrm{dFL}/\mathrm{d}X\). |
compute_rsp2_uq_face_jax
¶
Evaluate face eddy-viscous acceleration \(U_{q,\mathrm{face},k}\)
(compute_Uq_face in star/private/hydro_rsp2.f90:785-817).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chi_outer
|
Array
|
Outer cell eddy viscosity \(\mathrm{X}_{k-1}\) ( |
required |
chi_inner
|
Array
|
Inner cell eddy viscosity \(\mathrm{X}_k\) ( |
required |
r_face
|
Array
|
Face radius \(r_k\) ( |
required |
dm_bar
|
Array
|
Face mass spacing \(\overline{\Delta m}_k\) ( |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Eddy-viscous acceleration $4\pi(\mathrm{X}_{k-1}-\mathrm{X}_k) / |
Array
|
(r_k \overline{\Delta m}_k)$ ( |
eval_rsp2_zone_jax
¶
eval_rsp2_zone_jax(
w,
t,
rho,
p,
cp,
grad_ad,
delta,
kappa,
hp_cell,
grad_t,
r_outer,
r_inner,
u_outer,
u_inner,
dm,
dlnd_dt,
alfa=1.5,
alfap=1.0,
alfas=1.0,
alfad=1.0,
alfam=0.25,
gammar=1.0,
min_w2_for_turbulence=0.0,
w_min_for_damping=0.0,
)
Evaluate cell-centered RSP2 turbulent pressure, eddy viscosity,
viscous heating, and turbulent energy terms (hydro_rsp2.f90:717-934).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
w
|
Array
|
Specific turbulent velocity \(\sqrt{e_t}\) ( |
required |
t, rho, p, cp, grad_ad, delta, kappa
|
Cell thermodynamic state and
opacity ( |
required | |
hp_cell, grad_t
|
Cell pressure scale height ( |
required | |
r_outer, r_inner, u_outer, u_inner
|
Bounding radii ( |
required | |
dm
|
Array
|
Cell mass ( |
required |
dlnd_dt
|
Array
|
Logarithmic density rate \(\mathrm{d}\ln\rho/\mathrm{d}t\)
( |
required |
alfa, alfap, alfas, alfad, alfam, gammar
|
Kuhfuss (1986) |
required | |
min_w2_for_turbulence, w_min_for_damping
|
Minimum \(w^2\) ( |
required |
Returns:
| Type | Description |
|---|---|
_Arr7
|
7-tuple `(p_turb, chi_turb, eq_visc, source_s, sink_d, sink_dr, |
_Arr7
|
de_t_dt) |
eval_rsp2_face_jax
¶
eval_rsp2_face_jax(
r_face,
m_grav_face,
cgrav_face,
p_face,
rho_face,
t_face,
cp_face,
grad_ad_face,
kappa_face,
w_inner,
w_outer,
t4_inner,
t4_outer,
lnp_inner,
lnp_outer,
chi_face,
du_over_r_face,
dm_bar,
alfa=1.5,
alfac=1.0,
alfat=0.01,
)
Evaluate face-centered RSP2 scale height, superadiabaticity,
convective transport factor \(\Pi_k\), and radiative/convective/turbulent
luminosities (hydro_rsp2.f90:230-285, 436-608, 1015-1172).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_face, m_grav_face, cgrav_face
|
Face radius ( |
required | |
p_face, rho_face, t_face, cp_face, grad_ad_face, kappa_face
|
Interpolated face thermodynamic state and opacity. |
required | |
w_inner, w_outer
|
Adjacent cell turbulent velocities ( |
required | |
t4_inner, t4_outer
|
Adjacent cell \(T^4\) ( |
required | |
lnp_inner, lnp_outer
|
Adjacent cell \(\ln P\). |
required | |
chi_face, du_over_r_face
|
Unused compatibility arguments retained for call-signature stability. |
required | |
dm_bar
|
Array
|
Face mass spacing \(\overline{\Delta m}_k\) ( |
required |
alfa, alfac, alfat
|
|
required |
Returns:
| Type | Description |
|---|---|
_Arr6
|
6-tuple |
_Arr6
|
|
solve_stationary_rsp2_w_jax
¶
solve_stationary_rsp2_w_jax(
t,
rho,
p,
cp,
grad_ad,
delta,
kappa,
hp_cell,
grad_t,
alfa=1.5,
alfas=1.0,
alfad=1.0,
gammar=1.0,
)
Solve the stationary local RSP2 turbulent balance
\(S(w) - D(w) - D_r(w) = 0\) for \(w\) (hydro_rsp2.f90:1195-1253).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t, rho, p, cp, grad_ad, delta, kappa
|
Cell thermodynamic state and
opacity ( |
required | |
hp_cell, grad_t
|
Cell pressure scale height ( |
required | |
alfa, alfas, alfad, gammar
|
|
required |
Returns:
| Type | Description |
|---|---|
Array
|
Equilibrium turbulent velocity \(w\) ( |
eval_rsp2_turbulent_eqn_residual_jax
¶
eval_rsp2_turbulent_eqn_residual_jax(
w,
w_start,
rho,
rho_start,
p_turb,
lt_outer,
lt_inner,
coupl,
eq_visc,
dm,
dt,
cp,
t,
)
Evaluate the dimensionless RSP2 turbulent-energy Henyey residual
(do1_turbulent_energy_eqn in star/private/hydro_rsp2.f90:312-417).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
w, w_start
|
End-of-step and start-of-step turbulent velocities
( |
required | |
rho, rho_start
|
End-of-step and start-of-step cell densities
( |
required | |
p_turb
|
Array
|
Cell turbulent pressure \(P_{\mathrm{trb},k}\) ( |
required |
lt_outer, lt_inner
|
Outer and inner face turbulent luminosities
( |
required | |
coupl
|
Array
|
Net convective coupling \(S_k - D_k - D_{r,k}\)
( |
required |
eq_visc
|
Array
|
Eddy-viscous heating \(E_{q,\mathrm{cell},k}\)
( |
required |
dm, dt
|
Cell mass ( |
required | |
cp, t
|
Specific heat \(C_P\) ( |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Dimensionless turbulent-energy equation residual of shape |
eval_rsp_hyd_fluxes_jax
¶
eval_rsp_hyd_fluxes_jax(
r_face,
t_outer,
t_inner,
kap_outer,
kap_inner,
rho_face,
t_face,
pii_face,
w_outer,
w_inner,
hp_face,
dm_bar,
du_compr,
cs_cell,
rho_cell,
alfa=1.5,
alfac=1.0,
alfat=0.01,
cq=4.0,
zsh=0.1,
)
Evaluate Stellingwerf radiative luminosity \(L_r\), Kuhfuss convective
luminosity \(L_c\), turbulent kinetic luminosity \(L_t\), and artificial
viscosity pressure \(Q_{\mathrm{visc}}\) (rsp/eval_equations.inc).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_face
|
Array
|
Face radius ( |
required |
t_outer, t_inner
|
Outer ( |
required | |
kap_outer, kap_inner
|
Outer and inner cell opacities ( |
required | |
rho_face, t_face, pii_face, hp_face
|
Face density ( |
required | |
w_outer, w_inner
|
Outer and inner cell turbulent velocities ( |
required | |
dm_bar
|
Array
|
Face mass spacing ( |
required |
du_compr, cs_cell, rho_cell
|
Cell velocity difference \(u_{\mathrm{in}}
- u_{\mathrm{out}}\) ( |
required | |
alfa, alfac, alfat, cq, zsh
|
Mixing-length, convective, turbulent diffusion, and artificial viscosity parameters. |
required |
Returns:
| Type | Description |
|---|---|
_Arr4
|
4-tuple |
_Arr4
|
|
Inlist Bundle & test_suite Runner (flexmesa.star.e2e)¶
flexmesa.star.e2e
¶
End-to-end MESA inlist parser, ./rn stage extractor, multi-stage
test_suite case execution driver, and linear/envelope pulsation helpers
(flexmesa.star.e2e).
copy_cleaned_case
¶
Copy an upstream MESA test case directory while stripping unsupported and unused namelist keys for strict cleaned-copy verification.
parse_inlist_bundle
¶
Parse a MESA inlist file and recursively resolve read_extra_*_inlist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inlist_path
|
str | Path
|
Path to the entry |
required |
allow_unsupported_controls
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary of resolved |
parse_rn_stages
¶
Parse an upstream MESA ./rn bash script into execution stages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case_dir
|
str | Path
|
Path to the |
required |
skip_optional
|
bool
|
Whether |
True
|
Returns:
| Type | Description |
|---|---|
list[tuple[str, str, str]]
|
List of |
run_test_suite_case
¶
run_test_suite_case(
case_dir,
skip_optional=True,
max_steps_per_stage=None,
verify_restart=False,
allow_unsupported_controls=False,
extras=None,
)
Execute a multi-stage upstream MESA test_suite case directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
case_dir
|
str | Path
|
Path to the |
required |
skip_optional
|
bool
|
Whether |
True
|
max_steps_per_stage
|
int | None
|
Optional cap on evolutionary steps per stage. |
None
|
verify_restart
|
bool
|
Whether to verify internal |
False
|
allow_unsupported_controls
|
bool
|
When |
False
|
extras
|
Any
|
Optional Python |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Structured dictionary containing per-stage reports, step counts, |
dict[str, Any]
|
Newton iterations, final physical state, and wall-clock runtime. |
eval_linear_oscillation_modes
¶
Evaluate linearized adiabatic and non-adiabatic oscillation eigenmodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
StarModel
|
Active |
required |
l_deg
|
int
|
Spherical harmonic degree |
required |
n_orders
|
list[int]
|
Radial order indices |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of dictionaries with keys `("l", "n_pg", "freq_hz", "freq_uhz", |
list[dict[str, Any]]
|
"period_days", "growth_rate_s", "growth_timescale_days", "inertia")`. |
eval_target_mode_frequency_and_growth
¶
Evaluate the target oscillation mode specified by x_integer_ctrl(3..4)
and x_ctrl(1..2) on model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
StarModel
|
Active |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[str, Any], bool]
|
Tuple |
eval_astero_scaling_dnu_numax_uhz
¶
Evaluate global asteroseismic scaling parameters
\((\Delta\nu, \nu_{\max})\) in \(\mu\mathrm{Hz}\) on model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
StarModel
|
Active |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float]
|
Tuple |
eval_rsp_lina_modes
¶
Evaluate linear non-adiabatic (LINA) radial pulsation periods and
growth rates for an RSP envelope.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_msun
|
float
|
Total stellar mass in \(M_\odot\). |
required |
l_lsun
|
float
|
Surface luminosity in \(L_\odot\). |
required |
teff_k
|
float
|
Effective temperature in |
required |
x_h
|
float
|
Hydrogen mass fraction \(X\). |
0.73
|
z_metal
|
float
|
Metal mass fraction \(Z\). |
0.007
|
n_modes
|
int
|
Number of radial modes to compute ( |
3
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of dictionaries with keys `("mode_index", "period_days", |
list[dict[str, Any]]
|
"growth_rate")`. |
build_rsp_envelope_model
¶
Build a static radial stellar pulsation (RSP) envelope StarModel
(create_RSP_model = .true.).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m_msun
|
float
|
Envelope total stellar mass in \(M_\odot\). |
4.165
|
l_lsun
|
float
|
Envelope surface luminosity in \(L_\odot\). |
1438.8
|
teff_k
|
float
|
Envelope effective temperature in |
6050.0
|
x_h
|
float
|
Hydrogen mass fraction \(X\). |
0.73
|
z_metal
|
float
|
Metal mass fraction \(Z\). |
0.007
|
Returns:
| Type | Description |
|---|---|
StarModel
|
Initialized |
Compiled Rust Extension Bridge (flexmesa._rust)¶
Low-level Safe Rust PyO3 bindings exposed via flexmesa._rust for 1D stellar structure, evolution, extras hooks, pulsation exports, and test-suite drivers (_ArrF64 denotes a float64 NumPy ndarray).
star_py, star_lib_py, and extras_py¶
RustStarModel(class RustStarModel; static constructorsfrom_zams,from_pre_ms,from_mod_str,from_photo_bytes; core methodsto_mod_str,to_photo_bytes,eval_hydro_vars,set_evolve_controls,save_start_values,save_old_values,record_start_of_step_energy_integrals,eval_equations,solve_henyey,update_mixing,eval_dxdt_mix,solve_diffusion,run_omega_mix,step_struct_burn_mix,apply_wind_and_adjust_mass,adjust_mesh,pick_next_timestep,evolve_step,evolve,history_tuple,to_history_line,to_profile_str,copy,set_primary_state): Python wrapper aroundflexmesa_star::StarModelexposing primary state, zone/face profiles, controls, and solver telemetry.star_interp_q((dq1: _ArrF64, v1: _ArrF64, dq2: _ArrF64) -> _ArrF64): Interpolates profilev1from Lagrangian griddq1ontodq2(interp_q).star_yrs_for_init_timestep((m_msun: float) -> float): Computes the initial ZAMS timestep in years (yrs_for_init_timestep).StarLibModel(class StarLibModel; static constructornew_for_build; propertiesnz,species,model_number; methodsget,set,get_scalar,set_scalar,xa,get_atm_options,set_atm_options,normalize_dqs,set_qs,set_m_and_dm,set_dm_bar,change_to_xa_for_accretion,basic_composition_info,get_atm_pt,get_surf_pt,solve_eos_given_pgas_t,solve_eos_given_pgas_t_auto,do_eos_for_cell,do_kap_for_cell,set_mlt_vars,d_gradt_dlnt00,pack_xh,write_model): Model handle exposing thestar_libsubset for custom build hooks (#453).atm_teff((l: float, r: float) -> float): Evaluates black-body effective temperature in \(\mathrm{K}\) for \(L\) in \(\mathrm{erg\,s^{-1}}\) and \(R\) in \(\mathrm{cm}\) (atm_Teffinatm/public/atm_lib.f90).crmath_log((x: float) -> float): Evaluates correctly rounded natural logarithm (loginmath_lib).PyRspBuildContext(class PyRspBuildContext; attributescase_dir,output_dir,work_dir,rsp_mass,rsp_x,rsp_z,rsp_alfam,rsp_alfap,rsp_alfat,rsp_gammar,x_ctrl,x_integer_ctrl,x_logical_ctrl,x_character_ctrl; methodeval_lina): Context passed into Pythonother_rsp_build_modelhooks for staticRSPenvelope andLINAinstability scans (#148).star_apply_extras_updates((model: RustStarModel, updates: dict[str, Any]) -> None): Applies a MESA star extras update dictionary onto aRustStarModelin place (#148,#231), raisingValueErroron unrecognized keys or invalid values.star_extras_snapshot((model: RustStarModel, case_dir: str = "", include_history: bool = True) -> dict[str, Any]): Builds the MESAstar_infoextras snapshot dictionary for aRustStarModelwithout running a full trace (#148,#231).star_solve_gyre_mesa_modes_full((gyre_content: str, l: int = 0, omega_min: float = 0.5, omega_max: float = 12.0, n_freq: int = 400) -> list[tuple[int, int, int, int, float, list[float], list[float]]]): Solves adiabaticGYREMESA modes and returns(l, n_p, n_g, n_pg, freq_uhz, x_grid, xi_r)per eigenmode.
star_e2e_py¶
binary_run_test_suite_case((case_dir: str, max_steps_cap: int | None = None, allow_unsupported_controls: bool = False, extras: Any = None) -> dict[str, Any]): Runs a coupledbinary/test_suite/<case>directory and returns a report dictionary.star_build_rsp_envelope_model((m_msun: float, l_lsun: float, teff_k: float, x_h: float = 0.73, z_metal: float = 0.007) -> Any): Builds a staticRSPenvelopeRustStarModelwith \((M/M_\odot, L/L_\odot, T_{\mathrm{eff}}, X, Z)\).star_copy_cleaned_case((src_dir: str, dst_dir: str, suite: str = "star") -> None): Copies astar,binary, orasterocase directory fromsrc_dirtodst_dirwhile stripping unsupported or unused namelist keys.star_eval_astero_scaling_dnu_numax_uhz((model: Any) -> tuple[float, float]): Evaluates global asteroseismic scaling parameters \((\Delta\nu, \nu_{\max})\) in \(\mu\mathrm{Hz}\) onmodel.star_eval_linear_oscillation_modes((model: Any, l: int = 1, n_orders: list[int] = ...) -> list[dict[str, Any]]): Evaluates adiabatic/non-adiabatic linear oscillation modes at degreelacross radial ordersn_ordersonmodel.star_eval_rsp_lina_modes((m_msun: float, l_lsun: float, teff_k: float, x_h: float = 0.73, z_metal: float = 0.007, n_modes: int = 3) -> list[dict[str, Any]]): Evaluates linear non-adiabatic (LINA) radial pulsation periods (\(\mathrm{d}\)) and growth rates for anRSPenvelope with \((M/M_\odot, L/L_\odot, T_{\mathrm{eff}}, X, Z)\).star_eval_target_mode_frequency_and_growth((model: Any) -> tuple[dict[str, Any], bool]): Evaluates the target oscillation mode requested byx_integer_ctrl(3..4)andx_ctrl(1..2)onmodel, returning(mode_dict, matched_target).star_parse_inlist_bundle((inlist_path: str, allow_unsupported_controls: bool = False) -> dict[str, Any]): Parses a MESAinlistfile (recursively resolvingread_extra_*_inlistincludes) and returns a summary dictionary of parsed controls.star_parse_rn_stages((case_dir: str, skip_optional: bool = True) -> list[tuple[str, str, str]]): Parses an upstream MESA./rnscript incase_dirinto(stage_kind, arg1, arg2)tuples.star_run_astero_test_suite_case((case_dir: str, skip_optional: bool = True, max_steps_per_stage: int | None = None, verify_restart: bool = True, allow_unsupported_controls: bool = False, extras: Any = None) -> dict[str, Any]): Runs anastero/test_suite/<case>directory and returns a report dictionary.star_run_test_suite_case((case_dir: str, skip_optional: bool = True, max_steps_per_stage: int | None = None, verify_restart: bool = False, allow_unsupported_controls: bool = False, extras: Any = None) -> dict[str, Any]): Runs a multi-stage upstream MESAtest_suitecase directory and returns a structured telemetry dictionary.star_verify_photo_restart((model: Any, n_steps: int = 1) -> tuple[int, int]): Runs a.photorestart bit-identity check onmodelovern_steps.
star_wave5_py¶
star_add_predictive_mixing((model: RustStarModel, ingested_mass_limit_coeff: float = 0.1, superad_thresh: float = 0.005) -> int): Applies predictive mixing at convective boundaries onmodel.star_do_conv_premix((model: RustStarModel, max_iters: int = 10, avoid_fuel_increase: bool = True) -> int): Runs iterative convective premixing onmodeland returns the number of cells absorbed across convective boundaries.star_do_element_diffusion((model: RustStarModel, dt: float, scheme: str = "stanton_murillo") -> tuple[_ArrF64, _ArrF64]): Runs multi-species element diffusion across all zones ofmodeloverdtseconds, returning(v_gt_2d, eps_wd_sed_1d).star_do_phase_separation((model: RustStarModel, dt: float, gamma_crystallization: float = 175.0, is_one_mixture: bool = False) -> _ArrF64): Executes white-dwarf crystallization phase separation onmodeland returns the gravothermal heating rate array \(\epsilon_{\mathrm{phase\_sep},k}\).star_eval_burgers_velocities((a: _ArrF64, z: _ArrF64, x_mass: _ArrF64, rho: float, t: float, dlnt_dr: float, g_grav: float, g_rad: _ArrF64 | None = None, scheme: str = "stanton_murillo") -> tuple[_ArrF64, _ArrF64, float]): Solves the single-zone multi-species Burgers resistance equations and returns(v_gt, d_self, ee_force).star_eval_caplan_ocp_dstar((gamma_i: float, kappa: float) -> float): Evaluates the Caplan, Bauer & Freeman (2022) strong-coupling OCP dimensionless self-diffusion coefficient \(D^*(\Gamma, \kappa)\).star_eval_omega_crit((cgrav: float, m_grav: float, r_polar: float, lum: float, opacity: float, max_gamma_edd: float = 0.99) -> float): Evaluates local critical Roche angular velocity \(\Omega_{\mathrm{crit}}\) (\(\mathrm{rad\,s^{-1}}\)).star_eval_phase_separation_shift((x_heavy: float, is_one_mixture: bool = False) -> float): Evaluates the Blouin et al. (2020, 2021) solid-liquid distillation shift \(\Delta x_{\mathrm{heavy}}\).star_eval_radiative_levitation_accel((kappa_species: float, lum_face: float, r_face: float) -> float): Evaluates radiative levitation acceleration \(g_{\mathrm{rad},i}\) (\(\mathrm{cm\,s^{-2}}\)).star_eval_rotation_fp_ft((w_div_w_crit: float, fp_min: float = 0.75, ft_min: float = 0.95) -> tuple[float, float, float]): Evaluates Fabry et al. (2022) / Paxton et al. (2019) Roche rotational distortion polynomials \((f_P, f_T, i_{\mathrm{rot}}/r^2)\).star_eval_rotational_mixing_zone((r: float, hp: float, grav: float, rho: float, t: float, cp: float, opacity: float, chi_t: float, chi_rho: float, grada: float, gradt: float, brunt_n2_t: float, brunt_n2_mu: float, omega: float, dln_omega_dln_r: float, abar: float, zbar: float, d_visc: float = 0.0) -> tuple[float, float, float, float, float, float, float, float, float]): Evaluates all five rotational instabilities and the Spruit-Tayler dynamo at a single spherical shell face, returning(d_dsi, d_sh, d_ssi, d_es, d_gsf, d_st, nu_st, b_phi, b_r).star_eval_wd_sedimentation_heating((a: _ArrF64, z: _ArrF64, x_mass: _ArrF64, v_gt: _ArrF64, abar: float, zbar: float, g_grav: float) -> float): Evaluates white-dwarf gravitational sedimentation heating rate \(\epsilon_{\mathrm{WD,sed}}\) (\(\mathrm{erg\,g^{-1}\,s^{-1}}\)).star_set_rotation_mixing_info((model: RustStarModel) -> _ArrF64): Runsset_rotation_mixing_info(star/private/rotation_mix_info.f90) onmodel, returning a(nz, 9)array(D_DSI, D_SH, D_SSI, D_ES, D_GSF, D_ST, nu_ST, dynamo_B_phi, dynamo_B_r)with diffusivities in \(\mathrm{cm^2\,s^{-1}}\) and magnetic fields in \(\mathrm{G}\), raisingValueErroron explicit-error paths (#503).
star_wave5_2_py¶
star_build_pulse_points((model: RustStarModel, add_center_point: bool = True, add_double_points: bool = False, grad_mu_threshold: float = 1.0e99) -> _ArrF64): Builds the center-to-surface pulsation structure array(n_pts, 26)containing physical variables and Dziembowski variables \((V, V_g, A_*, U, c_1)\).star_eval_center_parabolic((r_inner: float, r_outer: float, v_inner: float, v_outer: float) -> float): Parabolically extrapolates \(v(r)\) to \(r = 0\) (pulse_utils).star_eval_hllc_face((p_l: float, rho_l: float, cs_l: float, u_l: float, dm_l: float, p_r: float, rho_r: float, cs_r: float, u_r: float, dm_r: float, r_face: float, m_grav_face: float, cgrav_face: float) -> tuple[float, float, float, float, float, float, float]): Evaluates the well-balanced Lagrangian HLLC Riemann state at an interior cell interface (hydro_riemann).star_eval_hllc_surface_face((p_surf_cell: float, rho_surf: float, cs_surf: float, u_surf: float, dm_surf: float, r_surf: float, m_surf: float, cgrav_surf: float, p_bc: float) -> tuple[float, float, float, float, float, float, float]): Evaluates the surface (\(k = 0\)) HLLC Riemann state (hydro_riemann).star_eval_riemann_momentum_residual((u_k: float, u_old_k: float, dt: float, dm_k: float, r_outer: float, r_inner: float, p_face_outer: float, p_face_inner: float, p_cell_k: float, g_cell_k: float) -> float): Evaluates the spherical Lagrangian HLLC momentum residual for cell \(k\) (hydro_momentum).star_eval_riemann_profile((model: RustStarModel, u_cell: _ArrF64, u_old_cell: _ArrF64, p_surf_bc: float = 0.0, parallel: bool = True) -> tuple[_ArrF64, _ArrF64]): Evaluates full-profile HLLC Riemann face states(nz, 7)and cell momentum residuals(nz,)across all zones ofmodel.star_eval_rsp2_face((r_face: float, m_grav_face: float, cgrav_face: float, p_face: float, rho_face: float, t_face: float, cp_face: float, grad_ad_face: float, kappa_face: float, w_inner: float, w_outer: float, t4_inner: float, t4_outer: float, lnp_inner: float, lnp_outer: float, chi_face: float, du_over_r_face: float, dm_bar: float, alfa: float = 1.5, alfac: float = 1.0, alfat: float = 0.01) -> tuple[float, float, float, float, float, float]): Evaluates face-centeredRSP2scale height, superadiabaticity, viscous stress, and radiative/convective/turbulent luminosities (hydro_rsp2).star_eval_rsp2_zone((w: float, t: float, rho: float, p: float, cp: float, grad_ad: float, delta: float, kappa: float, hp_cell: float, grad_t: float, r_outer: float, r_inner: float, u_outer: float, u_inner: float, dm: float, dlnd_dt: float = 0.0, alfa: float = 1.5, alfap: float = 1.0, alfas: float = 1.0, alfac: float = 1.0, alfad: float = 1.0, alfam: float = 0.25, alfat: float = 0.01, gammar: float = 1.0, min_w2_for_turbulence: float = 0.0, w_min_for_damping: float = 0.0) -> tuple[float, float, float, float, float, float, float]): Evaluates a cell'sRSP2turbulent pressure, eddy viscosity, viscous heating, buoyant source, dissipation sink, radiative cooling sink, and net turbulent energy rate (hydro_rsp2).star_solve_stationary_rsp2_w((t: float, rho: float, p: float, cp: float, grad_ad: float, delta: float, kappa: float, hp_cell: float, grad_t: float, alfa: float = 1.5, alfas: float = 1.0, alfad: float = 1.0, gammar: float = 1.0) -> float): Solves stationary localRSP2turbulent balance for \(w\) (rsp2_solve).star_export_cafein((model: RustStarModel, add_center_point: bool = True) -> str): ExportsmodelinCAFEINASCII format (pulse_cafein).star_export_fgong((model: RustStarModel, add_center_point: bool = True, keep_surface_point: bool = False, add_atmosphere: bool = False) -> str): ExportsmodelasFGONGtext (star_export_pulse_datainstar/private/pulse.f90).star_export_gr1d((model: RustStarModel, _add_center_point: bool = True) -> str): ExportsmodelinGR1DASCII format (pulse_gr1d).star_export_gsm((model: RustStarModel, add_center_point: bool = True) -> bytes): ExportsmodelinGYREGSMv110 format (pulse_gsm).star_export_gyre((model: RustStarModel, add_center_point: bool = True, keep_surface_point: bool = False, add_atmosphere: bool = False) -> str): ExportsmodelasGYREtext (star_export_pulse_datainstar/private/pulse.f90).star_export_osc((model: RustStarModel, add_center_point: bool = True, keep_surface_point: bool = False, add_atmosphere: bool = False) -> str): ExportsmodelasOSCtext (star_export_pulse_datainstar/private/pulse.f90).star_export_pulse_by_format((model: RustStarModel, format: str, add_center_point: bool = True) -> str): Exportsmodelin any pulsation format ("gyre","fgong","osc","gsm","saio","cafein","gr1d").star_export_saio((model: RustStarModel, add_center_point: bool = True) -> str): ExportsmodelinSAIOASCII format (pulse_saio).star_export_stella_pair((model: RustStarModel) -> tuple[str, str]): Exportsmodelas aSTELLA(hyd_str, abn_str)pair (stella_io).star_run_stella_from_hyd_abn((hyd_str: str, abn_str: str, eta_str: str, times_days: list[float]) -> tuple[list[tuple[float, float]], list[tuple[float, float, float, float]]]): RunsSTELLAradiation-hydrodynamics light-curve and SobolevFe II5169 line-velocity evaluation on.hyd,.abn, andFeII_5169_eta.datstrings.star_solve_adipls_fgong_modes((fgong_str: str, l: int, freq_min_uhz: float, freq_max_uhz: float, n_scan: int = 500) -> list[tuple[int, int, int, int, float, float, float, float]]): Solves the 4th-orderADIPLSBVP on anFGONGmodel string.star_solve_gyre_mesa_modes((mesa_str: str, l: int, omega_min: float, omega_max: float, n_scan: int = 200, _nonadiabatic: bool = True) -> list[tuple[int, int, int, int, float, float, float, float, float]]): Solves the 4th-order BVP on aGYREMESA-format model string.
Frozen JAX Engine Status (flexmesa.star.JAX_ENGINE_STATUS)¶
JAX_ENGINE_STATUS(str,"frozen-unverified-until-#143"): Marks the derived JAXstarengine twins as frozen and not an upstream parity oracle until the canonical Rust engine passes the upstream-history harness (#143,#166).