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.fun3dnmlopts.Fun3DNmlOpts(*args, **kw)

Dictionary-based interface for FUN3D namelists

get_grid_format(j=None, **kw)

Return the grid format

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

Options interface

j: {None} | int

Phase index

Outputs:
fmat: str

Grid format

Versions:
  • 2015-10-18 @ddalle: v1.0

  • 2023-05-13 @ddalle: v2.0; use OptionsDict

get_namelist_var(sec, key, j=None, **kw)

Select a namelist key from a specified section

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

Call:
>>> val = opts.get_namelist_var(sec, key, j=None, **kw)
Inputs:
opts: Options

Options interface

sec: str

Section name

key: str

Variable name

j: {None} | int

Phase index

Outputs:
val: object

Value from JSON options

Versions:
  • 2015-10-19 @ddalle: v1.0

  • 2023-05-16 @ddalle: v2.0; OptionsDict tools

get_project()

Return the project namelist

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

Options interface

Outputs:
d: pyFun.options.odict

Project namelist

Versions:
  • 2015-10-18 @ddalle: v1.0

  • 2023-05-13 @ddalle: v2.0; use OptionsDict

get_project_rootname(j=None, **kw)

Return the project root name

Call:
>>> rname = opts.get_project_rootname(j=None, **kw)
Inputs:
opts: Options

Options interface

j: {None} | int

Phase index

Outputs:
rname: str

Project root name

Versions:
  • 2015-10-18 @ddalle: v1.0

  • 2023-05-13 @ddalle: v2.0; use OptionsDict

get_raw_grid()

Return the raw_grid namelist

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

Options interface

Outputs:
d: pyFun.options.odict

Grid namelist

Versions:
  • 2015-10-18 @ddalle: v1.0

  • 2023-05-13 @ddalle: v2.0; use OptionsDict

select_namelist(j=0, **kw)

Sample namelist at particular conditions

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

Options interface

j: {0} | int

Phase index

Outputs:
d: dict

Namelist sampled for phase and case indices

Versions:
  • 2015-10-18 @ddalle: v1.0

  • 2023-05-16 @ddalle: v2.0; OptionsDict tools

set_namelist_var(sec, key, val, j=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: Options

Options interface

sec: str

Section name

key: str

Variable name

val: int | float | str | list

Value from JSON options

j: {None} | int

Phase index

Versions:
  • 2017-04-05 @ddalle: v1.0