cape.pyover.overNamelist: OVERFLOW namelist module

cape.pyover.overNamelist: OVERFLOW namelist module

This is a module built off of the cape.filecntl.FileCntl module customized for manipulating Fortran namelists and customized for the OVERFLOW input file overflow.inp. Such files are split into sections which are called “namelists.” Each name list has syntax similar to the following.

$FLOINP
    FSMACH = 4.0,
    ALPHA = 1.0,
    BETA = 0.0,
    $END

The main feature of this module is methods to set specific properties of a namelist file, for example the Mach number or CFL number.

See also:

class cape.pyover.overNamelist.OverNamelist(fname='over.namelist')

File control class for over.namelist

Call:
>>> nml = OverNamelist(fname="over.namelist")
Inputs:
fname: {"over.namelist"} | str

Name of namelist file to read

Outputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Version:
  • 2016-01-31 @ddalle: v1.0

ApplyDictToALL(opts)

Apply a dictionary of settings to all grids

Call:
>>> nml.ApplyDictToALL(opts)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

opts: dict

Dictionary of options to apply

Versions:
  • 2016-02-01 @ddalle: v1.0

ApplyDictToGrid(grdnam, opts)

Apply a dictionary of settings to a grid

Call:
>>> nml.ApplyDictToGrid(grdnam, opts)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

grdnam: str | int

Grid name or index

opts: dict

Dictionary of options to apply

Versions:
  • 2016-02-01 @ddalle: v1.0

GetAlpha()

Return the angle of attack

Call:
>>> alpha = nml.GetAlpha()
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Outputs:
alpha: float

Angle of attack

Versions:
  • 2016-02-01 @ddalle: v1.0

GetBeta()

Get the sideslip angle

Call:
>>> beta = nml.GetBeta()
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Outputs:
beta: float

Sideslip angle

Versions:
  • 2016-02-01 @ddalle: v1.0

GetFLOINP(key)

Return value of key from the $FLOINP group

Call:
>>> val = nml.GetFLOINP(key)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

key: str

Name of field to query

Outputs:
val: float | list

Value of field key in group "FLOINP"

Versions:
  • 2016-02-01 @ddalle

GetGLOBAL(key)

Return value of key from the $GLOBAL group

Call:
>>> val = nml.GetGLOBAL(key)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

key: str

Name of field to query

Outputs:
val: int | bool | list

Value of field key in group "GLOBAL"

Versions:
  • 2016-02-01 @ddalle

GetGridNames()

Get the list of grid names in an OVERFLOW namelist

Call:
>>> nml.GetGridNames()
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Versions:
  • 2016-01-31 @ddalle: v1.0

GetGridNumber(grdnam)

Get the number of a grid from its name

Call:
>>> i = nml.GetGridNumberByName(grdnam)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

grdnam: str

Name of the grid

Outputs:
i: int

Grid number

Versions:
  • 2016-01-31 @ddalle: v1.0

GetGridNumberByName(grdnam)

Get the number of a grid from its name

Call:
>>> i = nml.GetGridNumberByName(grdnam)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

grdnam: str

Name of the grid

Outputs:
i: int

Grid number

Versions:
  • 2016-01-31 @ddalle: v1.0

GetGroupIndexByGridName(grdnam)

Get the indices of the first and last list in a grid by name

Call:
>>> jbeg, jend = nml.GetGroupIndexByGridName(grdnam)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

grdnam: str

Name of the grid

Outputs:
jbeg: int

Index of first list in the grid definition

jend: int

Index of last list in the grid definition

Versions:
  • 2016-01-31 @ddalle: v1.0

GetGroupNamesByGridName(grdnam)

Get the list names in a grid definition

Call:
>>> grps = nml.GetGroupNamesByGridName(grdnam)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

grdnam: str

Name of the grid

Outputs:
grps: list[str]

List of group names in the grid grdnam definition

Versions:
  • 2016-01-31 @ddalle: v1.0

GetKeyFromGrid(grdnam, grp, key, i=None)

Get the value of a key for a grid with a specific name

This function uses fall-through, so if a setting is not explicitly defined for grid grdnam, it will check the preceding grid, and the grid before that, etc.

Call:
>>> val = nml.GetKeyFromGrid(grdnam, grp, key, i=None)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

grdnam: str

Name of the grid

grp: str

Name of the namelist group of key to query

key: str

Name of the key to query

i: {None} | ':' | int

Index to use in the namelist, e.g. “BCPAR(i)”

Outputs:
val: str | int | float | bool

Value from the namelist

Versions:
  • 2016-02-01 @ddalle: v1.0

  • 2016-08-29 @ddalle: Added namelist indices

GetMach()

Find the current Mach number

Call:
>>> mach = nml.GetMach()
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Outputs:
M: float (or str)

Mach number specified in input.cntl

Versions:
  • 2016-02-01 @ddalle: v1.0

GetRestart()

Get the current restart flag

Call:
>>> q = nml.GetRestart()
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Outputs:
q: bool

Whether or not to run as a restart

Versions:
  • 2016-02-01 @ddalle: v1.0

GetReynoldsNumber()

Get the Reynolds number per unit length

Call:
>>> Re = nml.GetReynoldsNumber()
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Outputs:
Re: float

Reynolds number per unit length

Versions:
  • 2016-02-01 @ddalle: v1.0

GetTemperature()

Get the freestream temperature

Call:
>>> T = nml.GetTemperature()
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Outputs:
T: float

Freestream temperature

Versions:
  • 2016-02-01 @ddalle: v1.0

GetnIter()

Get the number of iterations

Call:
>>> nIter = nml.GetnIter()
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Outputs:
nIter: int

Number of iterations to run

Versions:
  • 2016-02-01 @ddalle: v1.0

SetAlpha(alpha)

Set the angle of attack

Call:
>>> nml.SetAlpha(alpha)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

alpha: float

Angle of attack

Versions:
  • 2016-02-01 @ddalle: v1.0

SetBeta(beta)

Set the sideslip angle

Call:
>>> nml.SetBeta(beta)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

beta: float

Sideslip angle

Versions:
  • 2016-02-01 @ddalle: v1.0

SetFLOINP(key, val)

Set the value of key in the $FLOINP group

Call:
>>> nml.SetFLOINP(key, val)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

key: str

Name of field to query

val: float | list

Value of field key in group "FLOINP"

Versions:
  • 2016-02-01 @ddalle

SetGLOBAL(key, val)

Set value of key from the $GLOBAL group

Call:
>>> nml.GetGLOBAL(key, val)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

key: str

Name of field to query

val: int | bool | list

Value of field key in group "GLOBAL"

Versions:
  • 2016-02-01 @ddalle

SetKeyForGrid(grdnam, grp, key, val, i=None)

Set the value of a key for a grid with a specific name

Call:
>>> nml.SetKeyForGrid(grdnam, grp, key, val, i=None)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

grdnam: str | int

Name or number of the grid

grp: str

Name of the namelist group

key: str

Name of the key to set

val: str | float | bool | …

Value to set the key to

i: {None} | ':' | int

Index to use in the namelist, e.g. “BCPAR(i)”

Versions:
  • 2016-02-01 @ddalle: v1.0

  • 2016-08-29 @ddalle: Added namelist indices

SetMach(mach)

Set the freestream Mach number

Call:
>>> nml.SetMach(mach)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

mach: float

Mach number

Versions:
  • 2016-02-01 @ddalle: v1.0

SetRestart(q=True)

Set or unset restart flag

Call:
>>> nml.SetRestart(q=True)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

q: bool

Whether or not to run as a restart

Versions:
  • 2016-02-01 @ddalle: v1.0

SetReynoldsNumber(Re)

Set the Reynolds number per unit length

Call:
>>> nml.SetReynoldsNumber(Re)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

Re: float

Reynolds number per unit length

Versions:
  • 2016-02-01 @ddalle: v1.0

SetTemperature(T)

Set the freestream temperature

Call:
>>> nml.SetTemperature(T)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

T: float

Freestream temperature

Versions:
  • 2016-02-01 @ddalle: v1.0

SetnIter(nIter)

Set the number of iterations

Call:
>>> nml.SetnIter(nIter)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

nIter: int

Number of iterations to run

Versions:
  • 2016-02-01 @ddalle: v1.0

WriteSplitmqI(fname='splitmq.i', **kw)

Write a splitmq.i file to extract surface and second layer

Call:
>>> nml.WriteSplitmqI(fname="splitmq.i", **kw)
Inputs:
nml: OverNamelist

Interface to OVERFLOW input namelist

fname: {"splitmq.i"} | str

Name of splitmq input file to write

qin, i: {"q.p3d"} | str

Name of the input OVERFLOW solution file

qout, o: {"q.save"} | str

Name of output OVERFLOW file for second line of “splitmq.i”

wall: {True} | False

Only include walls if True; else include thrust BCs

Versions:
  • 2016-12-30 @ddalle: v1.0

cape.pyover.overNamelist.gteqi(a, b)

Altered greater-than-or-equal-to test for Fortran array indices

Negative indices are always considered to be greater than positive ones, and negative indices closer to zero are the largest. The general pattern is 1 < 2 < 20 < -20 < -1, and -1 is the maximum possible value.

Call:
>>> q = gteqi(a, b)
Inputs:
a: int | float

First test value

b: int | float

Second test value

Outputs:
q: True | False

Whether or not a > b

Versions:
  • 2016-12-30 @ddalle: v1.0

cape.pyover.overNamelist.gti(a, b)

Altered greater-than test for Fortran array indices

Negative indices are always considered to be greater than positive ones, and negative indices closer to zero are the largest. The general pattern is 1 < 2 < 20 < -20 < -1, and -1 is the maximum possible value.

Call:
>>> q = gti(a, b)
Inputs:
a: int | float

First test value

b: int | float

Second test value

Outputs:
q: True | False

Whether or not a > b

Versions:
  • 2016-12-30 @ddalle: v1.0

cape.pyover.overNamelist.lteqi(a, b)

Altered less-than-or-equal-to test for Fortran array indices

Negative indices are always considered to be greater than positive ones, and negative indices closer to zero are the largest. The general pattern is 1 < 2 < 20 < -20 < -1, and -1 is the maximum possible value.

Call:
>>> q = lteqi(a, b)
Inputs:
a: int | float

First test value

b: int | float

Second test value

Outputs:
q: True | False

Whether or not a > b

Versions:
  • 2016-12-30 @ddalle: v1.0

cape.pyover.overNamelist.lti(a, b)

Altered less-than test for Fortran array indices

Negative indices are always considered to be greater than positive ones, and negative indices closer to zero are the largest. The general pattern is 1 < 2 < 20 < -20 < -1, and -1 is the maximum possible value.

Call:
>>> q = lti(a, b)
Inputs:
a: int | float

First test value

b: int | float

Second test value

Outputs:
q: True | False

Whether or not a > b

Versions:
  • 2016-12-30 @ddalle: v1.0

cape.pyover.overNamelist.maxi(a, b)

Altered maximum function for array indices

Negative indices are always considered to be greater than positive ones, and negative indices closer to zero are the largest. The general pattern is 1 < 2 < 20 < -20 < -1, and -1 is the maximum possible value.

Call:
>>> c = maxi(a, b)
Inputs:
a: int | float

First test value

b: int | float

Second test value

Outputs:
c: int | float

Either a or b depending on which is greater

Versions:
  • 2016-12-30 @ddalle: v1.0

cape.pyover.overNamelist.mini(a, b)

Altered minimum function for array indices

Negative indices are always considered to be greater than positive ones, and negative indices closer to zero are the largest. The general pattern is 1 < 2 < 20 < -20 < -1, and -1 is the maximum possible value.

Call:
>>> c = maxi(a, b)
Inputs:
a: int | float

First test value

b: int | float

Second test value

Outputs:
c: int | float

Either a or b depending on which is greater

Versions:
  • 2016-12-30 @ddalle: v1.0