pterasoftware.analyze_unsteady_trim()¶
- pterasoftware.analyze_unsteady_trim(
- problem: UnsteadyProblem,
- /,
- *,
- boundsVCg__E: tuple[float | int, float | int],
- alpha_bounds: tuple[float | int, float | int],
- beta_bounds: tuple[float | int, float | int],
- boundsExternalFX_W: tuple[float | int, float | int],
- objective_cut_off: float | int = 0.01,
- num_calls: int = 100,
- show_solver_progress: bool | np.bool = True,
- force_method: str = 'joukowski',
Attempts to calculate a trim condition of an UnsteadyProblem by varying the base operating conditions until the net loads are sufficiently low.
Procedure:
Trim is found by minimizing an objective function that combines the net final load coefficients' magnitudes. For problems with non static movement, the final load coefficients are the mean values from the final motion cycle. For problems with static movement, they are the load coefficients at the final time step.
The optimization process varies four of the base OperatingPoint's parameters (vCg__E, alpha, beta, externalFX_W) within their specified bounds. At each iteration, an UnsteadyRingVortexLatticeMethodSolver is run to compute aerodynamic loads. These loads are combined with the external loads to compute a net load coefficient.
The function uses a two-stage optimization approach: first attempting a local search using L-BFGS-B, and if that fails to converge, it performs a global search using dual annealing.
The search terminates early if the objective function falls below the specified cutoff value. If no trim condition is found within the maximum number of function calls, the function returns None values and logs a critical error.
- Parameters:
problem -- The UnsteadyProblem whose trim condition will be found. This must be a standard UnsteadyProblem, not a FreeFlightUnsteadyProblem or an AeroelasticUnsteadyProblem, neither of which is supported. The UnsteadyProblem's Movement must contain exactly one AirplaneMovement. The problem's Movement must define its duration with num_cycles or num_chords, rather than an explicit num_steps, because delta_time is re-estimated at each trial speed and a fixed num_steps would change the simulated duration from trial to trial. If its wake is truncated, the maximum wake length must likewise be defined with max_wake_cycles or max_wake_chords, rather than an explicit max_wake_rows. The base OperatingPoint's g_E must be non-zero, since the Airplane's weight is placed along g_E's direction. Trim searches for a level flight equilibrium, so the base OperatingPoint's angles_E_to_BP1_izyx must resolve to level flight (leave it unset), and each trial resolves its own attitude to level flight at its alpha and beta. The problem's OperatingPointMovement's base OperatingPoint will be modified during the trim search.
boundsVCg__E -- A tuple of two positive numbers (ints or floats), in ascending order, determining the range of base speeds of the Airplane's CG (in the Earth frame) to search. The base OperatingPoint's initial vCg__E must be within these bounds. Values are converted to floats internally. The units are in meters per second.
alpha_bounds -- A tuple of two numbers (ints or floats), in ascending order and in the range (-180.0, 180.0], determining the range of angles of attack to search. The base OperatingPoint's initial alpha must be within these bounds. Values are converted to floats internally. The units are in degrees.
beta_bounds -- A tuple of two numbers (ints or floats), in ascending order and in the range (-90.0, 90.0), determining the range of sideslip angles to search. The bounds exclude the poles at -90.0 and 90.0 because the search varies alpha and beta independently, and OperatingPoint only accepts alpha = 0.0 there. The base OperatingPoint's initial beta must be within these bounds. Values are converted to floats internally. The units are in degrees.
boundsExternalFX_W -- A tuple of two numbers (ints or floats), in ascending order, determining the range of external forces (in the wind axes' x direction) to search. The base OperatingPoint's initial externalFX_W must be within these bounds. Values are converted to floats internally. The units are in Newtons.
objective_cut_off -- A positive number (int or float) for the trim search's convergence threshold. When the objective function falls below this value, the search terminates successfully. Lower values result in tighter trim conditions but may require more iterations. Values are converted to floats internally. The default is 0.01.
num_calls -- A positive int for the maximum number of objective function evaluations allowed during optimization. This limit applies separately to the local search and global search stages. Higher values allow for more thorough searching but increase computation time. The default is 100.
show_solver_progress -- Set this to True to show the TQDM progress bar during each run of the unsteady solver. For showing progress bars and displaying log statements, set up logging using the setup_logging function. It can be a bool or a numpy bool and will be converted internally to a bool. The default is True.
force_method -- The method each run of the unsteady solver uses for calculating aerodynamic forces. Valid options are "joukowski" which uses the Kutta Joukowski theorem on each RingVortex leg, and "katz" which uses the pressure integration method adapted from "Low Speed Aerodynamics" by Katz and Plotkin (Section 13.12, Eq. 13.150 and 13.151). The default is "joukowski".
- Returns:
A tuple of four floats representing the trimmed parameters found. In order, they are: vCg__E (in meters per second), alpha (in degrees), beta (in degrees), and externalFX_W (in Newtons). If no trim condition was found, it will instead return a tuple of four Nones.