avl_rungen

avl_rungen#

Caution

Internal module, not part of the public API. Users should call avl_sweep() instead. This page is for contributors who need to understand or modify the command generation logic.

Generate AVL run-case and command files for alpha/beta/deflection sweeps.

avl_aero_tables.avl_rungen.make_run_command(alpha, beta, ctrl_names, ctrl_sweeps, out_dir, avl_file, run_file)[source]#

Return the AVL stdin command script for a sweep.

AVL is driven entirely via stdin — geometry and run-case are loaded with LOAD and CASE commands at the top of the script, followed by OPER commands for each sweep point.

Parameters:
  • alpha (list[float]) – List of angle-of-attack values in degrees.

  • beta (list[float]) – List of sideslip angle values in degrees.

  • ctrl_names (list[str]) – Ordered list of control-surface names matching AVL’s D1, D2, … indices.

  • ctrl_sweeps (dict[str, list[float]]) – Mapping from control-surface name to its deflection sweep values. Only surfaces present in this dict are swept; others stay at zero. An empty dict produces one run per (alpha, beta) point.

  • out_dir (Path) – Directory where .st output files will be written. May be an absolute or relative path — keep it short; AVL has an ~80-char filename limit.

  • avl_file (str | Path) – Path to the .avl geometry file passed to the LOAD command.

  • run_file (str | Path) – Path to the reset .run file passed to the CASE command.

Return type:

str

Example

>>> from pathlib import Path
>>> from avl_aero_tables.avl_rungen import make_run_command
>>> cmd = make_run_command(
...     alpha=[0.0, 5.0],
...     beta=[0.0],
...     ctrl_names=["flap", "aileron", "elevator", "rudder"],
...     ctrl_sweeps={},
...     out_dir=Path("/tmp/avl_out"),
...     avl_file="bd.avl",
...     run_file="/tmp/avl_x/reset.run",
... )
>>> cmd.splitlines()[0]
'LOAD bd.avl'
>>> cmd.count("A A")  # one alpha line per case
2
avl_aero_tables.avl_rungen.make_run_reset(avl_name, ctrl_names, *, Mach=0.0, CDoref=0.0, Xref=0.0, Yref=0.0, Zref=0.0, Lunit='Lunit', Munit='Munit', Tunit='Tunit')[source]#

Return the content of a reset run-case file (all states zeroed).

The reset run case is loaded into AVL before each sweep point to ensure a clean starting state. ctrl_names is the ordered list of control surface names (e.g. [“flap”, “aileron”, “elevator”, “rudder”]).

Example

>>> from avl_aero_tables.avl_rungen import make_run_reset
>>> text = make_run_reset(
...     "bd",
...     ["flap", "aileron", "elevator", "rudder"],
...     CDoref=0.017,
...     Xref=3.4,
...     Zref=0.5,
... )
>>> "Run case  1:  Reset bd" in text
True
>>> " CDo       =   0.01700" in text
True
Parameters:
  • avl_name (str)

  • ctrl_names (list[str])

  • Mach (float)

  • CDoref (float)

  • Xref (float)

  • Yref (float)

  • Zref (float)

  • Lunit (str)

  • Munit (str)

  • Tunit (str)

Return type:

str