cape.runmatrix: Run matrix interface

This module provides a class cape.runmatrix.RunMatrix for interacting with a list of cases. Usually this is the list of cases defined as the run matrix for a set of CFD solutions, and it is defined in the "RunMatrix" section of the JSON file.

However, the contents of the cape.runmatrix.RunMatrix may have a list of cases that differs from the run matrix, for example containing instead the cases contained in a data book.

The key defining parameter of a run matrix is the list of independent variables, which are referred to as “trajectory keys” within Cape. For example, a common list of trajectory keys for an inviscid setup is ["mach", "alpha", "beta"]. If the run matrix is loaded as x, then the value of the Mach number for case number i would be x.mach[i]. If the name of the key to query is held within a variable k, use the following syntax to get the value.

# Name of trajectory key
k = "alpha"
# Case number
i = 10
# Value of that key for case *i*
x[k][i]

Each case has a particular folder name. To get the name of the folder for case i, use the syntax

# Group folder name
x.GetGroupFolderNames(i)
# Case folder name
x.GetFolderNames(i)
# Combined group and case folder name
x.GetFullFolderNames(i)

The trajectory class also contains several methods for filtering cases. For example, the user may get the list of indices of cases with a Mach number greater than 1.0, or the user may restrict to cases containing the text "a1.0". These use the methods cape.runmatrix.RunMatrix.Filter() and cape.runmatrix.RunMatrix.FilterString(), respectively. Filtering examples are shown below.

# Constraints
I = x.Filter(cons=['mach>=0.5', 'mach<1.0'])
# Contains exact text
I = x.FilterString('m0.9')
# Contains text with wildcards (like file globs)
I = x.FilterWildcard('m?.?a-*')
# Contains a regular expression
I = x.FilterRegex('m0\.[5-8]+a')

These methods are all combined in the cape.runmatrix.RunMatrix.GetIndices() method. The cape.runmatrix.RunMatrix.GetSweeps() method provides a capability to split a run matrix into groups in which the cases in each group satisfy user-specified constraints, for example having the same angle of attack.

Also provided are methods such as cape.runmatrix.RunMatrix.GetAlpha(), which allows the user to easily access the angle of attack for case i even if the run matrix is defined using total angle of attack and roll angle. Similarly, cape.runmatrix.RunMatrix.GetReynoldsNumber() returns the Reynolds number per grid unit even if the run matrix uses static or dynamic pressure, which relieves the user from having to do the conversions before creating the run matrix conditions.

class cape.runmatrix.RunMatrix(**kwargs)

Read a list of configuration variables

Call:
>>> x = cape.RunMatrix(**traj)
>>> x = cape.RunMatrix(File=fname, Keys=keys)
Inputs:
traj: dict

Dictionary of options from opts["RunMatrix"]

Keyword arguments:
File: str

Name of file to read, defaults to 'RunMatrix.dat'

Keys: list of str items

List of variable names, defaults to ['Mach','alpha','beta']

Prefix: str

Prefix to be used for each case folder name

GroupPrefix: str

Prefix to be used for each grid folder name

GroupMesh: bool

Whether or not cases in same group can share volume grids

Definitions: dict

Dictionary of definitions for each key

Outputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

Data members:
x.nCase: int

Number of cases in the trajectory

x.prefix: str

Prefix to be used in folder names for each case in trajectory

x.GroupPrefix: str

Prefix to be used for each grid folder name

x.cols: list, dtype=str

List of variable names used

x.text: dict, dtype=list

Lists of variable values taken from trajectory file

x[key]: numpy.ndarray, dtype=float

Vector of values of each variable specified in keys

Versions:

2014-05-28 @ddalle: Version 1.0 2014-06-05 @ddalle: Generalized for user-defined keys

Copy()

Return a copy of the trajectory

Call:
>>> y = x.Copy()
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

Outputs:
y: cape.runmatrix.RunMatrix

Separate trajectory with same data

Versions:
  • 2015-05-22 @ddalle

ExpandIndices(itxt)

Expand string of subscripts into a list of indices

Call:
>>> I = x.ExpandIndices(itxt)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

itxt: str or unicode

Text of subscripts, separated by ‘;’

Outputs:
I: list[int]

Array of indices matching any of the input indices

Examples:
>>> x.ExpandIndices(':5')
[0, 1, 2, 3, 4]
>>> x.ExpandIndices(':4;7,8')
[0, 1, 2, 3, 7, 8]
Versions:
  • 2015-03-10 @ddalle: Version 1.0

  • 2018-10-19 @ddalle: Multi ranges, 1:4,5,6:10

Filter(cons, I=None)

Filter cases according to a set of constraints

The constraints are specified as a list of strings that contain inequalities of variables that are in x.cols.

For example, if m is the name of a key (presumably meaning Mach number), and a is a variable presumably representing angle of attack, the following example finds the indices of all cases with Mach number greater than 1.5 and angle of attack equal to 2.0.

>>> i = x.Filter(['m>1.5', 'a==2.0'])

A warning will be produces if one of the constraints does not correspond to a trajectory variable or cannot be evaluated for any other reason.

Call:
>>> i = x.Filter(cons)
>>> i = x.Fitler(cons, I)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

cons: list[str]

List of constraints

I: list[int]

List of initial indices to consider

Outputs:
i: np.ndarray[int]

List of indices that match constraints

Versions:
  • 2014-12-09 @ddalle: Version 1.0

  • 2019-12-09 @ddalle: Version 2.0
    • Discontinue attributes, i.e. x.mach

    • Use re to process constraints

FilterRegex(txt, I=None)

Filter cases by a regular expression

Call:
>>> i = x.FilterRegex(txt)
>>> i = x.FilterRegex(txt, I)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

txt: str

Wildcard to use as filter

I: list[int]

List of initial indices to consider

Outputs:
i: np.ndarray[int]

List of indices that match constraints

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

FilterString(txt, I=None)

Filter cases by whether or not they contain a substring

Call:
>>> i = x.FilterString(txt)
>>> i = x.FilterString(txt, I)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

txt: str

Substring to use as filter

I: list[int]

List of initial indices to consider

Outputs:
i: np.ndarray[int]

List of indices that match constraints

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

FilterWildcard(txt, I=None)

Filter cases by whether or not they contain a substring

This function uses file wild cards, so for example x.FilterWildcard('*m?.0*') matches any case whose name contains m1.0 or m2.0, etc. To make sure the ? is a number, use *m[0-9].0. To obtain a filter that matches both m10.0 and m1.0, see FilterRegex().

Call:
>>> i = x.FilterWildcard(txt)
>>> i = x.FilterWildcard(txt, I)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

txt: str

Wildcard to use as filter

I: list[int]

List of initial indices to consider

Outputs:
i: numpy.ndarray[int]

List of indices that match constraints

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

FindMatch(y, i, keys=None, **kw)

Find first case (if any) matching another trajectory case

Call:
>>> j = x.FindMatch(y, i, keys=None)
Inputs:
x: attdb.runmatrix.RunMatrix

Run matrix conditions interface

y: attdb.runmatrix.RunMatrix

Target run matrix conditions interface

i: int

Case number of case in y

keys: {None} | list[str]

List of keys to test for equivalence

tol: {1e-8} | float >= 0

Tolerance for two values to be ideintal

machtol: {tol} | float >= 0

Tolerance for mach key, for instance

Outputs:
j: None | int

Index of first matching case, if any

Versions:
  • 2017-07-21 @ddalle: Version 1.0

FindMatches(y, i, keys=None, **kw)

Find indices of cases matching another trajectory case

Call:
>>> I = x.FindMatches(y, i, keys=None)
Inputs:
x: attdb.runmatrix.RunMatrix

Run matrix conditions interface

y: attdb.runmatrix.RunMatrix

Target run matrix conditions interface

i: int

Case number of case in y

keys: {None} | list[str]

List of keys to test for equivalence

tol: {1e-8} | float >= 0

Tolerance for two values to be ideintal

machtol: {tol} | float >= 0

Tolerance for mach key, for instance

Outputs:
I: np.ndarray (int)

List of indices matching all constraints

Versions:
  • 2017-07-21 @ddalle: Version 1.0

GetAlpha(i=None)

Get the angle of attack

Call:
>>> alpha = x.GetAlpha(i=None)
Inputs:
x: :class;`cape.runmatrix.RunMatrix`

Run matrix interface

i: {None} | int

Case number (return all if None)

Outputs:
alpha: float | np.ndarray

Angle of attack in degrees

Versions:
  • 2016-03-24 @ddalle: Version 1.0

GetAlphaManeuver(i=None)

Get the signed total angle of attack

Call:
>>> am = x.GetAlphaManeuver(i)
Inputs:
x: :class;`cape.runmatrix.RunMatrix`

Run matrix interface

i: {None} | int

Case number (return all if None)

Outputs:
am: float

Signed maneuver angle of attack [deg]

Versions:
  • 2017-06-27 @ddalle: Version 1.0

GetAlphaTotal(i=None)

Get the total angle of attack

Call:
>>> av = x.GetAlphaTotal(i)
Inputs:
x: :class;`cape.runmatrix.RunMatrix`

Run matrix interface

i: {None} | int

Case number (return all if None)

Outputs:
av: float

Total angle of attack in degrees

Versions:
  • 2016-03-24 @ddalle: Version 1.0

  • 2017-06-25 @ddalle: Added default i = None

GetBeta(i=None)

Get the sideslip angle

Call:
>>> beta = x.GetBeta(i)
Inputs:
x: :class;`cape.runmatrix.RunMatrix`

Run matrix interface

i: {None} | int

Case number (return all if None)

Outputs:
beta: float

Angle of sideslip in degrees

Versions:
  • 2016-03-24 @ddalle: Version 1.0

  • 2017-06-25 @ddalle: Version 1.1; default i=None

GetCoSweep(x0, i0, **kw)

Return a list of indices meeting sweep constraints

The sweep uses point i0 of co-trajectory x0 as the reference for the constraints.

For example, using EqCons=['mach'] will cause the method to return points with x.mach matching x0.mach[i0].

Call:
>>> I = x.GetSweep(x0, i0, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

x0: cape.runmatrix.RunMatrix

Another instance of the pyCart trajectory class

i0: int

Index of reference point in x0 for constraints

SortVar: str

Variable by which to sort each sweep

EqCons: list[str]

List of trajectory keys which must match (exactly) the first point in the sweep

TolCons: dict[float]

Dictionary whose keys are trajectory keys which must match the first point in the sweep to a specified tolerance and whose values are the specified tolerances

IndexTol: int

If specified, only trajectory points in the range [i0,i0+IndexTol] are considered for the sweep

I: np.ndarray[int]

List of x indices to consider in the sweep

Outputs:
I: np.ndarray[int]

List of x indices in the sweep

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

GetDensity(i=None, units=None)

Get freestream density

Call:
>>> rho = x.GetDensity(i)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | "mks" | "F" | "R"

Output units

Outputs:
r: float

freestream density [ ]

Versions:
  • 2018-04-13 @jmeeroff: Version 1.0

GetDynamicPressure(i=None, units=None)

Get dynamic freestream pressure (in psf or Pa)

Call:
>>> q = x.GetDynamicPressure(i=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int | list

Case number(s)

units: {None} | "mks" | str

Output units

Outputs:
q: float

Dynamic pressure [ psf | Pa | units ]

Versions:
  • 2016-03-24 @ddalle: Version 1.0

  • 2017-07-20 @ddalle: Added default cases

  • 2018-04-17 @ddalle: Units

GetFirstKeyByType(KeyType)

Get all keys by type

Call:
>>> key = x.GetFirstKeyByType(KeyType)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of pyCart trajectory class

KeyType: str

Key type to search for

Outputs:
key: str | None

First key such that x.defns[key]['Type'] matches KeyType

Versions:
  • 2018-04-13 @ddalle: Version 1.0

GetFolderNames(i=None, prefix=None)

Get case folder name(s) for one or more cases

The folder names will be of the form

F_m2.0a0.0b-0.5/

if the prefix is 'F', or

m2.0a0.0b-0.5/

if the prefix is empty.

Run matrix keys that require separate meshes for each value of the key will not be part of the folder name. The number of digits used will match the number of digits in the run matrix file.

Call:
>>> dname = x.GetFolderNames()
>>> dname = x.GetFolderNames(i=None, prefix="F")
Inputs:
T: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

i: int or list

Index of cases to process or list of cases. If this is None, all cases will be processed.

prefix: str

Header for name of each folder

Outputs:
dname: str or list

Folder name or list of folder names

Versions:
  • 2014-05-28 @ddalle: Version 1.0

  • 2014-06-05 @ddalle: Version 1.1; case folder only

GetFullFolderNames(i=None, prefix=None)

Get full folder names for one or more cases

The folder names will be of the form

Grid/F_m2.0a0.0b-0.5/

if there are no trajectory keys that require separate grids or

Grid_d1.0/F_m2.0a0.0b-0.5/

if there is a key called "delta" with abbreviation 'd' that requires a separate mesh each time the value of that key changes. All keys in the trajectory file are included in the folder name at one of the two levels. The number of digits used will match the number of digits in the trajectory file.

Call:
>>> dname = x.GetFullFolderNames()
>>> dname = x.GetFullFolderNames(i=None, prefix="F")
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

i: int or list

Index of cases to process or list of cases. If this is None, all cases will be processed.

prefix: str

Header for name of each case folder

Outputs:
dname: str or list

Folder name or list of folder names

Versions:
  • 2014-06-05 @ddalle: Version 1.0

GetGamma(i=None)

Get freestream ratio of specific heats

Call:
>>> gam = x.GetGamma(i)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

Outputs:
gam: float

Ratio of specific heats

Versions:
  • 2016-03-29 @ddalle: Version 1.0

  • 2017-07-20 @ddalle: Added default cases

GetGasProperty(k, vdef=None)

Get property from the "Freestream" section

Call:
>>> v = x.GetGasProperty(k, vdef=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

k: str

Name of parameter

vdef: {None} | any

Default value for the parameter

Outputs:
v: float | str | any

Value of the

Versions:
  • 2016-03-24 @ddalle: Version 1.0

GetGroupFolderNames(i=None)

Get names of folders that require separate meshes

Call:
>>> x.GetGroupFolderNames()
>>> x.GetGroupFolderNames(i)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

i: int or list

Index of cases to process or list of cases. If this is None, all cases will be processed.

Outputs:
dname: str or list

Folder name or list of folder names

Versions:
  • 2014-06-05 @ddalle: Version 1.0

GetGroupIndex(i)

Get group index from case index

Call:

k = x.GetGroupIndex(i)

Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

i: int

Index of case

Outputs:
j: int

Index of group that contains case i

Versions:
  • 2014-09-27 @ddalle: First versoin

GetIndices(**kw)

Get indices from either list or constraints or both

Call:
>>> I = x.GetIndices(I=None, cons=[], **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

I: list | str

Array of indices or text of indices

cons: list[str] | str

List of constraints or text list using commas

re: str

Regular expression to test against folder names

filter: str

Exact test to test against folder names

glob: str

Wild card to test against folder names

Outputs:
I: np.ndarray[int]

Array of indices

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

  • 2016-02-17 @ddalle: Version 2.0; handle text

GetKeyName(typ, key=None)

Get name of key by specified type; defaulting to first key with type

A ValueError exception is raised if input key has incorrect type or if no keys have that type.

Call:
>>> k = x.GetKeyName(typ, key=None)
Inputs:
typ: str

Name of key type, for instance ‘alpha_t’

key: {None} | str

Name of trajectory key

Outputs:
k: str

Key meeting those requirements

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetKeyValue(k, i=None, units=None, udef='1')

Get the value of one key with appropriate dimensionalization

Call:
>>> v = x.GetKeyValue(k, i=None, units=None, udef="1")
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

k: str

Name of run matrix variable (trajectory key)

i: {None} | int

Case number (return all if None)

units: {None} | "mks" | str

Output units

Outputs:
v: float

Value of key k for case i in units of units

Versions:
  • 2018-04-13 @ddalle: Version 1.0

GetKeysByType(KeyType)

Get all keys by type

Call:
>>> keys = x.GetKeysByType(KeyType)
>>> keys = x.GetKeysByType(KeyTypes)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of pyCart trajectory class

KeyType: str

Key type to search for

KeyTypes: list[str]

List of key types to search for

Outputs:
keys: numpy.ndarray (str)

List of keys such that x[key]['Type'] matches KeyType

Versions:
  • 2014-10-07 @ddalle: Version 1.0

GetKeysByValue(val)

Get all keys with specified type of value

Call:
>>> keys = x.GetKeysByValue(val)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of pyCart trajectory class

val: str

Key value class to search for

Outputs:
keys: numpy.ndarray (str)

List of keys such that x[key]['Value'] matches val

Versions:
  • 2014-10-07 @ddalle: Version 1.0

GetMach(i=None)

Get Mach number

Call:
>>> M = x.GetMach(i)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case number

Outputs:
M: float

Mach number

Versions:
  • 2016-03-24 @ddalle: Version 1.0

GetMolecularWeight(i=None, units=None)

Get averaged freestream gas molecular weight

Call:
>>> W = x.GetMolecularWeight(i=None, units=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | str

Requested units of output

Outputs:
W: float

Molecular weight [kg/kmol | units ]

Versions:
  • 2018-04-13 @ddalle: Version 1.0

GetNormalizedGasConstant(i=None, units=None)

Get averaged freestream gas molecular weight

Call:
>>> R = x.GetNormalizedGasConstant(i=None, units=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | str

Requested units of output

Outputs:
R: float

Normalized gas constant [J/kg*K | units ]

Versions:
  • 2018-04-13 @ddalle: Version 1.0

GetPBSName(i, pre=None)

Get PBS name for a given case

Call:
>>> lbl = x.GetPBSName(i, pre=None)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

i: int

Run index

pre: {None} | str

Prefix to be added to a PBS job name

Outputs:
lbl: str

Short name for the PBS job, visible via qstat

Versions:
  • 2014-09-30 @ddalle: Version 1.0

  • 2016-12-20 @ddalle: Moved to x and added prefix

GetPhi(i=None)

Get the velocity roll angle

Call:
>>> phiv = x.GetPhi(i)
Inputs:
x: :class;`cape.runmatrix.RunMatrix`

Run matrix interface

i: {None} | int

Case number (return all if None)

Outputs:
phiv: float

Velocity roll angle in degrees

Versions:
  • 2016-03-24 @ddalle: Version 1.0

  • 2017-06-25 @ddalle: Added default i = None

GetPhiManeuver(i=None)

Get the signed maneuver roll angle

Call:
>>> phim = x.GetPhiManeuver(i)
Inputs:
x: :class;`cape.runmatrix.RunMatrix`

Run matrix interface

i: {None} | int

Case number (return all if None)

Outputs:
phim: float

Signed maneuver roll angle [deg]

Versions:
  • 2017-06-27 @ddalle: Version 1.0

  • 2017-07-20 @ddalle: Added default i = None

GetPressure(i=None, units=None)

Get static freestream pressure (in psf or Pa)

Call:
>>> p = x.GetPressure(i)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | psf" | str

Output units

Outputs:
p: float

Static pressure [ psf | Pa | units ]

Versions:
  • 2016-03-24 @ddalle: Version 1.0

  • 2017-07-20 @ddalle: Added default cases

  • 2018-04-17 @ddalle: Units

GetReynoldsNumber(i=None, units=None)

Get Reynolds number (per foot)

Call:
>>> Re = x.GetReynoldsNumber(i=None, units=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int | list

Case number(s)

units: {None} | str | unicode

Requested units for output

Outputs:
Re: float

Reynolds number [1/inch | 1/ft]

Versions:
  • 2016-03-23 @ddalle: Version 1.0

  • 2017-07-19 @ddalle: Added default conditions

GetSurfBC_BCIndex(i, key=None, comp=None, **kw)

Get namelist/column/etc. index for a surface BC key

Call:
>>> inds = x.GetSurfBC_BCIndex(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
inds: list | str | dict

Column index for each grid or component

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfBC_CompID(i, key=None, comp=None, **kw)

Get component ID input for surface BC key

Call:
>>> compID = x.GetSurfBC_CompID(i, key=None, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
compID: list | str | dict

Surface boundary condition component ID(s)

Versions:
  • 2016-03-28 @ddalle: Version 1.0

GetSurfBC_Gamma(i, key=None, comp=None, **kw)

Get ratio of specific heats for surface BC key

Call:
>>> gam = x.GetSurfBC_Gamma(i, key=None, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
gam: float

Surface boundary condition ratio of specific heats

Versions:
  • 2016-03-29 @ddalle: Version 1.0

  • 2016-08-29 @ddalle: Added comp

GetSurfBC_Grids(i, key=None, comp=None, **kw)

Get list of grids for surface BC key

Call:
>>> grids = x.GetSurfBC_Grids(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
grids: list (int | str)

Surface boundary condition grids

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfBC_Mach(i, key=None, comp=None, **kw)

Get Mach number input for surface BC key

Call:
>>> M = x.GetSurfBC_Mach(i, key=None, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
M: float

Surface boundary condition Mach number

Versions:
  • 2016-03-28 @ddalle: Version 1.0

GetSurfBC_Param(i, key, k, comp=None, vdef=None, **kw)

Process a single parameter of a SurfBC key

Call:
>>> v = x.GetSurfBC_Param(i, key, k, comp=None, vdef=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: str

Name of trajectory key to use

k: str

Name of input parameter to find

comp: None | str

If v is a dict, use v[comp] if comp is nontrivial

vdef: None | any

Default value for v if v is None

typ: {"SurfBC"} | str

RunMatrix key type to process

Keyword arguments:
j: str

Name of function to use if parameter is a string

Outputs:
v: None | any

Value of the parameter

Versions:
  • 2016-08-31 @ddalle: Version 1.0

GetSurfBC_ParamType(key, k, comp=None)

Get generic parameter value and type for a surface BC key

Call:
>>> v, t = x.GetSurfBC_ParamType(key, k, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

k: str

Name of input parameter to find

key: str

Name of trajectory key to use

comp: None | str

If v is a dict, use v[comp] if comp is nontrivial

typ: "SurfBC" | str

RunMatrix key type to process

Outputs:
v: None | any

Value of the parameter

t: str

Name of the type of v (type(v).__name__)

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfBC_PlenumID(i, key=None, comp=None, **kw)

Get gas ID input for surface BC key

Call:
>>> pID = x.GetSurfBC_PlenumID(i, key=None, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
pID: int

Gas number for plenum boundary condition

Versions:
  • 2018-10-18 @ddalle: Version 1.0

GetSurfBC_PressureCalibration(i, key=None, comp=None, **kw)

Get total pressure scaling factor used for calibration

Call:
>>> fp = x.GetSurfBC_PressureCalibration(i, key, comp, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
fp: {1.0} | float

Pressure calibration factor

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

GetSurfBC_PressureOffset(i, key=None, comp=None, **kw)

Get offset used for calibration of static or stagn pressure

The value used by cape is given by

\[\tilde{p} = \frac{b + ap}{p_\mathit{ref}}\]

where \(\tilde{p}\) is the value used in the namelist, b is the value from this function, a is the result of GetSurfBC_PressureCalibration(), p is the input value from the JSON file, and \(p_\mathit{ref}\) is the value from GetSurfBC_RefPressure(). In code, this is

p_tilde = (bp + fp*p) / pref
Call:
>>> bp = x.GetSurfBC_PressureOffset(i, key, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
bp: {0.0} | float

Stagnation or static pressure offset

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfBC_RefPressure(i, key=None, comp=None, **kw)

Get reference pressure for surface BC key

Call:
>>> pinf = x.GetSurfBC_RefPressure(i, key, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
pinf: float

Reference pressure to use, this divides the p0 value

Versions:
  • 2016-03-28 @ddalle: Version 1.0

GetSurfBC_RefTemperature(i, key=None, comp=None, **kw)

Get reference temperature for surface BC key

Call:
>>> Tinf = x.GetSurfBC_RefTemperature(i, key, comp, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
Tinf: float

Reference temperature, this divides the T0 value

Versions:
  • 2016-03-28 @ddalle: Version 1.0

GetSurfBC_Species(i, key=None, comp=None, **kw)

Get species information for a surface BC key

The species can be specified using several different manners.

The first and most common approach is to simply set a fixed list, for example setting "Species" to [0.0, 1.0, 0.0] to specify use of the second species, or [0.2, 0.8, 0.1] to specify a mix of three different species.

A second method is to specify an integer. For example, if "Species" is set to 2 and "nSpecies" is set to 4, the output will be [0.0, 1.0, 0.0, 0.0].

The third method is a generalization of the first. An alternative to simply setting a fixed list of numeric species mass fractions, the entries in the list can depend on the values of other trajectory keys. For example, setting "Species" to ['YH2', 'YO2'] will translate the mass fractions according to the values of trajectory keys "YH2" and "YO2".

Call:
>>> Y = x.GetSurfBC_Species(i, key=None, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
Y: list (float)

List of species mass fractions for boundary condition

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfBC_TemperatureCalibration(i, key=None, comp=None, **kw)

Get total/static temperature scaling factor for calibration

Call:
>>> fT=x.GetSurfBC_TemperatureCalibration(i ,key, comp, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
fp: {1.0} | float

Pressure calibration factor

Versions:
  • 2016-08-30 @ddalle: Version 1.0

GetSurfBC_TemperatureOffset(i, key=None, comp=None, **kw)

Get offset for calibration of static or stag temperature

The value used by cape is given by

\[\tilde{T} = \frac{b + aT}{T_\mathit{ref}}\]

where \(\tilde{T}\) is the value used in the namelist, b is the value from this function, a is the result of GetSurfBC_TemperatureCalibration(), T is the input value from the JSON file, and \(T_\mathit{ref}\) is the value from GetSurfBC_RefTemperature(). In code, this is

T_tilde = (bt + ft*T) / Tref
Call:
>>> bt = x.GetSurfBC_TemperatureOffset(i, key, comp, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
bt: {0.0} | float

Stagnation or static temperature offset

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfBC_TotalPressure(i, key=None, comp=None, **kw)

Get stagnation pressure input for surface BC key

Call:
>>> p0 = x.GetSurfBC_TotalPressure(i, key, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | "SurfCT" |

Type to use for checking properties of key

Outputs:
p0: float

Stagnation pressure parameter, usually p0/pinf

Versions:
  • 2016-03-28 @ddalle: Version 1.0

GetSurfBC_TotalTemperature(i, key=None, comp=None, **kw)

Get stagnation pressure input for surface BC key

Call:
>>> T0 = x.GetSurfBC_TotalTemperature(i, key, comp, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
T0: float

Stagnation temperature parameter, usually T0/Tinf

Versions:
  • 2016-03-28 @ddalle: Version 1.0

GetSurfBC_Val(i, key, v, t, vdef=None, **kw)

Default processing for processing a key by value

Call:
>>> V = x.GetSurfBC_Val(i, key, v, t, vdef=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

key: str

Name of trajectory key to use

v: None | any

Value of the parameter

t: str

Name of the type of v (type(v).__name__)

vdef: None | any

Default value for v if v is None

Outputs:
V: any

Processed key, for example x[key][i]

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfBC_nSpecies(i, key=None, comp=None, **kw)

Get number of species for a surface BC key

Call:
>>> nY = x.GetSurfBC_nSpecies(i, key=None, comp=None, **kw)
Inptus:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
nY: {1} | int

Number of species

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfCT_AreaRatio(i, key=None, comp=None)

Get area ratio for surface CT key

Call:
>>> AR = x.GetSurfCT_AreaRatio(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
AR: float

Area ratio

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

GetSurfCT_CompID(i, key=None, comp=None)

Get component ID input for surface CT key

Call:
>>> compID = x.GetSurfCT_CompID(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
compID: list (int | str)

Surface boundary condition Mach number

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

GetSurfCT_ExitArea(i, key=None, comp=None)

Get exit area for surface CT key

Call:
>>> A2 = x.GetSurfCT_ExitArea(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
A2: float

Exit area

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

GetSurfCT_ExitMach(i, key=None, comp=None)

Get Mach number input for surface CT key

Call:
>>> M2 = x.GetSurfCT_ExitMach(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

Outputs:
M2: float

Nozzle exit Mach number

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

GetSurfCT_Gamma(i, key=None, comp=None)

Get ratio of specific heats input for surface CT key

Call:
>>> gam = x.GetSurfCT_Gamma(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
gam: {1.4} | float

Ratio of specific heats

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

GetSurfCT_Grids(i, key=None, comp=None)

Get list of grids for surface CT key

Call:
>>> compID = x.GetSurfCT_Grids(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
compID: list (int | str)

Surface boundary condition Mach number

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfCT_Mach(i, key=None, comp=None)

Get Mach number input for surface CT key

Call:
>>> M = x.GetSurfCT_TotalTemperature(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
T0: float

Total temperature of thrust conditions

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

GetSurfCT_PlenumID(i, key=None, comp=None, **kw)

Get gas ID input for surface CT key

Call:
>>> pID = x.GetSurfCT_PlenumID(i, key=None, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | str

RunMatrix key type to process

Outputs:
pID: int

Gas number for plenum boundary condition

Versions:
  • 2018-10-18 @ddalle: Version 1.0

GetSurfCT_PressureCalibration(i, key=None, comp=None)

Get pressure calibration factor for CT key

Call:
>>> fp = x.GetSurfCT_PressureCalibration(i, key, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
fp: {1.0} | float

Pressure calibration factor

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

GetSurfCT_PressureOffset(i, key=None, comp=None)

Get offset used for calibration of static or stagn pressure

The value used by cape is given by

\[\tilde{p} = \frac{b + ap}{p_\mathit{ref}}\]

where \(\tilde{p}\) is the value used in the namelist, b is the value from this function, a is the result of GetSurfBC_PressureCalibration(), p is the input value from the JSON file, and \(p_\mathit{ref}\) is the value from GetSurfBC_RefPressure(). In code, this is

p_tilde = (bp + fp*p) / pref
Call:
>>> bp = x.GetSurfCT_PressureOffset(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

Outputs:
bp: {0.0} | float

Stagnation or static pressure offset

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfCT_RefArea(i, key=None, comp=None)

Get ref area for surface CT key, this divides CT value

If this is None, it defaults to the vehicle reference area

Call:
>>> Aref = x.GetSurfCT_RefArea(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
ARef: {None} | float

Reference area; if None, use the vehicle area

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

GetSurfCT_RefDynamicPressure(i, key=None, comp=None)

Get reference dynamic pressure for surface CT key

Call:
>>> qinf = x.GetSurfCT_RefDynamicPressure(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

Outputs:
qinf: float

Reference dynamic pressure to use, this divides the CT value

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

  • 2016-08-29 @ddalle: Added component capability

GetSurfCT_RefPressure(i, key=None, comp=None)

Get reference pressure input for surface CT total pressure

Call:
>>> Tref = x.GetSurfCT_RefPressure(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
pref: float

Reference pressure for normalizing T0

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

GetSurfCT_RefTemperature(i, key=None, comp=None)

Reference temperature input for surf CT total temperature

Call:
>>> Tref = x.GetSurfCT_RefTemperature(i, key, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
Tref: float

Reference temperature for normalizing T0

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

GetSurfCT_Species(i, key=None, comp=None)

Get species input for surface CT key

Call:
>>> Y = x.GetSurfCT_Species(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
Y: list (float)

Vector of mass fractions

Versions:
  • 2016-08-30 @ddalle: Version 1.0

GetSurfCT_TemperatureCalibration(i, key=None, comp=None)

Get temperature calibration factor for CT key

Call:
>>> fT = x.GetSurfCT_Temperature(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
fT: {1.0} | float

Temperature calibration factor

Versions:
  • 2016-08-30 @ddalle: Version 1.0

GetSurfCT_TemperatureOffset(i, key=None, comp=None)

Get offset for calibration of static or stag temperature

The value used by cape is given by

\[\tilde{T} = \frac{b + aT}{T_\mathit{ref}}\]

where \(\tilde{T}\) is the value used in the namelist, b is the value from this function, a is the result of GetSurfBC_TemperatureCalibration(), T is the input value from the JSON file, and \(T_\mathit{ref}\) is the value from GetSurfBC_RefTemperature(). In code, this is

T_tilde = (bt + ft*T) / Tref
Call:
>>> bt = x.GetSurfCT_TemperatureOffset(i, key, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

Outputs:
bt: {0.0} | float

Stagnation or static temperature offset

Versions:
  • 2016-08-29 @ddalle: Version 1.0

GetSurfCT_Thrust(i, key=None, comp=None)

Get thrust input for surface CT key

Call:
>>> CT = x.GetSurfCT_Thrust(i, key=None, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: None | str

Name of component to access if CT is a dict

comp: {None} | str

Name of component

Outputs:
CT: float

Thrust parameter, either thrust or coefficient

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

  • 2016-08-29 @ddalle: Added component capability

GetSurfCT_TotalPressure(i, key=None, comp=None)

Get stagnation pressure input for surface CT key

Call:
>>> p0 = x.GetSurfCT_TotalPressure(i, key=None, comp=None, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfBC key

comp: {None} | str

Name of component

typ: {"SurfBC"} | "SurfCT" |

Type to use for checking properties of key

Outputs:
p0: float

Stagnation pressure parameter, usually p0/pinf

Versions:
  • 2016-03-28 @ddalle: Version 1.0

GetSurfCT_TotalTemperature(i, key=None, comp=None)

Get total temperature input for surface CT key

Call:
>>> T0 = x.GetSurfCT_TotalTemperature(i, key, comp=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: int

Case index

key: None | str

Name of key to use; defaults to first SurfCT key

comp: {None} | str

Name of component

Outputs:
T0: float

Total temperature of thrust conditions

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

GetSutherland_C(i=None, units=None)

Get reference temperature for Sutherland’s Law

Call:
>>> C = x.GetSutherland_C(i=None, units=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | str

Requested units of output

Outputs:
C: float

Reference temperature [ K | units ]

Versions:
  • 2018-04-13 @ddalle: Version 1.0

GetSutherland_T0(i=None, units=None)

Get reference temperature for Sutherland’s Law

Call:
>>> T0 = x.GetSutherland_T0(i=None, units=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | str

Requested units of output

Outputs:
T0: float

Reference temperature [ K | units ]

Versions:
  • 2018-04-13 @ddalle: Version 1.0

GetSutherland_mu0(i=None, units=None)

Get reference viscosity for Sutherland’s Law

Call:
>>> mu0 = x.GetSutherland_mu0(i=None, units=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | str

Requested units of output

Outputs:
mu0: float

Reference viscosity [ kg/m*s | units ]

Versions:
  • 2018-04-13 @ddalle: Version 1.0

GetSweep(M, **kw)

Return a list of indices meeting sweep constraints

The sweep uses the index of the first entry of True in M, i.e. i0=np.where(M)[0][0]. Then the sweep contains all other points that meet all criteria with respect to trajectory point i0.

For example, using EqCons=['mach'] will cause the method to return points with x.mach matching x.mach[i0].

Call:
>>> I = x.GetSweep(M, **kw)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

M: numpy.ndarray (bool)

Mask of which trajectory points should be considered

i0: {np.where(M)[0][0]} | int

Index of case to use as seed of sweep

SortVar: str

Variable by which to sort each sweep

EqCons: list[str]

List of trajectory keys which must match (exactly) the first point in the sweep

TolCons: dict (float)

Dictionary whose keys are trajectory keys which must match the first point in the sweep to a specified tolerance and whose values are the specified tolerances

IndexTol: int

If specified, only trajectory points in the range [i0,i0+IndexTol] are considered for the sweep

Outputs:
I: np.ndarray[int]

List of trajectory point indices in the sweep

Versions:
  • 2015-05-24 @ddalle: Version 1.0

  • 2017-06-27 @ddalle: Added special variables

GetSweeps(**kw)

Return a list of index sets in which each list contains cases that match according to specified criteria

For example, using EqCons=['mach'] will cause the method to return lists of points with the same Mach number.

Call:
>>> J = x.GetSweeps(**kw)
Inputs:
cons: list[str]

List of global constraints; only points satisfying these constraints will be in one of the output sweeps

I: np.ndarray[int]

List of indices to restrict to

SortVar: str

Variable by which to sort each sweep

EqCons: list[str]

List of trajectory keys which must match (exactly) the first point in the sweep

TolCons: dict[float]

Dictionary whose keys are trajectory keys which must match the first point in the sweep to a specified tolerance and whose values are the specified tolerances

IndexTol: int

If specified, only trajectory points in the range [i0,i0+IndexTol] are considered for the sweep

Outputs:
J: list (np.ndarray[int])

List of trajectory point sweeps

Versions:
  • 2015-05-25 @ddalle: Version 1.0

GetTemperature(i=None, units=None)

Get static freestream temperature

Call:
>>> T = x.GetTemperature(i)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | "mks" | "F" | "R"

Output units

Outputs:
T: float

Static temperature [R | K]

Versions:
  • 2016-03-24 @ddalle: Version 1.0

  • 2017-06-25 @ddalle: Added default i = None

  • 2018-04-13 @ddalle: Units

GetTotalPressure(i=None, units=None)

Get freestream stagnation pressure (in psf or Pa)

Call:
>>> p0 = x.GetTotalPressure(i)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | "mks" | str

Output units

Outputs:
p0: float

Stagnation pressure [psf | Pa]

Versions:
  • 2016-08-30 @ddalle: Version 1.0

  • 2017-07-20 @ddalle: Added default cases

  • 2018-04-17 @ddalle: Added units

GetTotalTemperature(i=None, units=None)

Get freestream stagnation temperature

Call:
>>> T0 = x.GetTotalTemperature(i, units=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | str

Output units

Outputs:
T0: float

Freestream stagnation temperature [ R | K | units ]

Versions:
  • 2016-08-30 @ddalle: Version 1.0

  • 2017-07-20 @ddalle: Added default cases

  • 2018-04-17 @ddalle: Units

GetUniqueGroupFolderNames(i=None)

Get unique names of folders that require separate meshes

Call:
>>> x.GetUniqueGroupFolderNames()
>>> x.GetUniqueGroupFolderNames(i)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

i: int or list

Index of group(s) to process

Outputs:
dname: str or list

Folder name or list of folder names

Versions:
  • 2014-09-03 @ddalle: Version 1.0

GetValue(k, I=None)

Get value(s) from a trajectory key, including derived keys

Call:
>>> V = x.GetValue(k)
>>> V = x.GetValue(k, I)
>>> v = x.GetValue(k, i)
Inputs:
x: attdb.runmatrix.RunMatrix

Run matrix conditions interface

k: str

RunMatrix key name

i: int

Case index

I: np.ndarray (int)

Array of case indices

Outputs:
V: np.ndarray

Array of values from one or more cases

v: np.any

Value for individual case i

Versions:
GetValue_Derived(k, I=None)

Get value from a trajectory key, including derived keys

Call:
>>> V = x.GetValue(k)
>>> V = x.GetValue(k, I)
>>> v = x.GetValue(k, i)
Inputs:
x: attdb.runmatrix.RunMatrix

Run matrix conditions interface

k: str

Non-trajectory key name still described in x.defns

i: int

Case index

I: np.ndarray (int)

Array of case indices

Outputs:
V: np.ndarray

Array of values from one or more cases

v: np.any

Value for individual case i

Versions:
  • 2019-06-19 @ddalle: Version 1.0 (CT only)

GetVelocity(i=None, units=None)

Get velocity

Call:
>>> U = x.GetVelocity(i)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int

Case number (return all if None)

units: {None} | "mks" | "m/s" | str

Output units

Outputs:
r: float

velocity [ m/s | ft/s | units ]

Versions:
  • 2018-04-13 @jmeeroff: Version 1.0

  • 2018-04-17 @ddalle: Second method for units

GetViscosity(i=None, units=None)

Get the dynamic viscosity for case(s) i

Call:
>>> mu = x.GetViscosity(i=None, units=None)
Inputs:
x: cape.runmatrix.RunMatrix

Run matrix interface

i: {None} | int | list

Case number(s)

units: {None} | "mks" | str

Output units

Outputs:
q: float

Dynamic pressure [psf | Pa | units]

Versions:
  • 2018-04-13 @ddalle: Version 1.0

MarkERROR(i, flag='E')

Mark a case as ERROR

Call:
>>> x.MarkERROR(i, flag="E")
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

i: int

Index of the run case to print

flag: {"E"} | "e"``| ``"$E" | "ERROR"

Marker to use to denote status

Versions:
  • 2019-06-14 @ddalle: Version 1.0

MarkPASS(i, flag='p')

Mark a case as PASS

This result in a status of PASS* if the case would is not otherwise DONE.

Call:
>>> x.MarkPASS(i, flag="p")
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

i: int

Index of the run case to print

flag: {"p"} | "P"``| ``"$p" | "PASS"

Marker to use to denote status

Versions:
  • 2019-06-14 @ddalle: Version 1.0

ProcessGroups()

Split trajectory variables into groups. A “group” is a set of trajectory conditions that can use the same mesh.

Call:
>>> x.ProcessGroups()
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

Effects:

Creates fields that save the properties of the groups. These fields are called x.GroupKeys, x.GroupX, x.GroupID.

Versions:
  • 2014-06-05 @ddalle: Version 1.0

ProcessKeyDefinitions(defns)

Process definitions for each trajectory variable

Many variables have default definitions, such as 'Mach', 'alpha', etc. For user-defined trajectory keywords, defaults will be used for aspects of the definition that are missing from the inputs.

Call:
>>> x.ProcessKeyDefinitions(defns)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the pyCart trajectory class

defns: dict

Dictionary of keyword definitions or partial definitions

Effects:
x.text: dict

Text for each variable and each break point initialized

x.defns: dict

Definitionscreated after processing defaults

x.abbrv: dict

Dictionary of abbreviations for each trajectory key

Versions:
  • 2014-06-05 @ddalle: Version 1.0

  • 2014-06-17 @ddalle: Version 2.0; use defns dict

ReadRunMatrixFile(fname)

Read trajectory variable values from file

Call:
>>> x.ReadRunMatrixFile(fname)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

fname: str

Name of trajectory file

Versions:
  • 2014-10-13 @ddalle: Cut code from __init__ method

SetValue(k, i, v, align='right')

Set the value of one key for one case to v

Also write the value to the appropriate line of text

Call:
>>> x.SetValue(k, i, v, align="right")
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

k: str

Name of trajectory key to alter

i: int

Index of the run case to print

v: any

Value to write to file

align: {"right"} | "left"

Alignment option relative to white space

Versions:
  • 2019-06-14 @ddalle: Version 1.0

UnmarkCase(i)

Unmark a case’s PASS or ERROR flag

Call:
>>> x.UnmarkCase(i)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

i: int

Index of the run case to print

Versions:
  • 2019-06-14 @ddalle: Version 1.0

WriteConditionsJSON(i, fname='conditions.json')

Write a simple JSON file with exact trajectory variables

Call:
>>> x.WriteConditionsJSON(i, fname="conditions.json")
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

i: int

Index of the run case to print

fname: str

Name of file to create

Versions:
  • 2014-11-18 @ddalle: Version 1.0

WriteRunMatrixFile(fname=None)

Write run matrix values to file based on original text

Differences between the text and the working values (created by specifying values in the trajectory) are preserved.

Call:
>>> x.WriteRunMatrixFile()
>>> x.WriteRunMatrixFile(fname)
Inputs:
x: cape.runmatrix.RunMatrix

Instance of the trajectory class

fname: {x.fname} | str

Name of trajectory file to write

Versions:
  • 2019-06-14 @ddalle: Version 1.0