cape.pycart.cntl
: Cart3D control module¶
cape.pycart.cntl
: Cart3D control module¶
This module provides tools to quickly setup basic Cart3D runs or a complex Cart3D setup from a small set of input files. Alternatively, the methods and classes can be used to help setup a problem that is too complex or customized to conform to standardized script libraries. A collection of cases combined into a run matrix can be loaded using the following commands.
>>> import cape.pycart.cart3d >>> cntl = cape.pycart.cntl.Cntl("pyCart.json") >>> cntl <cape.pycart.Cntl(nCase=4, tri='bullet.tri')> >>> cntl.x.GetFullFolderNames(0) 'poweroff/m1.5a0.0b0.0'
An instance of this cape.pycart.cntl.Cntl
class has many
attributes, which include the run matrix (cntl.x
), the options
interface (cntl.opts
), and optionally the data book
(cntl.DataBook
), the triangulation (cntl.tri
), and the
appropriate input files (such as cntl.InputCntl
).
Attribute
Class
cntl.x
cape.runmatrix.RunMatrix
cntl.opts
cntl.tri
cape.trifile.Tri
cntl.DataBook
cntl.InputCntl
cntl.AeroCsh
Finally, the cape.pycart.cntl.Cntl
class is subclassed from the
cape.cfdx.cntl.Cntl
class, so any methods available to the CAPE
class are also available here.
- class cape.pycart.cntl.Cntl(fname=None)¶
Class for handling global options and setup for Cart3D
This class is intended to handle all settings used to describe a group of Cart3D cases. The settings are read from a JSON file.
- Call:
>>> cntl = cape.pycart.Cntl(fname="pyCart.json")
- Inputs:
- fname:
str
Name of pyCart input file
- fname:
- Outputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of the pyCart control class
- cntl:
- Data members:
- Versions:
2014-05-28
@ddalle
: v1.02014-06-03
@ddalle
: Renamed class Cntl –> Cart3d2014-06-30
@ddalle
: Reduced number of data members2014-07-27
@ddalle
: cart3d.RunMatrix –> cart3d.x
- ApplyCase(i, nPhase=None, **kw)¶
Apply settings from cntl.opts to an individual case
This rewrites each run namelist file and the
case.json
file in the specified directories.- Call:
>>> cntl.ApplyCase(i, nPhase=None)
- Inputs:
- cntl:
cape.pyfun.cntl.Cntl
Cart3D control interface
- i:
int
Case number
- nPhase: {
None
} | positiveint
Last phase number (default determined by PhaseSequence)
- cntl:
- Versions:
2016-03-31
@ddalle
: v1.0
- ApplyFlowCartSettings(**kw)¶
Apply settings from cntl.opts to a set of cases
This rewrites
case.json
in the specified directories.- Call:
>>> cntl.ApplyFlowCartSettings(cons=[])
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- I:
list
[int
] List of indices
- cons:
list
[str
] List of constraints
- cntl:
- Versions:
2014-12-11
@ddalle
: v1.0
- CheckMesh(i)¶
Check if the mesh for case i is prepared.
- Call:
>>> q = cntl.CheckMesh(i)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of control class containing relevant parameters
- i:
int
Index of the case to check (0-based)
- cntl:
- Outputs:
- q:
bool
Whether or not the mesh for case i is prepared
- q:
- Versions:
2014-09-29
@ddalle
: v1.0
- CheckNone(v=False)¶
Check if the current folder has the necessary files to run
- Call:
>>> q = cntl.CheckNone(v=False)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of control class containing relevant parameters
- v:
True
| {False
} Verbose flag; prints message if q is
True
- cntl:
- Versions:
2015-09-27
@ddalle
: v1.02017-02-22
@ddalle
: Added verbose flag
- ExplodeTri()¶
Create a 3-view of each named or numbered comp using TecPlot
This will create a folder called
subtri/
in the master directory for this cntl object, and it will contain a triangulation for each named component infConfig.xml
along with a three-view plot of each component created using TecPlot if possible.- Call:
>>> cntl.ExplodeTri()
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- cntl:
- Versions:
2015-01-23
@ddalle
: v1.0
- GetSurfBCState(key, i)¶
Get surface boundary condition state
- Call:
>>> rho, U, p = cntl.GetSurfBCState(key, i)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- key:
str
Name of key to process
- i:
int
Run index
- cntl:
- Outputs:
- Versions:
2016-03-28
@ddalle
: v1.0
- GetSurfCTState(key, i)¶
Get surface boundary state from thrust coefficient
- Call:
>>> rho, U, p = cntl.GetSurfCTState(key, i)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- key:
str
Name of key to process
- i:
int
Run index
- cntl:
- Outputs:
- Versions:
2016-11-21
@ddalle
: v1.0
- PrepareAeroCsh(i: int)¶
Write
aero.csh
for run case i- Call:
>>> cntl.PrepareAeroCsh(i)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- i:
int
Run index
- cntl:
- Versions:
2014-06-10
@ddalle
: v1.02014-10-03
@ddalle
: v2.0
- PrepareCase(i)¶
Prepare case for running if necessary
- Call:
>>> cntl.PrepareCase(i)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of control class containing relevant parameters
- i:
int
Index of case to analyze
- cntl:
- Versions:
2014-09-30
@ddalle
: v1.02022-04-13
@ddalle
: v1.1; exec_modfunction()2024-01-16
@ddalle
: v1.2; case func b4 writeJSON
- PrepareInputCntl(i: int)¶
Write
input.cntl
for run case i- Call:
>>> cntl.PrepareInputCntl(i)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- i:
int
Run index
- cntl:
- Versions:
2014-06-04
@ddalle
: v1.02014-06-06
@ddalle
: v1.1; low-level griddir support2014-09-30
@ddalle
: v1.2; change to single-case
- PrepareMesh(i)¶
Prepare the mesh for case i if necessary.
- Call:
>>> cntl.PrepareMesh(i)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of control class containing relevant parameters
- i:
int
Index of the case to check (0-based)
- cntl:
- Versions:
2014-09-29
@ddalle
: v1.0
- PreparePreSpecCntl()¶
Prepare and write
preSpec.c3d.cntl
in current folder- Call:
>>> cntl.PreparePreSpecCntl()
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- cntl:
- See Also:
cape.pycart.options.Mesh.Mesh.get_BBox()
cape.pycart.options.Mesh.Mesh.get_XLev()
cape.trifile.TriBase.GetCompBBox()
- Versions:
2014-10-08
@ddalle
: v1.0
- ReadAeroCsh()¶
Read the
aero.csh
file- Call:
>>> cntl.ReadAeroCsh()
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- cntl:
- Versions:
2015-10-14
@ddalle
: Revived from deletion
- ReadInputCntl()¶
Read the
input.cntl
file- Call:
>>> cntl.ReadInputCntl()
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- cntl:
- Versions:
2015-06-13
@ddalle
: v1.0
- SetSurfBC(key, i, CT=False)¶
Set all SurfBCs for a particular thrust trajectory key
- Call:
>>> cntl.SetSurfBC(key, i, CT=False)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of global pyCart settings object
- key:
str
Name of key to process
- i:
int
Run index
- CT:
True
| {False
} Inputs of thrust (
True
) or pressure (False
)
- cntl:
- Versions:
2016-03-28
@ddalle
: v1.02016-11-21
@ddalle
: Added CT input key
- UpdatePointSensor(**kw)¶
Update point sensor group(s) data book
- Call:
>>> cntl.UpdatePointSensor(pt=None, cons=[], **kw)
- Inputs:
- Versions:
2016-01-13
@ddalle
: v1.0
- cli(*a, **kw)¶
Command-line interface
- Call:
>>> cntl.cli(*a, **kw)
- Inputs:
- cntl:
cape.pycart.cntl.Cntl
Instance of control class containing relevant parameters
- kw:
dict
(True
|False
|str
) Unprocessed keyword arguments
- cntl:
- Outputs:
- cmd:
None
|str
Name of command that was processed, if any
- cmd:
- Versions:
2018-10-19
@ddalle
: v1.0