cape.pylavacntl: LAVA control module

This module provides tools to quickly setup basic or complex LAVA run matrices and serve as an executive for pre-processing, running, post-processing, and managing the solutions. A collection of cases combined into a run matrix can be loaded using the following commands.

>>> import cape.pylava
>>> cntl = cape.pylava.cntl.Cntl("pyLava.json")
>>> cntl
<cape.pylava.Cntl(nCase=907)>
>>> cntl.x.GetFullFolderNames(0)
'poweroff/m1.5a0.0b0.0'

An instance of this cape.pylava.cntl.Cntl class has many attributes, which include the run matrix (cntl.x), the options interface (cntl.opts), and optionally the data book (cntl.DataBook), the appropriate input files (such as cntl.Namelist), and possibly others.

Attribute

Class

cntl.x

cape.runmatrix.RunMatrix

cntl.opts

cape.pylava.options.Options

cntl.Namelist

cape.pylava.namelist.Namelist

Finally, the Cntl class is subclassed from the cape.cntl.Cntl class, so any methods available to the CAPE class are also available here.

class cape.pylava.cntl.Cntl(fname=None)

Class for handling global options and setup for LAVA

This class is intended to handle all settings used to describe a group of LAVA cases. For situations where it is not sufficiently customized, it can be used partially, e.g., to set up a Mach/alpha sweep for each single control variable setting.

The settings are read from a yaml or json file.

Call:
>>> cntl = cape.pylava.Cntl(fname="pyLava.yaml")
Inputs:
fname: str

Name of cape.pylava input file

Outputs:
cntl: cape.pylava.cntl.Cntl

Instance of the cape.pylava control class

Data members:
cntl.opts: dict

Dictionary of options for this case (directly from fname)

cntl.x: cape.pylava.runmatrix.RunMatrix

Values and definitions for variables in the run matrix

cntl.RootDir: str

Absolute path to the root directory

Versions:
  • 2024-04-25 @sneuhoff: v1.0

ApplyCase(i: int, nPhase=None, **kw)

Apply settings from cntl.opts to an individual case

This rewrites each run namelist file and the case.json file in the specified directories.

Call:
>>> cntl.ApplyCase(i, nPhase=None)
Inputs:
cntl: cape.pyfun.cntl.Cntl

FUN3D control interface

i: int

Case number

nPhase: {None} | positive int

Last phase number (default determined by PhaseSequence)

Versions:
  • 2016-03-31 @ddalle: v1.0

GetConfigBody(comp: str, warn: bool = False) → list

Convert face name to list of MapBC indices

Determine which component indices are in a named component based on the MapBC file, which is always numbered 1,2,…,N. Output the format as a nice string, such as "4-10,13,15-18".

If possible, this is read from the "Inputs" subsection of the "Config" section of the master JSON file. Otherwise, it is read from the "mapbc" and configuration files.

Call:
>>> cids = cntl.GetConfigInput(comp, warn=False)
Inputs:
cntl: cape.pyfun.cntl.Cntl

CAPE main control instance

comp: str

Name of component to process

warn: True | {False}

Whether or not to print warnings if not raising errors

Outputs:
cids: list[str]

List of MapBC inds (1-based) in comp

Versions:
  • 2025-05-16 @ddalle: v1.0 (from GetConfigInput())

GetConfigInput(comp: str, warn: bool = False)

Convert face name to list of MapBC indices

Determine which component indices are in a named component based on the MapBC file, which is always numbered 1,2,…,N. Output the format as a nice string, such as "4-10,13,15-18".

If possible, this is read from the "Inputs" subsection of the "Config" section of the master JSON file. Otherwise, it is read from the "mapbc" and configuration files.

Call:
>>> cntl.GetConfigInput(comp, warn=False)
Inputs:
cntl: cape.pyfun.cntl.Cntl

CAPE main control instance

comp: str

Name of component to process

warn: True | {False}

Whether or not to print warnings if not raising errors

Outputs:
inp: str

String describing list of integers included

Versions:
  • 2026-05-01 @ddalle: v1.0

PrepareCase(i: int)

Prepare case for running if necessary

Call:
>>> cntl.PrepareCase(i)
Inputs:
cntl: cape.pylava.cntl.Cntl

Instance of control class containing relevant parameters

i: int

Index of case to analyze

Versions:
  • 2024-06-12 @sneuhoff: v1.0

PrepareInputFile(i: int)

Prepare main input file, depends on LAVA solver is in use

Call:
>>> cntl.PrepareInputFile(i)
Inputs:
cntl: Cntl

CAPE run matrix control instance

i: int

Case index

Versions:
  • 2025-07-15 @ddalle: v1.0

PrepareMesh(i: int)

Copy/link mesh files into case folder

Call:
>>> cntl.PrepareMesh(i)
Inputs:
cntl: Cntl

CAPE run matrix controller instance

i: int

Case index

Versions:
  • 2024-10-10 @ddalle: v1.0

  • 2025-07-15 @ddalle: v2.0; map LAVASolver value

PrepareMeshCurvilinear(i: int)

Copy/link mesh files into case folder

Call:
>>> cntl.PrepareMeshCurvilinear(i)
Inputs:
cntl: Cntl

CAPE run matrix controller instance

i: int

Case index

Versions:
  • 2024-10-10 @ddalle: v1.0

PrepareRunInputs(i: int)

Prepare the run.inputs file for each phase of one case

Call:
>>> cntl.PrepareRunYAML(i)
Inputs:
cntl: Cntl

CAPE run matrix control instance

i: int

Case index

Versions:
  • 2024-10-10 @ddalle: v1.0

PrepareRunInputsConfig()

Write the lines for force/moment output in run.inputs

This uses the "Components" option within the "Config" section of the master JSON/YAML file to define load groups for the LAVA-Cartesian output.loads section.

By default, any existing group_N entries from the template run.inputs file are deleted. This prevents LAVA from reporting loads for stale template groups since it reads group_1, group_2, … until a number is not found. To append the "Components" to template groups instead, set the "KeepTemplateComponents" option in "Config" to True.

Call:
>>> cntl.PrepareRunInputsConfig()
Inputs:
cntl: cape.pylava.cntl.Cntl

CAPE main control instance

Versions:
  • 2026-09-02 @ddalle: v1.0

  • 2026-09-02 @ddalle: v1.1; KeepTemplateComponents

PrepareRunInputsFlightConditions(i: int)

Prep the reference conditions section of LAVA-cart file

Call:
>>> cntl.PrepareRunInputsFlightConditions(i)
Inputs:
cntl: Cntl

CAPE run matrix control instance

i: int

Case index

Versions:
  • 2025-07-15 @ddalle: v1.0

PrepareRunYAML(i: int)

Prepare the run YAML file for each phase of one case

Call:
>>> cntl.PrepareRunYAML(i)
Inputs:
cntl: Cntl

CAPE run matrix control instance

i: int

Case index

Versions:
  • 2024-10-10 @ddalle: v1.0

PrepareRunYAMLFlightConditions(i: int)

Prepare the flight conditions variables in a LAVA YAML file

Call:
>>> cntl.PrepareRunYAMLFlightConditions(i)
Inputs:
cntl: Cntl

CAPE run matrix control instance

i: int

Case index

Versions:
  • 2024-10-10 @ddalle: v1.0

ReadCartInputFile()

Read LAVA-Cartesian input file, run.inputs

Call:
>>> cntl.ReadCartInputFile()
Inputs:
cntl: Cntl

CAPE run matrix control instance

Version:
  • 2025-07-14 @ddalle: v1.0

ReadRunYAML()

Read run YAML file, using template if setting is empty

Call:
>>> cntl.ReadRunYAML()
Inputs:
cntl: Cntl

CAPE run matrix control instance

Versions:
  • 2024-08-19 @sneuhoff: v1.0 (ReadInputFile())

  • 2024-10-09 @ddalle: v2.0

init_post()

Do __init__() actions specific to pylava

Call:
>>> cntl.init_post()
Inputs:
cntl: Cntl

CAPE run matrix control instance

Versions:
  • 2024-10-09 @ddalle: v1.0