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 “name lists.” 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.
The difference between this module and cape.filecntl.namelist.Namelist
is that
this module can support multiple namelists with the same title. This is
particularly important for Overflow, which has GRDNAM
, BCINP
, and other
sections defined for each structured grid. These modules should be combined as
the differing namelist syntaxes are actually part of one file convention.
This function provides a class pyOver.overNamelist.OverNamelist
that
can both read and set values in the namelist. The key functions are
OverNamelist.GetKeyFromGroupName()
OverNamelist.GetKeyFromGroupIndex()
OverNamelist.SetKeyInGroupName()
OverNamelist.SetKeyInGroupIndex()
For rules on converting Fortran namelist text to and from Python syntax, see
cape.filecntl.namelist
.
In most cases, the OverNamelist
will try to interpret invalid values
for any namelist entry as a string with missing quotes. The reason for this is
that users often create template namelist with entries like _mach_
that can
be safely replaced with appropriate values using sed
commands or something
similar.
See also:
- class cape.pyover.overNamelist.OverNamelist(fname='over.namelist')¶
File control class for
over.namelist
This class is derived from the
pyCart.fileCntl.FileCntl
class, so all methods applicable to that class can also be used for instances of this class.- Call:
>>> nml = pyOver.Namelist2() >>> nml = pyOver.Namelist2(fname)
- Inputs:
- fname:
str
Name of namelist file to read, defaults to
'over.namelist'
- fname:
- Outputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Version:
2016-01-31
@ddalle
: First version
- ApplyDictToALL(opts)¶
Apply a dictionary of settings to all grids
- Call:
>>> nml.ApplyDictToALL(opts)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- opts:
dict
Dictionary of options to apply
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- ApplyDictToGrid(grdnam, opts)¶
Apply a dictionary of settings to a grid
- Call:
>>> nml.ApplyDictToGrid(grdnam, opts)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- grdnam:
str
|int
Grid name or index
- opts:
dict
Dictionary of options to apply
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- GetAlpha()¶
Return the angle of attack
- Call:
>>> alpha = nml.GetAlpha()
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Outputs:
- alpha:
float
Angle of attack
- alpha:
- Versions:
2016-02-01
@ddalle
: First version
- GetBeta()¶
Get the sideslip angle
- Call:
>>> beta = nml.GetBeta()
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Outputs:
- beta:
float
Sideslip angle
- beta:
- Versions:
2016-02-01
@ddalle
: First version
- GetFLOINP(key)¶
Return value of key from the $FLOINP group
- Call:
>>> val = nml.GetFLOINP(key)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- key:
str
Name of field to query
- nml:
- Outputs:
- val:
float
|list
Value of field key in group
"FLOINP"
- val:
- Versions:
2016-02-01
@ddalle
- GetGLOBAL(key)¶
Return value of key from the $GLOBAL group
- Call:
>>> val = nml.GetGLOBAL(key)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- key:
str
Name of field to query
- nml:
- Outputs:
- val:
int
|bool
|list
Value of field key in group
"GLOBAL"
- val:
- Versions:
2016-02-01
@ddalle
- GetGridNames()¶
Get the list of grid names in an OVERFLOW namelist
- Call:
>>> nml.GetGridNames()
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Versions:
2016-01-31
@ddalle
: First version
- GetGridNumber(grdnam)¶
Get the number of a grid from its name
- Call:
>>> i = nml.GetGridNumberByName(grdnam)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- grdnam:
str
Name of the grid
- nml:
- Outputs:
- i:
int
Grid number
- i:
- Versions:
2016-01-31
@ddalle
: First version
- GetGridNumberByName(grdnam)¶
Get the number of a grid from its name
- Call:
>>> i = nml.GetGridNumberByName(grdnam)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- grdnam:
str
Name of the grid
- nml:
- Outputs:
- i:
int
Grid number
- i:
- Versions:
2016-01-31
@ddalle
: First version
- GetGroupIndexByGridName(grdnam)¶
Get the indices of the first and last list in a grid by name
- Call:
>>> jbeg, jend = nml.GetGroupIndexByGridName(grdnam)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- grdnam:
str
Name of the grid
- nml:
- Outputs:
- jbeg:
int
Index of first list in the grid definition
- jend:
int
Index of last list in the grid definition
- jbeg:
- Versions:
2016-01-31
@ddalle
: First version
- GetGroupNamesByGridName(grdnam)¶
Get the list names in a grid definition
- Call:
>>> grps = nml.GetGroupNamesByGridName(grdnam)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- grdnam:
str
Name of the grid
- nml:
- Outputs:
- grps:
list
[str
] List of group names in the grid grdnam definition
- grps:
- Versions:
2016-01-31
@ddalle
: First version
- 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:
pyOver.overNamelist.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)”
- nml:
- Outputs:
- val:
str
|int
|float
|bool
Value from the namelist
- val:
- Versions:
2016-02-01
@ddalle
: First version2016-08-29
@ddalle
: Added namelist indices
- GetMach()¶
Find the current Mach number
- Call:
>>> mach = nml.GetMach()
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Outputs:
- M:
float
(orstr
) Mach number specified in
input.cntl
- M:
- Versions:
2016-02-01
@ddalle
: First version
- GetRestart()¶
Get the current restart flag
- Call:
>>> q = nml.GetRestart()
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Outputs:
- q:
bool
Whether or not to run as a restart
- q:
- Versions:
2016-02-01
@ddalle
: First version
- GetReynoldsNumber()¶
Get the Reynolds number per unit length
- Call:
>>> Re = nml.GetReynoldsNumber()
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Outputs:
- Re:
float
Reynolds number per unit length
- Re:
- Versions:
2016-02-01
@ddalle
: First version
- GetTemperature()¶
Get the freestream temperature
- Call:
>>> T = nml.GetTemperature()
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Outputs:
- T:
float
Freestream temperature
- T:
- Versions:
2016-02-01
@ddalle
: First version
- GetnIter()¶
Get the number of iterations
- Call:
>>> nIter = nml.GetnIter()
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nml:
- Outputs:
- nIter:
int
Number of iterations to run
- nIter:
- Versions:
2016-02-01
@ddalle
: First version
- SetAlpha(alpha)¶
Set the angle of attack
- Call:
>>> nml.SetAlpha(alpha)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- alpha:
float
Angle of attack
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- SetBeta(beta)¶
Set the sideslip angle
- Call:
>>> nml.SetBeta(beta)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- beta:
float
Sideslip angle
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- SetFLOINP(key, val)¶
Set the value of key in the $FLOINP group
- Call:
>>> nml.SetFLOINP(key, val)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- key:
str
Name of field to query
- val:
float
|list
Value of field key in group
"FLOINP"
- nml:
- Versions:
2016-02-01
@ddalle
- SetGLOBAL(key, val)¶
Set value of key from the $GLOBAL group
- Call:
>>> nml.GetGLOBAL(key, val)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- key:
str
Name of field to query
- val:
int
|bool
|list
Value of field key in group
"GLOBAL"
- nml:
- 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:
pyOver.overNamelist.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)”
- nml:
- Versions:
2016-02-01
@ddalle
: First version2016-08-29
@ddalle
: Added namelist indices
- SetMach(mach)¶
Set the freestream Mach number
- Call:
>>> nml.SetMach(mach)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- mach:
float
Mach number
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- SetRestart(q=True)¶
Set or unset restart flag
- Call:
>>> nml.SetRestart(q=True)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- q:
bool
Whether or not to run as a restart
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- SetReynoldsNumber(Re)¶
Set the Reynolds number per unit length
- Call:
>>> nml.SetReynoldsNumber(Re)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- Re:
float
Reynolds number per unit length
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- SetTemperature(T)¶
Set the freestream temperature
- Call:
>>> nml.SetTemperature(T)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- T:
float
Freestream temperature
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- SetnIter(nIter)¶
Set the number of iterations
- Call:
>>> nml.SetnIter(nIter)
- Inputs:
- nml:
pyOver.overNamelist.OverNamelist
Interface to OVERFLOW input namelist
- nIter:
int
Number of iterations to run
- nml:
- Versions:
2016-02-01
@ddalle
: First version
- 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:
pyOver.overNamelist.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
- nml:
- Versions:
2016-12-30
@ddalle
: First version
- 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
- a:
- Outputs:
- q:
True
|False
Whether or not a > b
- q:
- Versions:
2016-12-30
@ddalle
: First version
- 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
- a:
- Outputs:
- q:
True
|False
Whether or not a > b
- q:
- Versions:
2016-12-30
@ddalle
: First version
- 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
- a:
- Outputs:
- q:
True
|False
Whether or not a > b
- q:
- Versions:
2016-12-30
@ddalle
: First version
- 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
- a:
- Outputs:
- q:
True
|False
Whether or not a > b
- q:
- Versions:
2016-12-30
@ddalle
: First version
- 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
- a:
- Outputs:
- c:
int
|float
Either a or b depending on which is greater
- c:
- Versions:
2016-12-30
@ddalle
: First version
- 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
- a:
- Outputs:
- c:
int
|float
Either a or b depending on which is greater
- c:
- Versions:
2016-12-30
@ddalle
: First version