cape.pyus.options.inputInp: US3D input.inp options

This module provides a class to interpret JSON options that are converted to input.inp settings for FUN3D. The module provides a class, pyUS.options.inputinpfile.InputInpOpts, which interprets the settings of the "US3D" section of the master JSON file. These settings are then applied to the main OVERFLOW input file, the input.inp input file, which is in a format specific to US3D.

An example JSON setting is shown below.

"US3D": {
    "CFD_SOLVER": {
        "nstop": 30000,
        "ivisc": 11,
        "cfl": [1.1, 5.1, 10.1]
    },
    "CFD_SOLVER_OPTS": {
        "chem_vibr_diso": 1.0
    },
    "MANAGE": {
        "flag": 4
    }
}

This will cause or partially cause changes to the sections [CFD_SOVER], [CFD_SOLVER_OPTS], and [MANAGE] in the input.00.inp file.

The edits to input.02.inp are from the third entries of each list, so the cfl parameter would be 10.1 instead of 1.1.

Each setting and section in the "US" section may be either present in the template input.inp file or missing. It will be either edited or added as appropriate, even if the specified section does not exist.

See also:
class cape.pyus.options.inputInp.InputInpOpts

Bases: odict

Dictionary-based interface for US3D input file input.inp

get_CFDSOLVER(j=None)

Return a "CFD_SOLVER" settings dict

Call:
>>> d = opts.get_CFDSOLVER(sec, j=None)
Inputs:
opts: :pyUS.options.Options`

Options interface

j: {None} | int

Phase number

Outputs:
d: cape.cfdx.options.odict

Settings for that section

Versions:
  • 2019-06-27 @ddalle: First version

get_CFDSOLVER_key(k, j=None)

Return a named parameter from the CFD_SOLVER section

Call:
>>> v = opts.get_CFDSOLVER_key(k, j=None)
Inputs:
opts: :pyUS.options.Options`

Options interface

k: str

Name of appropriate key from input.inp section

j: {None} | int

Phase number

Outputs:
v: int | float | list

Value for (numeric) parameter

Versions:
  • 2019-06-27 @ddalle: First version

get_InputInp_key(sec, key, j=None)

Select an input.inp setting from a specified section

Roughly, this returns opts[sec][key].

Call:
>>> val = opts.get_namelist_key(sec, key, j=None)
Inputs:
opts: pyUS.options.Options

Options interface

sec: str

Section name

key: str

Variable name

j: {None} | int

Phase number

Outputs:
val: JSON-type

Value from JSON options

Versions:
  • 2015-10-19 @ddalle: First version

  • 2019-06-27 @ddalle: From get_namelist_var()

get_section(sec, j=None)

Return a settings dict for an input.inp section

Call:
>>> d = opts.get_section(sec, j=None)
Inputs:
opts: :pyUS.options.Options`

Options interface

sec: str

Name of appropriate input.inp section

j: {None} | int

Phase number

Outputs:
d: cape.cfdx.options.odict

Settings for that section

Versions:
  • 2019-06-27 @ddalle: First version

select_InputInp(j=0)

Reduce input.inp options to options for a single phase

Call:
>>> d = opts.select_InputInp(j=0)
Inputs:
opts: pyUS.options.Options

Options interface

j: {0} | int

Phase number

Outputs:
d: cape.cfdx.options.odict

Project settings for phase j

Versions:
  • 2019-06-27 @ddalle: First version

set_InputInp_key(sec, key, val, j=None)

Set a namelist key for a specified phase or phases

Roughly, this sets opts["US3D"][sec][key] or opts["US3D"][sec][key][i] equal to val

Call:
>>> opts.set_InputInp_key(sec, key, val, j=None)
Inputs:
opts: pyUS.options.Options

Options interface

sec: str

Section name

key: str

Variable name

val: JSON-type

Value for JSON options

j: {None} | int

Phase number

Versions:
  • 2017-04-05 @ddalle: First version

  • 2019-06-27 @ddalle: From set_namelist_var()