Introduction to CAPE Application Program Interface¶
The various methods used by pyCart, pyFun, and pyOver are based on a set of
Python modules with a few capabilities written in C (with a full Python/C
interface). In order to reduce the number of lines, most of the base
functionality is provided by a common module cape
. Then each of the
modules for individual solvers (cape.pycart
, cape.pyfun
,
cape.pyover
) are based off of this module. Furthermore, pyCart is a
heavily object-oriented implementation in which the vast majority of
capabilities come from customized classes.
The most critical class is cape.cntl.Cntl
, which acts as a template
for the three classes that interact with actually submitting jobs and checking
status. An instance of one of these classes comes from reading all the
settings from a master JSON file. When a user utilizes the
primary command-line interface via a command such as
$ pycart -f run/poweroff.json -c
the program works by loading an instance of cape.pycart.cntl.Cntl
by
reading run/poweroff.json
and using methods of that instance. In this
case, the Python version of the above is shown below.
# Load the pyCart API module import cape.pycart # Read the settings from the JSON file cntl = cape.pycart.Cntl('run/powroff.json') # Do something (in this case, the "-c" command) cntl.DisplayStatus()
The basic modules based on this model are listed below:
Reading the JSON files depends heavily on the cape.options
module. The
majority of JSON settings are defined in cape.json
,
with some of the additional settings particular to each individual solver
defined in cape.pycart.options
, etc.
There are also a collection of helper modules, such as cape.pycart.report
.
These typically provide one or more classes (such as
cape.pycart.report.Report
) which add a few methods to the cape
version. This leads to a definition for the cape.pycart
version of the
module that starts something like the following.
# Import CAPE version import cape.cfdx.report # Definition for pyCart.report.Report based on cape.cfdx.report.Report class Report(cape.cfdx.report.Report): ...
Then the code in cape/pycart/report.py
contains either methods that are
particular to Cart3D or methods that need to be modified from the definitions
in cape/cfdx/report.py
.
Here is a list of modules that are not primarily based on classes. Modules
that are particular to a solver are listed as children of the cape
module.
Finally, in addition to the cape.cntl.Cntl
class, there are several
classes that form the basis for the key CAPE functionality.
Class |
Description and discussion |
---|---|
Interface to Cart3D-style surface triangulations, can read several
formats, and |
|
CFD raw data database class |
|
Template class for reading and interacting with iterative data from a single case |
|
Interface to automated reports |
|
Template for interacting with many CFD solver settings file types |
|
Class for reading Fortran namelists |
|
Alternative interface to Fortran namelists |
- The
cape
modulecape.cfdx
: Templates for CFD control toolscape.filecntl
: Interfaces for text control filescape.argread
: Command-Line Argument Processorcape.atm
: Atmosphere Modelscapeio
: Binary file input/output toolscape.cgns
: CGNS file interfacecape.cntl
: Base module for CFD operations and processingcape.color
: Color conversion toolscape.config
: Surface configuration modulecape.convert
: Unit and angle conversion utilitiescape.geom
: Generic geometry utilitiescape.fileutils
: Pure-Python file information utilitiescape.manage
: CFD case archiving functionscape.msh
: FLUENT mesh modulenmlfile
: Interface to Fortran namelistnmlerr
: Errors forNmlFile
dataoptdict
: Advanceddict
-based options interfaceopterror
: Errors forOptionsDict
toolsoptdict.optitem
: Tools to access items from option listscape.plot3d
: Python interface to Plot3D filescape.plt
: Python interface to Tecplot PLT filescape.runmatrix
: Run matrix interfacecape.step
: Python interface to STEP Filescape.tar
: Semiautomatic folder archivingcape.text
: Module to print docstrings to STDOUTcape.tri
: Surface triangulation modulecape.tricli
: Interfaces to.tri
and related filescape.units
: Unit Conversion Modulecape.util
: Cape utilitiescape.writell
: Collect CAPE line load databookscape.xmlfile
: Extended interface to XML files_cape3
: Compiled CAPE extension
cape.pycart
: Interfaces to Cart3Dcape.pycart.cntl
: Cart3D control modulecape.pycart.options
: Cart3D and pyCart Settingscape.pycart.aeroCsh
: Cart3Daero.csh
interfacecape.pycart.case
: Case Control Modulecape.pycart.cmdgen
: Create commands for Cart3D executablescape.pycart.cmdrun
: Cart3D executable interface modulecape.pycart.dataBook
: pyCart data book modulecape.pycart.inputCntl
: Cart3Dinput.cntl
interfacecape.pycart.lineLoad
: Sectional loads modulecape.pycart.manage
: Manage pyCart case folderscape.pycart.pointSensor
: Cart3D point sensors modulecape.pycart.preSpecCntl
: Cart3D preSpec.c3d.cntl Interfacecape.pycart.report
: Automated report interfacecape.pycart.tri
: Cart3D.tri
file interfacecape.pycart.util
cape.pyfun
: FUN3D interfacescape.pyfun.cntl
: FUN3D control modulecape.pyfun.options
: FUN3D and pyFun settingscape.pyfun.case
: FUN3D case control modulecape.pyfun.cmdgen
: Create commands for FUN3D executablescape.pyfun.cmdrun
: Calls to FUN3D executablescape.pyfun.dataBook
: Post-processing for FUN3D datacape.pyfun.faux
: FAUXGeom interface modulecape.pyfun.lineLoad
: Sectional loads modulecape.pyfun.manage
: Manage file storage forpyfun
casescape.pyfun.mapbc
: FUN3D boundary condition modulecape.pyfun.namelist
: FUN3D namelist modulecape.pyfun.pointSensor
: FUN3D point sensors modulecape.pyfun.plt
: Interface to FUN3D Tecplot PLT filescape.pyfun.report
: Automated report interfacecape.pyfun.rubberData
: FUN3D filerubber.data
cape.pyfun.tricli
: Special FUN3D triangulation interfacescape.pyfun.util
: Utilities forpyfun
cape.pykes
: Interfaces to CREATE-AV Kestrelcape.pykes
: CAPE interface to Kestrel running and processingcape.pykes.cntl
: Kestrel control modulecape.pykes.options
: Options interface for pyKes/Kestrelcape.pykes.case
: Kestrel individual-case modulecape.pykes.jobxml
: Interface to Kestrel main XML control filecape.pykes.cmdgen
: Create commands for Kestrel executablescape.pykes.dataBook
: Kestrel data book modulecape.pykes.manage
: Manage files inpykes
run folderscape.pykes.report
: Automated report interface
cape.pyover
: Interfaces to OVERFLOWcape.pyover.cntl
: OVERFLOW control modulecape.pyover.options
: Options interface for pyOver/OVERFLOWcape.pyover.case
: OVERFLOW case control modulecape.pyover.cmdgen
: Create commands for OVERFLOW executablescape.pyover.cmdrun
: OVERFLOW binary interface modulecape.pyover.dataBook
: pyOver data book modulecape.pyover.lineLoad
: Sectional loads modulecape.pyover.manage
: Manage pyOver case folderscape.pyover.overNamelist
: OVERFLOW namelist modulecape.pyover.plot3d
: Interface to OVERFLOW Plot3D filescape.pyover.report
: Automated report interfacecape.pyover.util
: Utilities forpyover
cape.attdb
: Package for “datakits”: database + toolkitcape.attdb.rdb
: Main DataKit modulecape.attdb.datakithub
: Hub for importing DataKits by namecape.attdb.datakitloader
: Tools for reading DataKits from a collectioncape.attdb.dbfm
: Aerodynamics force & moment datakitscape.attdb.dbll
: Aerodynamic line load datakitscape.attdb.froot
: Nonlinear equation solvercape.attdb.ftypes
: Data file type interfacescape.tnakit.pkgutils
: Tools for creating DataKit packagescape.attdb.rdbaero
: Database Template for Aerospace Variablescape.attdb.vendorutils
: Package Vendorization Utilitiescape.attdb.writedb
: Write DataKit processed data to file
cape.tnakit
: Basic TNA Python tool kitcape.tnakit.arrayutils
: Tools for NumPy arrayscape.tnakit.kwutils
: Tools for Processing Keyword Argumentscape.tnakit.metautils
: Tools for module metadata databasescape.tnakit.modutils
: Module documentation utilitiescape.tnakit.optitem
: Option list item access toolscape.tnakit.plot_mpl
: Matplotlib/Pyplot Interfacescape.tnakit.promptutils
: Interactive Console Promptcape.tnakit.rstutils
: Tools for writing ReST filescape.tnakit.statutils
: Statistics toolscape.tnakit.textutils.wrap
: Text-wrapping toolkitcape.tnakit.typeutils
: Python 2/3 type-check utils