cape.pyfun.options.fun3dnml: FUN3D namelist options

This module provides a class to interpret JSON options that are converted to Fortran namelist format for FUN3D. The module provides a class, pyFun.options.fun3dnml.Fun3DNml, which interprets the settings of the "Fun3D" section of the master JSON file. These settings are then applied to the main OVERFLOW input file, the fun3d.nml namelist.

An example JSON setting is shown below.

"Fun3D": {
    "nonlinear_solver_parameters": {
        "schedule_cfl": [[1.0, 5.0], [5.0, 20.0], [20.0, 20.0]],
        "time_accuracy": ["steady", "steady", "2ndorder"],
        "time_step_nondim": 2.0,
        "subiterations": 5
    },
    "boundary_output_variables": {
        "boundary_list": "7-52",
        "turres1": true,
        "p_tavg": [false, false, true]
    }
}

This will cause the following settings to be applied to fun3d.00.nml.

&nonlinear_solver_parameters
    schedule_cfl = 1.0 5.0
    time_accuracy = 'steady'
    time_step_nondim = 2.0
    subiterations = 5
/
&boundary_output_variables
    boundary_list = '7-52'
    turres1 = .true.
    p_tavg = .false.
/

The edits to fun3d.02.nml are from the third entries of each list:

&nonlinear_solver_parameters
    schedule_cfl = 20.0 20.0
    time_accuracy = '2ndorder'
    time_step_nondim = 2.0
    subiterations = 5
/
&boundary_output_variables
    boundary_list = '7-52'
    turres1 = .true.
    p_tavg = .true.
/

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

See also:
class cape.pyfun.options.fun3dnml.Fun3DNml

Dictionary-based interface for FUN3D namelists

get_grid_format(i=None)

Return the grid format

Call:
>>> fmat = opts.get_grid_format(i=None)
Inputs:
opts: pyFun.options.Options

Options interface

i: int or None

Run sequence index

Outputs:
fmat: str

Grid format

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

get_namelist_var(sec, key, i=None)

Select a namelist key from a specified section

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

Call:
>>> val = opts.get_namelist_var(sec, key, i=None)
Inputs:
opts: pyFun.options.Options

Options interface

sec: str

Section name

key: str

Variable name

i: int | None

Run sequence index

Outputs:
val: int | float | str | list

Value from JSON options

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

get_project(i=None)

Return the project namelist

Call:
>>> d = opts.get_project(i=None)
Inputs:
opts: pyFun.options.Options

Options interface

i: int or None

Run sequence index

Outputs:
d: pyFun.options.odict

Project namelist

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

get_project_rootname(i=None)

Return the project root name

Call:
>>> rname = opts.get_project_rootname(i=None)
Inputs:
opts: pyFun.options.Options

Options interface

i: int or None

Run sequence index

Outputs:
rname: str

Project root name

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

get_raw_grid(i=None)

Return the raw_grid namelist

Call:
>>> d = opts.get_raw_grid(i=None)
Inputs:
opts: pyFun.options.Options

Options interface

i: int or None

Run sequence index

Outputs:
d: pyFun.options.odict

Grid namelist

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

select_namelist(i=0)

Reduce namelist options to a single instance (i.e. sample lists)

Call:
>>> d = opts.select_namelist(i)
Inputs:
opts: pyFun.options.Options

Options interface

i: int or None

Run sequence index

Outputs:
d: pyFun.options.odict

Project namelist

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

set_namelist_var(sec, key, val, i=None)

Set a namelist key for a specified phase or phases

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

Call:
>>> opts.set_namelist_var(sec, key, val, i=None)
Inputs:
opts: pyFun.options.Options

Options interface

sec: str

Section name

key: str

Variable name

val: int | float | str | list

Value from JSON options

i: int | None

Run sequence index

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