cape.pycart.inputCntl
: Cart3D input.cntl
interface¶
This is a module built off of the cape.filecntl
module customized for
manipulating input.cntl
files. Such files are split into section by
lines of the format
$__Post_Processing
and this module is designed to recognize such sections. The main feature of
this module is methods to set specific properties of the input.cntl
file, for example the Mach number or CFL number.
The class for these files, pyCart.inputCntl.InputCntl
, has methods
that can be divided into several categories:
Methods to access or set flight conditions (such as Mach number)
Methods to alter the Runge-Kutta or other aspects of Cart3D operation
Methods to set boundary conditions
Methods to specify post-processing options for Cart3D
Tools inherited from the file control class
- See Also:
- class cape.pycart.inputCntl.InputCntl(fname='input.cntl')¶
File control class for
input.cntl
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:
>>> IC = pyCart.InputCntl() >>> IC = pyCart.InputCntl(fname)
- Inputs:
- fname:
str
Name of CNTL file to read, defaults to
'input.cntl'
- fname:
- Outputs:
- IC:
pyCart.inputCntl.InputCntl
Interface to
input.cntl
and its settings- IC.fname:
str
Name of the file that was read
- IC.lines:
list
[str
] List of lines, which may be altered
- IC.SectionNames:
list
[str
] List of section names
- IC.Section:
dict
(list
) Lines split into sections by section name
- IC:
- Version:
2014-06-04
@ddalle
: v1.0
- AddLineSensor(name, X)¶
Write a line sensor
- Call:
>>> IC.AddLineSensor(name, X)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- name:
str
Name of the line sensor
- X:
list
[float
] List of start x,y,z and end x,y,z
- IC:
- Versions:
2015-05-06
@ddalle
: v1.0
- AddPointSensor(name, X)¶
Write a point sensor
- Call:
>>> IC.AddPointSensor(name, X)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- name:
str
Name of the line sensor
- X:
list
[float
] List of point x,y,z coordinates
- IC:
- Versions:
2015-05-07
@ddalle
: v1.0
- Copy(fname)¶
Copy a file interface
- Call:
>>> IC2 = IC.Copy()
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- IC:
- Outputs:
- IC2:
pyCart.inputCntl.InputCntl
Duplicate file control instance for
input.cntl
- IC2:
- Versions:
2015-06-12
@ddalle
: v1.0
- GetAlpha()¶
Return the current angle of attack
- Call:
>>> alpha = IC.GetAlpha()
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- IC:
- Outputs:
- alpha:
float
Angle of attack
- alpha:
- Versions:
2016-01-26
@ddalle
: v1.0
- GetBeta()¶
Return the current angle of sideslip
- Call:
>>> beta = IC.GetBeta()
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- IC:
- Outputs:
- beta:
float
Angle of sideslip
- beta:
- Versions:
2016-01-26
@ddalle
: v1.0
- GetLineSensor(name)¶
Get the coordinates for a line sensor
- Call:
>>> X = IC.GetLineSensor(name)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- name:
str
Name of the line sensor
- IC:
- Outputs:
- X:
list
[float
] List of start x,y,z and end x,y,z
- X:
- Versions:
2015-12-04
@ddalle
: v1.0
- GetMach()¶
Find the current Mach number
- Call:
>>> M = IC.GetMach()
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- IC:
- Outputs:
- M:
float
(orstr
) Mach number specified in
input.cntl
- M:
- Versions:
2014-06-10
@ddalle
: v1.0
- GetPointSensor(name)¶
Get the coordinates for a point sensor
- Call:
>>> X = IC.GetPointSensor(name)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- name:
str
Name of the line sensor
- IC:
- Outputs:
- X:
list
[float
] List of point x,y,z coordinates
- X:
- Versions:
2015-12-04
@ddalle
: v1.0
- GetSingleMomentPoint(compID='all')¶
Get the moment reference point of a component in
input.cntl
- Call:
>>> x = IC.GetSingleMomentPoint(compID)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- compID:
str
Component to which reference applies (default is
'all'
)
- IC:
- Outputs:
- x:
list
[float
] List of three coordinates of moment reference point
- x:
- Versions:
2015-03-02
@ddalle
: v1.0
- RequestForce(comps)¶
Request the force coefficients on a component or list of components
- Call:
>>> IC.RequestForce(comps)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- comps:
str
|int
|list
Name of component to log or
"all"
or"entire"
- IC:
- Effects:
Adds a line to
input.cntl
that looks like “Force entire”, if it is not already present for each entry in comps- Versions:
2014-12-08
@ddalle
: v1.0
- RequestMoment(compID, MRP=None)¶
Request the moment coefficients on a particular component.
- Call:
>>> IC.RequestMoment(compID, MRP)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- compID:
str
orint
Name of component to log or
"all"
or"entire"
- MRP: array_like
Reference point (defaults to
[0,0,0]
)
- IC:
- Effects:
Adds a line to
input.cntl
that tells Cart3D to calculate the moment coefficients using a specific reference point.- Versions:
2014-06-09
@ddalle
: v1.0
- RequestSingleForce(compID)¶
Request the force coefficients on a particular component
- Call:
>>> IC.RequestSingleForce(compID)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- compID:
str
orint
Name of component to log or
"all"
or"entire"
- IC:
- Effects:
Adds a line to
input.cntl
that looks like “Force entire”, if it is not already present.- Versions:
2014-06-09
@ddalle
: v1.02014-12-08
@ddalle
: Renamed from RequestForce
- SetAlpha(alpha)¶
Set the angle of attack
- Call:
>>> IC.SetAlpha(alpha)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- alpha:
float
Angle of attack
- IC:
- Effects:
Replaces or adds a line to the “Case_Information” section.
- Versions:
2014-06-04
@ddalle
: v1.0
- SetBeta(beta)¶
Set the sideslip angle
- Call:
>>> IC.SetBeta(beta)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- beta:
float
Sideslip angle
- IC:
- Effects:
Replaces or adds a line to the “Case_Information” section.
- Versions:
2014-06-04
@ddalle
: v1.0
- SetCFL(CFL)¶
Set the CFL number
- Call:
>>> IC.SetCFL(CFL)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- CFL:
float
Value of the CFL number to use
- IC:
- Effects:
Replaces or adds a line to the “Solver_Control_Information” section
- Versions:
2014-06-10
@ddalle
: v1.0
- SetFirstOrder()¶
Set the solver to first-order mode
- Call:
>>> IC.SetFirstOrder()
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- IC:
- Effects:
Sets the gradient evaluation to
0
for the first RK line- Versions:
2014-06-17
@ddalle
: v1.0
- SetLineSensors(LS)¶
Write all line sensors
- Call:
>>> IC.SetLineSensors(LS)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- LS:
dict
Dictionary of line sensors
- IC:
- Versions:
2015-05-06
@ddalle
: v1.0
- SetMach(Mach)¶
Set the freestream Mach number
- Call:
>>> IC.SetMach(Mach)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- Mach:
float
Mach number
- IC:
- Effects:
Replaces or adds a line to the “Case_Information” section.
- Versions:
2014-06-04
@ddalle
: v1.0
- SetMomentPoint(xMRP, comps=None)¶
Set all moment reference points according to an input
dict
- Call:
>>> IC.SetMomentPoint(xMRP, comps=None)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- xMRP:
dict
[list
|list
Dictionary of reference points by compor universal MRP
- comps: {
None
} |list
[str
] Optional list of comps when xMRP not
dict
- IC:
- Versions:
2014-10-08
@ddalle
: v1.02023-03-22
@ddalle
: v2.0; avoidall
, add comps
- SetNOrders(nOrders)¶
Set the early termination criterion in number of orders of magnitude decrease in the global L1 residual
- Call:
>>> IC.SetNOrders(nOrders)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- nOrders:
int
Number of orders of convergence at which to terminate early
- IC:
- Effects:
Replaces a line in “Convergence_History_reporting”
- Versions:
2014-12-12
@ddalle
: v1.0
- SetOutputForce(Name, **kwargs)¶
Request a force be added to the output functional
- Call:
>>> IC.SetOutputForce(Name, **kwargs)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- Name:
str
Name of the force (required)
- force:
int
[ {0} | 1 | 2 | None] Force axis, e.g.
0
for axial force. IfForce=None
, this force is not used in the output.- frame:
int
[ {0} | 1 ] Body frame (
0
) or velocity frame (1
)- weight:
float
[ {1.0} |float
] Linear weight on term in overall functional
- compID:
str
[ {entire} |str
|int
] Component to use for calculating the force
- J:
int
[ {0} | 1 ] Modifier of force, not normally used
- N:
int
[ {1} |int
] Exponent on force coefficient
- target:
float
[ {0.0} |float
] Target value for the functional; irrelevant if N=1
- IC:
- Versions:
2014-11-19
@ddalle
: v1.0
- SetOutputMoment(Name, **kwargs)¶
Request a force be added to the output functional
- Call:
>>> IC.SetOutputMoment(Name, **kwargs)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- Name:
str
Name of the force (required)
- index:
int
[ {0} |int
] Index of which MRP to use for named component
- moment:
int
[ {0} | 1 | 2 | None] Force axis, e.g.
0
for axial force. Ifmoment=None
, this component is not used in the output.- frame:
int
[ {0} | 1 ] Body frame (
0
) or velocity frame (1
)- weight:
float
[ {1.0} |float
] Linear weight on term in overall functional
- compID:
str
[ {entire} |str
|int
] Component to use for calculating the force
- J:
int
[ {0} | 1 ] Modifier of force, not normally used
- N:
int
[ {1} |int
] Exponent on force coefficient
- target:
float
[ {0.0} |float
] Target value for the functional; irrelevant if N=1
- IC:
- Versions:
2014-11-19
@ddalle
: v1.0
- SetOutputSensor(Name, **kwargs)¶
Request a line or point sensor
- Call:
>>> IC.SetOutputSensor(Name, **kwargs)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- Name:
str
Name of the sensor (required)
- J:
int
[ {0} | 1 ] Modifier of sensor, not normally used
- N:
int
[ {2} |int
] Exponent on sensor, usually 2 for line sensors
- target:
float
[ {0.0} |float
] Target value for the functional
- IC:
- Versions:
2015-05-06
@ddalle
: v1.0
- SetPointSensors(PS)¶
Write all point sensors
- Call:
>>> IC.SetPointSensors(PS)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- PS:
dict
Dictionary of point sensors
- IC:
- Versions:
2015-05-07
@ddalle
: v1.0
- SetReferenceArea(A)¶
Set all moment reference points according to an input
dict
- Call:
>>> IC.SetReferenceArea(A)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- A:
dict`(:class:`float
) orfloat
Dictionary of reference areas by component or universal ARef
- IC:
- Versions:
2014-10-08
@ddalle
: v1.0
- SetReferenceLength(L)¶
Set all moment reference points according to an input
dict
- Call:
>>> IC.SetReferenceLength(L)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- L:
dict`(:class:`float
) orfloat
Dictionary of reference length by component or universal LRef
- IC:
- Versions:
2014-10-08
@ddalle
: v1.0
- SetRobustMode()¶
Set gradient flag in all stages
- Call:
>>> IC.SetRobustMode()
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- IC:
- Effects:
Sets the gradient evaluation to
1
for each RK line- Versions:
2014-11-21
@ddalle
: v1.0
- SetRungeKutta(RK)¶
Set the Runge-Kutta time step coefficients
The input can be a list of lists or a string or
None
. If it’s a string, the the function will attempt to use one of the following known sets of Runge-Kutta inputs. The first column is the stage coefficient, and the second column is whether or not to use a gradient evaluation in that stage.'van Leer 5-stage' | 'VL5' | 2 | '2' | 'default'
- RK = [
[0.0695, 1], [0.1602, 0], [0.2898, 0], [0.5060, 0], [1.0, 0]]
'first-order' | 1 | '1'
- RK = [
[0.0695, 0], [0.1602, 0], [0.2898, 0], [0.5060, 0], [1.0, 0]]
'robust'
- RK = [
[0.0695, 1], [0.1602, 1], [0.2898, 1], [0.5060, 1], [1.0, 1]]
'VL3-1'
- RK = [
[0.1481, 1], [0.4, 0], [1.0, 0]]
'van Leer 3-stage' | 'VL3-2' | 'VL3'
- RK = [
[0.1918, 1], [0.4929, 0], [1.0, 0]]
'van Leer 4-stage' | 'VL4'
- RK = [
[0.1084, 1], [0.2602, 1], [0.5052, 1], [1.0, 0]]
- Call:
>>> IC.SetRungeKutta(RK)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- RK:
str
|list
([float
,int
]) Named Runge-Kutta scheme or list of coefficients and gradient evaluation flags
- IC:
- Effects:
Deletes current lines beginning with
RK
in theSolver_Control_Information
section and replaces them with the specified values- Versions:
2014-12-17
@ddalle
: v1.0
- SetSecondOrder()¶
Set the solver to second-order mode
- Call:
>>> IC.SetSecondOrder()
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- IC:
- Effects:
Sets the gradient evaluation to
1
for the first RK line- Versions:
2014-06-17
@ddalle
: v1.0
- SetSingleMomentPoint(x, compID='all')¶
Set the moment reference point in an
input.cntl
file- Call:
>>> IC.SetSingleMomentPoint(x) >>> IC.SetSingleMomentPoint(x, compID)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- x:
list`(:class:`float
) List of three coordinates of moment reference point
- compID:
str
Component to which reference applies (default is
'all'
)
- IC:
- Versions:
2014-10-07
@ddalle
: v1.02014-10-08
@ddalle
: Downgraded to “single” function
- SetSingleReferenceArea(Aref, compID='all')¶
Set the reference area in an
input.cntl
file.- Call:
>>> IC.SetSingleReferenceArea(Aref) >>> IC.SetSingleReferenceArea(Aref, compID)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- Aref:
float
Reference area value
- compID:
str
Component to which reference applies (default is
'all'
)
- IC:
- Versions:
2014-06-10
@ddalle
: v1.02014-10-08
@ddalle
: Demoted to “single”
- SetSingleReferenceLength(Lref, compID='all')¶
Set the reference length in an
input.cntl
file- Call:
>>> IC.SetSingleReferenceLength(Lref) >>> IC.SetSingleReferenceLength(Lref, compID)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- Lref:
float
Reference length value
- compID:
str
Component to which reference applies (default is
'all'
)
- IC:
- Versions:
2014-06-10
@ddalle
: v1.02014-10-08
@ddalle
: Demoted to “single”
- SetSurfBC(compID, u)¶
Set a surface boundary condition, for example on a nozzle surface
- Call:
>>> IC.SetSurfBC(compID, u)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- compID:
int
Component number to apply boundary condition to
- u:
numpy.ndarray
, shape = (5,) orNone
Vector of density, velocity, pressure on surface
- IC:
- Effects:
Writes a line with appropriate “SurfBC i …” syntax to
input.cntl
file.- Versions:
2014-06-04
@ddalle
: v1.0
- SetXSlices(x)¶
Set the list of x-coordinates at which to form cut planes
- Call:
>>> IC.SetXSlices(x)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- x: array_like[
float
] List or vector of x-coordinates at which to make cut planes
- IC:
- Effects:
Replaces the current list of x cut planes with the input list.
- Versions:
2014-06-10
@ddalle
: v1.0
- SetYSlices(y)¶
Set the list of x-coordinates at which to form cut planes
- Call:
>>> IC.SetYSlices(y)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- y: array_like[
float
] List or vector of y-coordinates at which to make cut planes
- IC:
- Effects:
Replaces the current list of y cut planes with the input list.
- Versions:
2014-06-10
@ddalle
: v1.0
- SetZSlices(z)¶
Set the list of x-coordinates at which to form cut planes
- Call:
>>> IC.SetZSlices(z)
- Inputs:
- IC:
pyCart.inputCntl.InputCntl
File control instance for
input.cntl
- z: array_like[
float
] List or vector of z-coordinates at which to make cut planes
- IC:
- Effects:
Replaces the current list of z cut planes with the input list.
- Versions:
2014-06-10
@ddalle
: v1.0