cape.cfdx.options.configopts: Options for CFD component config

This module provides options for CFD component configurations, including:

  • Pointing to a surface component hierarchy file

  • Telling the solver which components to report on each iteration

  • Defining moment reference points

  • Defining other points used by other options

The ConfigOpts.get_ConfigFile() typically points to an external file that associates names with each numbered surface and provides a tree of parent/child relationships between components and groups of components.

Another aspect is to define "Points" by name. This allows the moment reference point for a configuration and not have to repeat the coordinates over and over again. Furthermore, named points can be transformed by other functions automatically. For example, a moment reference point can be translated and rotated along with a component, or a set of four points defining a right-handed coordinate system can be kept attached to a certain component.

class cape.cfdx.options.configopts.ConfigOpts(*args, **kw)

Options class for CFD configuration

It is primarily used for naming surface components, grouping them, defining moment reference points, defining other points, and requesting components of interest.

Call:
>>> opts = Config(**kw)
Inputs:
kw: dict

Dictionary of configuration

Outputs:
opts: ConfigOpts

CFD component configuration option interface

Versions:
  • 2014-09-29 @ddalle: Version 1.0 (Config)

  • 2022-11-01 @ddalle: Version 2.0; OptDict

expand_Point(x)

Expand points that are specified by name instead of value

Call:
>>> x = opts.expand_Point(x)
>>> x = opts.expand_Point(s)
>>> X = opts.expand_Point(d)
Inputs:
opts: cape.cfdx.options.Options

Options interface

x: list[float]

Point

s: str

Point name

d: dict

Dictionary of points and point names

Outputs:
x: [float, float, float]

Point

X: dict

Dictionary of points

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

get_ConfigComponents(j=None, i=None, **kw)

Get list of components to request from solver

Call:
>>> Components = opts.get_ConfigComponents(j=None, i=None, **kw)
Inputs:
opts: ConfigOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
Components: {[]} | list[str]

list of components to request from solver

get_ConfigFile(j=None, i=None, **kw)

Get configuration file name

Call:
>>> ConfigFile = opts.get_ConfigFile(j=None, i=None, **kw)
Inputs:
opts: ConfigOpts

options interface

j: {None} | int

Phase index; use None to just return v

i: {None} | int | np.ndarray

opts.x index(es) to use with @expr, @map, etc.

vdef: {None} | object

Manual default

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

ring: {opts._optring[key]} | True | False

Override option to loop through phase inputs

listdepth: {0} | int > 0

Depth of list to treat as a scalar

x: {None} | dict

Ref conditions to use with @expr, @map, etc.; often a run matrix; used in combination with i

sample: {True} | False

Apply j, i, and other settings recursively if output is a list or dict

Outputs:
ConfigFile: {'Config.xml'} | str

configuration file name

get_Point(name=None)

Return the coordinates of a point by name

If the input is a point, it is simply returned

Call:
>>> x = opts.get_Point(name=None)
>>> x = opts.get_Point(x)
Inputs:
opts: cape.cfdx.options.Options

Options interface

name: str

Point name

Outputs:
x: [float, float, float]

Coordinates of that point

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

  • 2022-11-01 @ddalle: Version 1.1; ARRAY_TYPES

get_RefArea(comp=None)

Return the reference area [for a component]

The comp input has an affect if the "RefArea" option is a dict. Otherwise all values of comp wil return the same Aref

Call:
>>> Aref = opts.get_RefArea()
>>> Aref = opts.get_RefArea(comp=None)
Inputs:
opts: cape.cfdx.options.Options

Options interface

comp: {None} | str

Name of component

Outputs:
Aref: float

Reference area [for comp]

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

  • 2022-11-01 @ddalle: Version 2.0; get_refcol()

get_RefLength(comp=None)

Return the reference length [for a component]

The comp argument has an effect if the``”RefLength”`` option is a dict

Call:
>>> Lref = opts.get_RefLength()
>>> Lref = opts.get_RefLength(comp=None)
Inputs:
opts: cape.cfdx.options.Options

Options interface

comp: {None} | str

Name of component

Outputs:
Lref: float

Reference length [of comp]

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

  • 2022-11-01 @ddalle: Version 2.0; get_refcol()

get_RefPoint(comp=None)

Return the moment reference point [for a component]

Call:
>>> x = opts.get_RefPoint()
>>> x = opts.get_RefPoint(comp=None)
Inputs:
opts: cape.cfdx.options.Options

Options interface

comp: str or int

Name of component or component index

Outputs:
x: [float, float, float]

Moment reference point [for comp]

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

  • 2022-11-01 @ddalle: Version 2.0; get_refcol()

get_RefSpan(comp=None)

Return the reference span [for a component]

This falls back to "RefLength" if appropriate

Call:
>>> bref = opts.get_RefSpan()
>>> bref = opts.get_RefSpan(comp=None)
Inputs:
opts: cape.cfdx.options.Options

Options interface

comp: {None} | str

Name of component

Outputs:
bref: float

Reference span [for comp]

Versions:
  • 2017-02-19 @ddalle: Version 1.0; from get_RefLength

  • 2022-11-01 @ddalle: Version 2.0; get_refcol()

get_refcol(col: str, comp=None, j=None)

Get value of a dictionary option like "RefArea"

Call:
>>> vref = opts.get_refcol(col, comp=None)
Inputs:
opts: ConfigOpts

CFD component configuration option interface

col: str

Name of "Config" option

comp: {None} | str

Name of component

j: {None} | int

Phase index

Outputs:
vref: float

Reference quantity [for comp]

Versions:
  • 2022-11-01 @ddalle: v1.0

  • 2023-05-19 @ddalle: v1.1; mod for OptionsDict

  • 2023-10-16 @ddalle: v1.2; add j

init_post()

Initialization hook for ConfigOpts

Call:
>>> opts.init_post()
Inputs:
opts: ConfigOpts

CFD component configuration option interface

Versions:
  • 2022-11-01 @ddalle: Version 1.0

reset_Points()

Reset all points to original locations

Call:
>>> opts.reset_Points()
Inptus:
opts: cape.cfdx.options.Options

Options interface

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

  • 2022-11-01 @ddalle: Version 1.1; deepcopy()

set_ConfigComponents(v, j=None, mode=None)

Get list of components to request from solver

Call:
>>> opts.set_ConfigComponents(Components, j=None, i=None, **kw)
Inputs:
opts: ConfigOpts

options interface

Components: {[]} | list[str]

list of components to request from solver

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_ConfigFile(v, j=None, mode=None)

Get configuration file name

Call:
>>> opts.set_ConfigFile(ConfigFile, j=None, i=None, **kw)
Inputs:
opts: ConfigOpts

options interface

ConfigFile: {'Config.xml'} | str

configuration file name

j: {None} | int

Phase index; use None to just return v

mode: {None} | 0 | 1 | 2 | 3

Warning mode code

0:

no checks

1:

validate silently

2:

validate and show warnings

3:

raise an exception if invalid

listdepth: {0} | int > 0

Depth of list to treat as a scalar

set_Point(x, name: str)

Set or alter the coordinates of a point by name

Call:
>>> opts.set_Point(x, name)
Inputs:
opts: cape.cfdx.options.Options

Options interface

x: [float, float, float]

Coordinates of that point

name: str

Point name

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

  • 2022-11-01 @ddalle: Versoin 1.1; ARRAY_TYPES

set_RefArea(Aref, comp=None)

Set the reference area [of a component]

Call:
>>> opts.set_RefArea(Aref)
>>> opts.set_RefArea(Aref, comp=None)
Inputs:
opts: cape.cfdx.options.Options

Options interface

Aref: float

Reference area [for comp]

comp: {None} | str

Name of component

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

  • 2022-11-01 @ddalle: Version 2.0; set_refcol()

set_RefLength(Lref, comp=None)

Set the reference length [of a component]

Call:
>>> opts.set_RefLength(Lref)
>>> opts.set_RefLength(Lref, comp=None)
Inputs:
opts: cape.cfdx.options.Options

Options interface

Lref: float

Reference length [of comp]

comp: {None} | str

Name of component

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

  • 2022-11-01 @ddalle: Version 2.0; set_refcol()

set_RefPoint(x, comp=None)

Set the moment reference point [for a component]

Call:
>>> opts.set_RefPoint(x)
>>> opts.set_RefPoint(x, comp=None)
Inputs:
opts: cape.cfdx.options.Options

Options interface

x: [float, float, float]

Global moment reference point or that for a component

comp: str or int

Name of component or component index

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

  • 2022-11-01 @ddalle: Version 2.0; set_refcol()

set_RefSpan(bref, comp=None)

Set the reference span [for a component]

Call:
>>> opts.set_RefSpan(bref)
>>> opts.set_RefSpan(bref, comp=None)
Inputs:
opts: cape.cfdx.options.Options

Options interface

bref: float

Reference span [for comp]

comp: {None} | str

Name of component

Versions:
set_refcol(col, v, comp=None)

Set value of a dictionary option like "RefArea"

Call:
>>> opts.set_refcol(col, v, comp=None)
Inputs:
opts: ConfigOpts

CFD component configuration option interface

col: str

Name of "Config" option

v: object

Reference quantity [for comp]

comp: {None} | str

Name of component

Versions:
  • 2022-11-01 @ddalle: Version 1.0