cape.cfdx.cmd: Creating system commands

This module creates system commands as lists of strings for binaries or scripts that require multiple command-line options. It is closely tied to cape.bin.

Commands are created in the form of a list of strings. This is the format used in subprocess commands (with shell=``False``) and also cape.bin.calli(), etc. As a very simple example, the system command "ls -lh" becomes the list ["ls", "-lh"].

Inputs to the functions in this module take one of two forms:

  • A cape.options.Options object or subset thereof

  • Keyword arguments

The first method allows any appropriate Options interface and then extracts the appropriate portion. For instance verify() can be given either a top-level options object, a "RunControl" options interface (e.g. from cape.options.runControl), or a dict of options specific to verify. It does this using the following Python commands:

opts = opts.get("RunControl", opts)
opts = opts.get("verify", opts)

Other functions, such as aflr3(), rely on the built-in methods of the cape.options.Options class. For example, opts.get_aflr3_i(j) returns the aflr3 input file name for phase j if opts is in any of the following classes:

Class

Description

cape.options.Options

All Cape settings

cape.options.runControl.RunControl

All run settings

cape.options.aflr3.aflr3

AFLR3 settings

cape.cfdx.cmd.aflr3(opts=None, j=0, **kw)

Create AFLR3 system command as a list of strings

Call:
>>> cmdi = aflr3(opts=None, j=0, **kw)
Inputs:
opts: cape.options.Options

Options interface, either global, “RunControl”, or “aflr3”

j: int | None

Phase number

blc: bool

Whether or not to generate prism layers

blr: float

Boundary layer stretching option

blds: float

Initial surface stretching

cdfr: float

Maximum geometric stretching

cdfs: {None} | 0 <= float <=10

Distribution function exclusion zone

angblisimx: float

Max BL intersection angle

Outputs:
cmdi: list (str)

System command created as list of strings

Versions:
  • 2016-04-04 @ddalle: Version 1.0

cape.cfdx.cmd.intersect(opts=None, j=0, **kw)

Interface to Cart3D binary intersect

Call:
>>> cmd = cape.cmd.intesect(opts=None, **kw)
Inputs:
opts: cape.options.Options

Options interface

i: str

Name of input tri file

o: str

Name of output tri file

Outputs:
cmd: list (str)

Command split into a list of strings

Versions:
  • 2015-02-13 @ddalle: Version 1.0

cape.cfdx.cmd.tecmcr(mcr='export-lay.mcr', **kw)

Run a Tecplot macro

Call:
>>> cmd = tecmcr(mcr="export-lay.mcr")
Inputs:
mcr: str

File name of Tecplot macro

Outputs:
cmd: list (str)

Command split into a list of strings

Versions:
  • 2015-03-10 @ddalle: Version 1.0

cape.cfdx.cmd.verify(opts=None, **kw)

Generate command for Cart3D executable verify

Call:
>>> cmdi = cape.cmd.verify(opts=None, **kw)
Inputs:
opts: cape.options.Options

Options interface

i: {"Components.i.tri" | str

Name of tri file to test

ascii: {True} | False

Flag to consider input file ASCII

binary: True | {False}

Flag to consider input file binary

Outputs:
cmdi: list (str)

Command split into a list of strings

Versions:
  • 2015-02-13 @ddalle: Version 1.0