cape.pycart.inputcntlfile: 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.inputcntlfile.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.inputcntlfile.InputCntl(fname='input.cntl')¶
File control class for
input.cntlThis 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:
>>> IC = pyCart.InputCntl() >>> IC = pyCart.InputCntl(fname)
- Inputs:
- fname:
str Name of CNTL file to read, defaults to
'input.cntl'
- fname:
- Outputs:
- Version:
2014-06-04
@ddalle: v1.0
- AddLineSensor(name, X)¶
Write a line sensor
- AddPointSensor(name, X)¶
Write a point sensor
- Copy(fname)¶
Copy a file interface
- Call:
>>> IC2 = IC.Copy()
- Inputs:
- IC:
pyCart.inputcntlfile.InputCntl File control instance for
input.cntl
- IC:
- Outputs:
- IC2:
pyCart.inputcntlfile.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.inputcntlfile.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.inputcntlfile.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
- GetMach()¶
Find the current Mach number
- GetPointSensor(name)¶
Get the coordinates for a point sensor
- GetSingleMomentPoint(compID='all')¶
Get the moment reference point of a component in
input.cntl- Call:
>>> x = IC.GetSingleMomentPoint(compID)
- Inputs:
- IC:
pyCart.inputcntlfile.InputCntl File control instance for
input.cntl- compID:
str Component to which reference applies (default is
'all')
- IC:
- Outputs:
- 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:
- Effects:
Adds a line to
input.cntlthat 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:
- Effects:
Adds a line to
input.cntlthat 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:
- Effects:
Adds a line to
input.cntlthat 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.inputcntlfile.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.inputcntlfile.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.inputcntlfile.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.inputcntlfile.InputCntl File control instance for
input.cntl
- IC:
- Effects:
Sets the gradient evaluation to
0for the first RK line- Versions:
2014-06-17
@ddalle: v1.0
- SetLineSensors(LS)¶
Write all line sensors
- Call:
>>> IC.SetLineSensors(LS)
- Inputs:
- IC:
pyCart.inputcntlfile.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.inputcntlfile.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:
- 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.inputcntlfile.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.inputcntlfile.InputCntl File control instance for
input.cntl- Name:
str Name of the force (required)
- force:
int[ {0} | 1 | 2 | None] Force axis, e.g.
0for 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.inputcntlfile.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] Axis, e.g.
0for rolling; not used ifNone- frame:
int[ {0} | 1 ] Body frame (
0) or velocity frame (1)- weight:
float[ {1.0} |float] Linear weight on term in overall functional
- compID: {
"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:
- Versions:
2015-05-06
@ddalle: v1.0
- SetPointSensors(PS)¶
Write all point sensors
- Call:
>>> IC.SetPointSensors(PS)
- Inputs:
- IC:
pyCart.inputcntlfile.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.inputcntlfile.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.inputcntlfile.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.inputcntlfile.InputCntl File control instance for
input.cntl
- IC:
- Effects:
Sets the gradient evaluation to
1for 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:
- Effects:
Deletes current lines beginning with
RKin theSolver_Control_Informationsection 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.inputcntlfile.InputCntl File control instance for
input.cntl
- IC:
- Effects:
Sets the gradient evaluation to
1for the first RK line- Versions:
2014-06-17
@ddalle: v1.0
- SetSingleMomentPoint(x, compID='all')¶
Set the moment reference point in an
input.cntlfile- Call:
>>> IC.SetSingleMomentPoint(x) >>> IC.SetSingleMomentPoint(x, compID)
- Inputs:
- IC:
pyCart.inputcntlfile.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.cntlfile.- Call:
>>> IC.SetSingleReferenceArea(Aref) >>> IC.SetSingleReferenceArea(Aref, compID)
- Inputs:
- Versions:
2014-06-10
@ddalle: v1.02014-10-08
@ddalle: Demoted to “single”
- SetSingleReferenceLength(Lref, compID='all')¶
Set the reference length in an
input.cntlfile- Call:
>>> IC.SetSingleReferenceLength(Lref) >>> IC.SetSingleReferenceLength(Lref, compID)
- Inputs:
- 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.inputcntlfile.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.cntlfile.- 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.inputcntlfile.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.inputcntlfile.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.inputcntlfile.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