avl_sweep

Contents

avl_sweep#

Top-level orchestrator. Calls avl_fileread, avl_rungen, avl_bin, and st_fileread in sequence. Exposed publicly as avl_sweep() via avl_aero_tables.__init__.

Orchestrate AVL geometry reading, sweep execution, and .st output parsing.

avl_aero_tables.avl_sweep.run(avl_file, alpha, beta, ctrl_sweeps=None, out_dir=None, binary=None, out_format='csv', yml_file=None)[source]#

Run AVL stability analysis for a sweep of alpha, beta, and deflections.

Parameters:
  • avl_file (str | Path) – Path to the .avl geometry file.

  • alpha (list[float]) – Angle-of-attack sweep values in degrees.

  • beta (list[float]) – Sideslip angle sweep values in degrees.

  • ctrl_sweeps (dict[str, list[float]] | None) – Mapping of control-surface name → deflection sweep values. An empty dict (default) produces one run per (alpha, beta) point.

  • out_dir (Path | str | None) – Required. Base directory under which the timestamped run directory is created: out_dir / "{avl_stem}_{YYYY-MM-DD-HHMMSS}". Created automatically (including parents) if it does not exist. Raises TypeError if omitted.

  • binary (Path | None) – Path to the AVL binary. Auto-detected if not provided.

  • out_format (Literal['csv', 'json', 'df']) – Export format for results saved alongside the .st files. One of "csv" (default), "json", or "df" (DataFrame in memory only — no file written). The file is written to out_dir/results.<ext>.

  • yml_file (Path | str | None) – Path to the .yml project file (CLI use only). When provided, provenance.json records entry: "cli" and copies the .yml into .in/<avl_stem>/.

Returns:

One StResult per .st output file produced.

Return type:

list[StResult]

Example

>>> import tempfile, pathlib
>>> from avl_aero_tables import avl_sweep
>>> with tempfile.TemporaryDirectory() as tmp:
...     results = avl_sweep(
...         "examples/bd/bd.avl",
...         alpha=[-5, 0, 5, 10],
...         beta=[0],
...         ctrl_sweeps={"elevator": [-10, 0, 10]},
...         out_dir=tmp,
...     )
>>> len(results)  # 4 alpha × 3 elevator deflections
12
>>> results[0].data["Alpha"]
-5.0