cape.namelist: FUN3D namelist module¶
This is a module built off of the cape.filecntl.namelist module
customized for manipulating FUN3D’s namelist files. Such files are
split into sections which are called “name lists.” Each name list has
syntax similar to the following.
&project project_rootname = "pyfun" case_title = "Test case" /
and this module is designed to recognize such sections. The main feature of this module is methods to set specific properties of a namelist file, for example the Mach number or CFL number.
Namelists are the primary FUN3D input file, and one is written for each
phase of a FUN3D case. The namelist files prepared using this module
are written to fun3d.00.nml, fun3d.01.nml, etc. These must be
linked to a hard-coded file name fun3d.nml as appropriate for the
currently running phase.
This function provides a class cape.filecntl.namelist.Namelist
that can both read and set values in the namelist. The key functions
are
Namelist.SetVar()
Namelist.GetVar()
The conversion from namelist text to Python is handled by
Namelist.ConvertToText(), and the reverse is handled by
Namelist.ConvertToVal(). Conversions cannot quite be performed
just by the Python functions print() and eval() because
delimiters are not used in the same fashion. Some of the conversions
are tabulated below.
Namelist
Python
val = "text"
val = "text"
val = 'text'
val = 'text'
val = 3
val = 3
val = 3.1
val = 3.1
val = .false.
val = False
val = .true.
val = True
val = .f.
val = False
val = .t.
val = True
val = 10.0 20.0
val = [10.0, 20.0]
val = 1, 100
val = [1, 100]
val(1) = 1.2
val = [1.2, 1.5]
val(2) = 1.5
val = _mach_
val = "_mach_"
In most cases, the Namelist 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.
There is also a function Namelist.ReturnDict() to access the
entire namelist as a dict. Similarly,
Namelist.ApplyDict() can be used to apply multiple settings using
a dict as input.
See also:
pyFun.case.GetNamelist()
- class cape.pyfun.namelist.Namelist(fname='fun3d.nml')¶
File control class for
fun3d.nmlThis class is derived from the
pyCart.fileCntl.FileCntlclass, so all methods applicable to that class can also be used for instances of this class.- Call:
>>> nml = pyFun.Namelist() >>> nml = pyfun.Namelist(fname)
- Inputs:
- fname:
str Name of namelist file to read, defaults to
'fun3d.nml'
- fname:
- Version:
2015-10-15
@ddalle: Started
- GetAdaptRootname()¶
Get the post-adaptation project root name
- Call:
>>> name = nml.GetAdaptRootname()
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml
- nml:
- Outputs:
- name:
str Name of adapted project
- name:
- Versions:
2015-12-31
@ddalle: First version
- GetGridFormat()¶
Get the mesh file extention
- Call:
>>> fext = nml.GetGridFormat()
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml
- nml:
- Outputs:
- fext: {
"b8.ugrid"} |str Mesh file extension
- fext: {
- Versions:
2016-04-05
@ddalle: First version
- GetMach()¶
Find the current Mach number
- Call:
>>> mach = nml.GetMach()
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml
- nml:
- Outputs:
- M:
float(orstr) Mach number specified in
input.cntl
- M:
- Versions:
2014-06-10
@ddalle: First version
- GetNFlowInitVolumes()¶
Get the current number of flow initialization volumes
- Call:
>>> n = nml.GetNFlowInitVolumes()
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml
- nml:
- Outputs:
- n:
int Number of flow initialization volumes
- n:
- Versions:
2016-03-29
@ddalle: First version
- GetRootname()¶
Get the project root name
- Call:
>>> name = nml.GetRootname()
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml
- nml:
- Outputs:
- name:
str Name of project
- name:
- Versions:
2015-10-18
@ddalle: First version
- SetAdaptRootname(name)¶
Set the post-adaptation project root name
- Call:
>>> nml.SetAdaptRootname(name)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- name:
str Name of adapted project
- nml:
- Versions:
2015-12-31
@ddalle: First version
- SetAlpha(alpha)¶
Set the angle of attack
- Call:
>>> nml.SetAlpha(alpha)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- alpha:
float Angle of attack
- nml:
- Versions:
2015-10-15
@ddalle: First version
- SetBeta(beta)¶
Set the sideslip angle
- Call:
>>> nml.SetBeta(beta)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- beta:
float Sideslip angle
- nml:
- Versions:
2014-06-04
@ddalle: First version
- SetDensity(rho)¶
Set the freestream density
- Call:
>>> nml.SetDensity(rho)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- rho:
float Freestream density [kg/m^3]
- nml:
- Versions:
2018-04-19
@ddalle: First version
- SetMach(mach)¶
Set the freestream Mach number
- Call:
>>> nml.SetMach(mach)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- mach:
float Mach number
- nml:
- Versions:
2015-10-15
@ddalle: First version
- SetNFlowInitVolumes(n)¶
Set the number of flow initialization volumes
- Call:
>>> nml.SetNFlowInitVolumes(n)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- n:
int Number of flow initialization volumes
- nml:
- Versions:
2016-03-29
@ddalle: First version
- SetRestart(q=True, nohist=False)¶
Set the FUN3D restart flag on or off
- Call:
>>> nml.SetRestart(q=True, nohist=False)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- q: {
True} |False|None Restart option,
Noneturns flag to"on"- nohist:
True| {False} If true, use ‘on_nohistorykept’ for ‘restart_read’
- nml:
- Versions:
2015-11-03
@ddalle: First version
- SetReynoldsNumber(Re)¶
Set the Reynolds number per unit length
- Call:
>>> nml.SetReynoldsNumber(Re)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- Re:
float Reynolds number per unit length
- nml:
- Versions:
2015-10-15
@ddalle: First version
- SetRootname(name)¶
Set the project root name
- Call:
>>> nml.SetRootname(name)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- name:
str Name of project
- nml:
- Versions:
2015-12-31
@ddalle: First version
- SetTemperature(T)¶
Set the freestream temperature
- Call:
>>> nml.SetTemperature(T)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- T:
float Freestream temperature
- nml:
- Versions:
2015-10-15
@ddalle: First version
- SetTemperatureUnits(units=None)¶
Set the temperature units
- Call:
>>> nml.SetTemperatureUnits(units)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- units:
str Units, defaults to
"Rankine"
- nml:
- Versions:
2015-10-15
@ddalle: First version
- SetVelocity(V)¶
Set the freestream velocity magnitude
- Call:
>>> nml.SetTemperature(T)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- V:
float Magnitude of freestream velocity [m/s]
- nml:
- Versions:
2018-04-19
@ddalle: First version
- SetnIter(nIter)¶
Set the number of iterations
- Call:
>>> nml.SetnIter(nIter)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- nIter:
int Number of iterations to run
- nml:
- Versions:
2015-10-20
@ddalle: First version
- find_comp_index(comp)¶
Find index of a component_name in component_parameters
- Call:
>>> icomp = nml.find_comp_index(comp)
- Inputs:
- nml:
pyFun.namelist.Namelist File control instance for
fun3d.nml- comp:
str Name of component
- nml:
- Outputs:
- icomp:
int> 0 |None Index of component w/ matching name, if any
- icomp:
- Versions:
2023-02-03
@ddalle: v1.0