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
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/report.py
.
There are a few modules that provide tools that are not primarily based on
classes. There is a set of so-called “case” modules, which are the interface to
running the individual programs for each solver. For example,
cape.pycart.case
contains the function
cape.pycart.case.run_flowCart()
, which runs from within a case folder.
The “case” modules are also based on cape.case
but in a different way.
These modules begin with the following line, and then additional commands that
are particular to each solver are created in subsequent lines.
# Import all methods from the CAPE version from cape.case import * # Load local modules from . import cmd from . import bin ...
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 Modelscape.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.io
: Binary file input/output toolscape.manage
: Manage CFD case folderscape.msh
: FLUENT mesh modulecape.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
- The
cape.pycart
modulecape.pycart.cntl
: Cart3D control modulecape.pycart.options
: Cart3D and pyCart Settingscape.pycart.case
: Case Control Modulecape.pycart.tri
: Cart3D Triangulation Modulecape.pycart.bin
: Cart3D executable interface modulecape.pycart.cmd
: Create commands for Cart3D executablescape.pycart.inputCntl
: Cart3Dinput.cntl
interfacecape.pycart.aeroCsh
: Cart3Daero.csh
interfacecape.pycart.preSpecCntl
: Cart3D preSpec.c3d.cntl Interfacecape.pycart.dataBook
: pyCart data book modulecape.pycart.lineLoad
: Sectional loads modulecape.pycart.pointSensor
: Cart3D point sensors modulecape.pycart.report
: Automated report interfacecape.pycart.manage
: Manage pyCart case folderscape.pycart.util
: Utilities for pyCart
- The
cape.pyfun
modulecape.pyfun.cntl
: FUN3D control modulecape.pyfun.options
: FUN3D and pyFun settingscape.pyfun.case
: FUN3D case control modulecape.namelist
: FUN3D namelist modulecape.pyfun.mapbc
: FUN3D boundary condition modulecape.pyfun.faux
: FAUXGeom interface modulecape.pyfun.rubberData
: FUN3D filerubber.data
cape.pyfun.bin
: FUN3D binary interface modulecape.pyfun.cmd
: Create commands for FUN3D executablescape.pyfun.dataBook
: pyFun data book modulecape.pyfun.lineLoad
: Sectional loads modulecape.pyfun.pointSensor
: FUN3D point sensors modulecape.pyfun.plt
: Interface to FUN3D Tecplot PLT filescape.pyfun.report
: Automated report interfacecape.pyfun.manage
: Manage pyFun case folderscape.pyfun.tricli
: Special FUN3D triangulation interfacescape.pyfun.util
: Utilities for pyFun
- The
cape.pyover
modulecape.pyover.cntl
: OVERFLOW control modulecape.pyover.options
: OVERFLOW and pyOver Settingscape.pyover.overNamelist
: OVERFLOW namelist modulecape.pyover.case
: OVERFLOW base control modulecape.pyover.bin
: OVERFLOW binary interface modulecape.pyover.cmd
: Create commands for OVERFLOW executablescape.pyover.plot3d
: Interface to OVERFLOW Plot3D filescape.pyover.dataBook
: pyOver data book modulecape.pyover.lineLoad
: Sectional loads modulecape.pyover.report
: Automated report interfacecape.pyover.manage
: Manage pyOver case folderscape.pyover.util
: Utilities for pyOver
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