This module provides tools to read, access, modify, and write settings
for cape.pyus. It provides Options, which is based off
of dict class, so options are stored in keys such as
opts["InputInp"]. In addition, many convenience methods, such as
opts.get_CFDSOLVER_ires(), are also provided.
- class cape.pyus.options.Options(*args, **kw)¶
Bases:
OptionsOptions interface for
cape.pyfun- Call:
>>> opts = Options(fname=None, **kw)
- Inputs:
- fname:
str File to be read as a JSON file with comments
- kw:
dicts Dictionary to be transformed into
pyCart.options.Options
- fname:
- Versions:
2014-07-28
@ddalle: v1.02023-03-20
@ddalle: v2.0; usecape.optdict
- apply_ArchiveTemplate()¶
Apply named template to set default files to delete/archive
- Call:
>>> opts.apply_ArchiveTemplate()
- Inputs:
- opts:
Options Options interface
- opts:
- Versions:
2016-02-29
@ddalle: v1.0
- get_CFDSOLVER(j=None)¶
Return a
"CFD_SOLVER"settingsdict- 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
- d:
- Versions:
2019-06-27
@ddalle: First version
- get_CFDSOLVER_key(k, j=None)¶
Return a named parameter from the CFD_SOLVER section
- get_ConfigInput(comp: str, **kw)¶
Return the input for a particular component
- Call:
>>> inp = opts.get_ConfigInput(comp, **kw)
- Inputs:
- opts:
cape.cfdx.options.Options Options interface
- comp:
str Name of component
- opts:
- Outputs:
- Versions:
2015-10-20
@ddalle: v1.02023-03-28
@ddalle: v2.0; usecape.optdict
- get_InputInp(j=None, i=None, **kw)¶
Get name of
input.inptemplate file- Call:
>>> InputInp = opts.get_InputInp(j=None, i=None, **kw)
- Inputs:
- opts: Options
options interface
- j: {
None} |int Phase index; use
Noneto 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
listordict
- Outputs:
- InputInp: {
None} |str name of
input.inptemplate file
- InputInp: {
- get_InputInp_key(sec, key, j=None)¶
Select an
input.inpsetting from a specified sectionRoughly, this returns
opts[sec][key].- Call:
>>> val = opts.get_namelist_key(sec, key, j=None)
- Inputs:
- Outputs:
- val: JSON-type
Value from JSON options
- Versions:
2015-10-19
@ddalle: First version2019-06-27
@ddalle: Fromget_namelist_var()
- get_PostScrFile(j=None, i=None, **kw)¶
Get name of
post.scrfile template- Call:
>>> PostScrFile = opts.get_PostScrFile(j=None, i=None, **kw)
- Inputs:
- opts: ConfigOpts
options interface
- j: {
None} |int Phase index; use
Noneto 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
listordict
- Outputs:
- PostScrFile: {
None} |str name of
post.scrfile template
- PostScrFile: {
- get_conn(j=None, i=None, **kw)¶
Get name of connectivity file made by
us3d-prepar- Call:
>>> conn = opts.get_conn(j=None, i=None, **kw)
- Inputs:
- opts: US3DPreparOpts
options interface
- j: {
None} |int Phase index; use
Noneto 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
listordict
- Outputs:
- conn: {
'conn.h5'} |str name of connectivity file made by
us3d-prepar
- conn: {
- get_gas(j=None, i=None, **kw)¶
Get name of gas model to use for US3D
- Call:
>>> gas = opts.get_gas(j=None, i=None, **kw)
- Inputs:
- opts: US3DRunOpts
options interface
- j: {
None} |int Phase index; use
Noneto 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
listordict
- Outputs:
- gas: {
None} |str name of gas model to use for US3D
- gas: {
- get_grid(j=None, i=None, **kw)¶
Get name of US3D grid file
- Call:
>>> grid = opts.get_grid(j=None, i=None, **kw)
- Inputs:
- opts: US3DRunOpts
options interface
- j: {
None} |int Phase index; use
Noneto 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
listordict
- Outputs:
- grid: {
'grid.h5'} |str name of US3D grid file
- grid: {
- get_input(j=None, i=None, **kw)¶
Get name of US3D input control file
- Call:
>>> input = opts.get_input(j=None, i=None, **kw)
- Inputs:
- opts: US3DRunOpts
options interface
- j: {
None} |int Phase index; use
Noneto 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
listordict
- Outputs:
- input: {
'input.inp'} |str name of US3D input control file
- input: {
- get_run(j=None, i=None, **kw)¶
Get whether to execute program
- Call:
>>> run = opts.get_run(j=None, i=None, **kw)
- Inputs:
- opts: US3DRunOpts
options interface
- j: {
None} |int Phase index; use
Noneto 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
listordict
- Outputs:
- run: {
None} |True|False whether to execute program
- run: {
- init_post()¶
Initialization hook for
Options- Call:
>>> opts.init_post()
- Inputs:
- opts:
Options Options interface
- opts:
- Versions:
2022-10-23
@ddalle: Version 1.0
- select_InputInp(j=0)¶
Reduce
input.inpoptions 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
- opts:
- Outputs:
- d:
cape.cfdx.options.odict Project settings for phase j
- d:
- Versions:
2019-06-27
@ddalle: First version
- set_InputInp(v, j=None, mode=None)¶
Get name of
input.inptemplate file- Call:
>>> opts.set_InputInp(InputInp, j=None, i=None, **kw)
- Inputs:
- opts: Options
options interface
- InputInp: {
None} |str name of
input.inptemplate file- j: {
None} |int Phase index; use
Noneto 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_InputInp_key(sec, key, val, j=None)¶
Set a namelist key for a specified phase or phases
Roughly, this sets
opts["US3D"][sec][key]oropts["US3D"][sec][key][i]equal to val- Call:
>>> opts.set_InputInp_key(sec, key, val, j=None)
- Inputs:
- Versions:
2017-04-05
@ddalle: First version2019-06-27
@ddalle: Fromset_namelist_var()
- set_PostScrFile(v, j=None, mode=None)¶
Get name of
post.scrfile template- Call:
>>> opts.set_PostScrFile(PostScrFile, j=None, i=None, **kw)
- Inputs:
- opts: ConfigOpts
options interface
- PostScrFile: {
None} |str name of
post.scrfile template- j: {
None} |int Phase index; use
Noneto 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_conn(v, j=None, mode=None)¶
Get name of connectivity file made by
us3d-prepar- Call:
>>> opts.set_conn(conn, j=None, i=None, **kw)
- Inputs:
- opts: US3DPreparOpts
options interface
- conn: {
'conn.h5'} |str name of connectivity file made by
us3d-prepar- j: {
None} |int Phase index; use
Noneto 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_gas(v, j=None, mode=None)¶
Get name of gas model to use for US3D
- Call:
>>> opts.set_gas(gas, j=None, i=None, **kw)
- Inputs:
- opts: US3DRunOpts
options interface
- gas: {
None} |str name of gas model to use for US3D
- j: {
None} |int Phase index; use
Noneto 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_grid(v, j=None, mode=None)¶
Get name of US3D grid file
- Call:
>>> opts.set_grid(grid, j=None, i=None, **kw)
- Inputs:
- opts: US3DRunOpts
options interface
- grid: {
'grid.h5'} |str name of US3D grid file
- j: {
None} |int Phase index; use
Noneto 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_input(v, j=None, mode=None)¶
Get name of US3D input control file
- Call:
>>> opts.set_input(input, j=None, i=None, **kw)
- Inputs:
- opts: US3DRunOpts
options interface
- input: {
'input.inp'} |str name of US3D input control file
- j: {
None} |int Phase index; use
Noneto 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_run(v, j=None, mode=None)¶
Get whether to execute program
- Call:
>>> opts.set_run(run, j=None, i=None, **kw)
- Inputs:
- opts: US3DRunOpts
options interface
- run: {
None} |True|False whether to execute program
- j: {
None} |int Phase index; use
Noneto 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