|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | MachSolverResult |
Functions | |
| float | calculate_area_mach_ratio (float M, float gamma) |
| float | calculate_area_mach_derivative (float M, float gamma, Optional[float] A_Astar=None) |
| float | estimate_initial_mach (float eps, float gamma, bool supersonic=True) |
| MachSolverResult | solve_mach_from_area_ratio (float eps, float gamma, bool supersonic=True, float tolerance=1e-10, int max_iterations=50, Optional[float] initial_guess=None) |
| Tuple[float, bool] | solve_mach_robust (float eps, float gamma, bool supersonic=True) |
| Tuple[float, bool] | solve_exit_mach_robust (float eps, float gamma) |
| MachSolverResult | solve_exit_mach_from_area_ratio (float eps, float gamma, **kwargs) |
Mach number solver for isentropic nozzle flow.
This module provides the area-Mach relation solver used throughout the nozzle
calculations. Consolidates previously duplicated Newton-Raphson implementations.
Physics:
The area-Mach relation for isentropic flow:
A/A* = (1/M) × [(2/(γ+1)) × (1 + (γ-1)/2 × M²)]^((γ+1)/(2(γ-1)))
For a given area ratio ε = A/A* > 1, there are two solutions:
1. Subsonic solution (M < 1)
2. Supersonic solution (M > 1)
| float engine.core.mach_solver.calculate_area_mach_derivative | ( | float | M, |
| float | gamma, | ||
| Optional[float] | A_Astar = None ) |
Calculate derivative d(A/A*)/dM for Newton-Raphson solver.
Parameters
----------
M : float
Mach number
gamma : float
Specific heat ratio
A_Astar : float, optional
Pre-calculated A/A* (for efficiency)
Returns
-------
dA_dM : float
Derivative of area ratio with respect to Mach number
Definition at line 61 of file mach_solver.py.
References calculate_area_mach_ratio().
Referenced by solve_mach_from_area_ratio().
| float engine.core.mach_solver.calculate_area_mach_ratio | ( | float | M, |
| float | gamma ) |
Calculate area ratio A/A* for given Mach number and gamma.
A/A* = (1/M) × [(2/(γ+1)) × (1 + (γ-1)/2 × M²)]^((γ+1)/(2(γ-1)))
Parameters
----------
M : float
Mach number (must be > 0)
gamma : float
Specific heat ratio (must be > 1)
Returns
-------
A_Astar : float
Area ratio A/A*
Definition at line 33 of file mach_solver.py.
Referenced by calculate_area_mach_derivative(), and solve_mach_from_area_ratio().
| float engine.core.mach_solver.estimate_initial_mach | ( | float | eps, |
| float | gamma, | ||
| bool | supersonic = True ) |
Estimate initial Mach number for given area ratio.
Parameters
----------
eps : float
Area ratio A/A* (must be >= 1)
gamma : float
Specific heat ratio
supersonic : bool
Whether to estimate the supersonic solution (M > 1) or subsonic (M < 1)
Returns
-------
M_guess : float
Initial guess for Mach number
Definition at line 90 of file mach_solver.py.
References max.
Referenced by solve_mach_from_area_ratio().
| MachSolverResult engine.core.mach_solver.solve_exit_mach_from_area_ratio | ( | float | eps, |
| float | gamma, | ||
| ** | kwargs ) |
Backward compatible wrapper for supersonic exit Mach solver.
Definition at line 334 of file mach_solver.py.
References solve_mach_from_area_ratio().
| Tuple[float, bool] engine.core.mach_solver.solve_exit_mach_robust | ( | float | eps, |
| float | gamma ) |
Backward compatible wrapper for supersonic exit Mach solver.
Definition at line 324 of file mach_solver.py.
References solve_mach_robust().
| MachSolverResult engine.core.mach_solver.solve_mach_from_area_ratio | ( | float | eps, |
| float | gamma, | ||
| bool | supersonic = True, | ||
| float | tolerance = 1e-10, | ||
| int | max_iterations = 50, | ||
| Optional[float] | initial_guess = None ) |
Solve for Mach number given area ratio using Newton-Raphson.
Finds either the supersonic (M > 1) or subsonic (M < 1) solution.
Parameters
----------
eps : float
Area ratio A/A* (must be >= 1)
gamma : float
Specific heat ratio (must be > 1)
supersonic : bool
Whether to find the supersonic or subsonic solution
tolerance : float
Convergence tolerance for residual
max_iterations : int
Maximum Newton-Raphson iterations
initial_guess : float, optional
Initial guess for M (if None, uses estimate_initial_mach)
Returns
-------
result : MachSolverResult
Solver result with M, convergence info, and diagnostics
Definition at line 151 of file mach_solver.py.
References calculate_area_mach_derivative(), calculate_area_mach_ratio(), and estimate_initial_mach().
Referenced by solve_exit_mach_from_area_ratio(), and solve_mach_robust().
| Tuple[float, bool] engine.core.mach_solver.solve_mach_robust | ( | float | eps, |
| float | gamma, | ||
| bool | supersonic = True ) |
Robust wrapper for Mach solver with automatic fallback.
Parameters
----------
eps : float
Area ratio A/A*
gamma : float
Specific heat ratio
supersonic : bool
Whether to find the supersonic or subsonic solution
Returns
-------
M : float
Mach number solution
success : bool
Whether solver converged successfully
Definition at line 267 of file mach_solver.py.
References solve_mach_from_area_ratio().
Referenced by solve_exit_mach_robust().