CAPE Documentation¶
Welcome to CAPE, a computational aerosciences processing environment for efficient interaction with several high-fidelity aerodynamics codes. This includes tools for pre-processing, executing the codes, performing post-processing tasks, and creating finished databases. The approach of Cape is to provide tools that make users more efficient at some or all of the modeling and analysis process. It may be useful to use CAPE for just one step of a particular user’s project, or it may be useful to use it for the entire process.
LICENSE
What’s new in version 2.3.0
More flexible command-line interface
CAPE calls, while still preserving backward compatibility, can now be simplified. Instead of calling
pyfun,pycart,pyover, etc. most calls can now be done by just usingcape. CAPE will automatically determine which solver module to use by quickly looking at the contents of the JSON file. In combination with the implicit or explicit sub-command, this means that most CAPE calls have four different ways to be invoked:$ cape c $ cape -c $ pyfun check $ pyfun -c
If the cape executable determines the wrong solver (e.g. it thinks your JSON file is a Cart3D JSON file when it’s actually for LAVA), you can use the explicit call (
pylavain the previous example).pylava: CAPE has added support for a fifth solver, NASA’s new LAVA package. For this release only the LAVA Cartesian solver is fully supported.
Additional CAPE sub-commands and options
Use
cape open-pdf report/report-$REPORT.pdf --pullto automatically transfer a report file from an HPC node and open it locallyUse
cape findto just return the indices of cases that match a set of constraints.The
cape edit-jsoncommand is an option to edit the contents of the main JSON file through a command-line interfaceCase subsets can now be constrained by status, e.g
$ cape c --status DONE
However, using this constraint interferes with the speed-up from parallelization (see below).
For shared run matrices, you can use the new option
--meinstead of the much longer--cons "user=='$USER'". The--meoption will do nothing unless you have a run matrix key named"user"or another user-type key defined.
Much faster run matrix checking
Checking on a large run matrix, especially with
pyfun, can be time-consuming. This is mostly because determining how many iterations have been run can be surprisingly complicated for some of the CFD solvers.cape -cis now automatically parallelized, so that it can analyze several cases in parallel, controlled by the new--nprocoption.Smarter error handling
Many errors caused by incorrect input (and also
KeyboardInterruptorCtrl-C) will now produce a small error message rather than a full Python traceback. Progress will continue to be made on this front in future versions of CAPE.Logging: most command-line CAPE calls are now recorded in a log file.
Whenever you run a CAPE command that involves a
cape.cfdx.cntl.Cntlinstance, it will now log that command the folderlog/{BASENAME_OF_JSON_FILE}/where
$BASENAME_OF_JSON_FILEis the name of the JSON/YAML control file with the.jsonstripped. This can include sub-folders. In this folder for logging a single CAPE file, you will seecmd.loghash.loglast.json
For example if you run
pyfun -candpyFun.jsonis linked torun/dac3-asc01.json, you’ll get a folder (or append to it if it already exists) calledlog/cmd/run/dac3-asc01/with those three files in it. Thecmd.logfile will contain a line such asCMD,2026-01-07 14:55:33,pyfun check -f run/dac3-asc01.jsonThe commands are “canonical-ized” so that the actual name of the JSON file is always included, and it will use the new two-word format for the logged commands. The line preceding this
CMDline will be a SHA-256 hash of the current expanded (and comment-stripped) JSON file for tracing.You can turn this off by setting
"LogLevel": 0
in the JSON file or by the environment variable
$CAPE_LOG_LEVEL.export CAPE_LOG_LEVEL=0Advanced case naming
New settings in the
"RunMatrix"section named"Replace"and"RegexSubs". These allow you to replace one string with another (Replace) or apply general regular expression replacements usingre.sub(). For example, if you don’t want decimal points in your case names, you could use:"RunMatrix": { "Replace": { ".": "p" } }
to get conversions like
m2.50a2.0→m2p50a2p0or use"RunMatrix": { "Replace": { ".": "" } }
to get conversions like
m2.50a2.0→m250a20. One more example:"RunMatrix": { "Replace": { ".0": "", ".": "" } }
to get
m2.50a2.0→m250a2.
See the full Changelog for more details on recent features.
Installation: Installation is done using the standard
Python packaging tool pip.
Most users really would rather evaluate new tools by seeing some examples, so here are the links to the example pages for the main solvers:
Currently, CAPE has interfaces for
Cart3D,
FUN3D,
CREATE-AV Kestrel, and
OVERFLOW.
The Cart3D interface, cape.pycart has been used for several NASA
projects. One example was the creation of an aerodynamic database for booster
separation for the Space Launch System, which included over 10,000 different
adaptive Cart3D runs in a 12-dimensional run matrix.
The FUN3D interface, cape.pyfun, reuses most of the code used to build
cape.pycart; and the OVERFLOW interface, cape.pyover was
constructed in a similar manner. All modules are built off of common tools in
the cape and cape.cfdx modulew, and so much of the usage is
common between the two interfaces. These interfaces can be used to run
OVERFLOW/FUN3D, interact with databases, and archive or clean up solutions.
There is a Python interface to solution files including easy dimensionalization
of state variables.
In addition to running CFD codes, CAPE contains a package called
cape.dkit for cleaning and processing numerical databases whether the
original data comes from CFD or not. The key tool from this package is the
class
which can read CSV files, other ASCII text data files, MATLAB .mat files,
Excel spreadsheets, and more.
Each CFD interface is a portmanteau of “Python” and the name of the solver. The
command-line interface is invoked with the commands pycart, pyfun, and
pyover. In addition, there are several scripts matching the glob
p?_*.py and for isolated tasks such as converting grid formats, and there
is a run_*.py script for running the appropriate tasks for a single case of
each CFD interface.
Cape Inputs and JSON Files Inputs to Cape can be given as either command-line arguments, input files associated with the CFD solver, or JSON files. JSON is a simple but flexible format similar to XML. There are interpreters for many languages.
Common CAPE Capabilities The following bullet list of capabilities is common to all interfaces including any that will be added in the future.
Automatically create parametrically-named folders for cases in a matrix
Copy input files to run folders and edit them according to run matrix variables and multiple phases of global input settings
Create PBS scripts and submit them automatically
Built-in variables such as Mach number, angle of attack, sideslip, Reynolds number, and temperature
Automated averaging of iterative histories and statistics for databases
Automated reports using LaTeX (usually supports Tecplot and ParaView images)
pyCart Capabilities The Cart3D interface, pyCart, has quite a few capabilities. Some highlights and critical aspects are listed below.
Copy Cart3D input files to run files and edit them according to run matrix variables and global input settings
Simplified interface for refining initial volume mesh using component names
Rotate components (such as fins or separating bodies) using Euler angles or a hinge axis
Automated reports of iterative histories and Tecplot layouts
Interface for custom functions for more advanced run matrix variables such as thrust settings
The basic usage for this module is to create a file called pyCart.json
and use the script pycart. In addition to this control file for pyCart,
several other Cart3D input files (or, more accurately, input template files)
can be provided or interfaced. The names below are canonical names; it is
possible to use other file names when setting up configurations.
Cart3D input control file,
input.cntlSurface triangulation file,
Components.i.triSurface triangulation component names,
Config.xmlIf an adaptive run, an adaptive run script,
aero.cshRun matrix, either specified within
pyCart.jsonor a file
pyFun Capabilities The FUN3D interface, pyFun, is newer and has somewhat fewer capabilities, although most of the database and reporting capabilities are inherited from pyCart. Some capabilities are highlighted below.
Copy FUN3D input files to run files and edit them according to run matrix variables and global input settings
Interface with AFLR3 for volume mesh generation, which can be used to have multiple bodies in different relative positions for each case in a run matrix
Interface to Chimera Grid Tools
triloadto calculate sectional loads
The basic usage for this module is to create a file called pyFun.json
and use the script pyfun. The required FUN3D input files are described
below.
FUN3D run settings template,
fun3d.nmlMesh file; a recommended format is AFLR3,
*.ugridBoundary condition file,
*.mapbcRun matrix, either specified within
pyFun.jsonor a file
pyOver Capabilities The OVERFLOW interface, pyOver, is also new but will have a rapidly expanding set of capabilities. Much of the database and report capabilities are inherited from pyCart. Some highlights are below.
Copy OVERFLOW input namelists and edit them according to run matrix variables and multiple phases of input settings
Highly generalized interface to OVERFLOW namelists that doesn’t need great amounts of user preparation
Built-in interface to OVERFLOW q files with simple access to coefficients and dimensional states
The basic usage for this module involves a file pyOver.json, and the
primary script is pyover. Required input files depend on whether the case
is being run in DCF or Pegasus5 mode. In this module, the user is responsible
for informing pyOver which mesh files are required, although a default list is
defined. In general the required files are the following.
OVERFLOW namelist template,
overflow.inpMesh files, usually in the
common/folderRun Matrix, either within
pyOver.jsonor in a CSV-like file
- 1. Requirements and Installation
- 2. About This Documentation
- 3. Usage and Common Settings
- 4. pyCart Documentation
- 5. pyFun Documentation
- 6. pyOver Documentation
- 7. CAPE Executables
- 7.1.
pycart: Interact with Cart3D run matrix using CAPE - 7.2.
pyfun: Interact with FUN3D run matrix using CAPE - 7.3.
pykes: Interact with Kestrel run matrix using CAPE - 7.4.
pyover: Interact with OVERFLOW run matrix using CAPE - 7.5.
dkit: Command-Line Interface to datakit tools - 7.6.
dkit-quickstart: Create template for a new datakit package - 7.7.
dkit-vendorize: Vendorize one or more packages - 7.8.
dkit-writedb: Read raw data to create formatted datakit files - 7.9.
run_flowCart.py: Run Cart3D for one phase - 7.10.
run_fun3d.py: Run FUN3D for one phase - 7.11.
run_overflow.py: Run OVERFLOW for one phase - 7.12.
cape-cfdx: Control generic-solver run matrix - 7.13.
cape-writell: Combine CAPE line load data into MAT file - 7.14.
cape-step2crv: Convert STEP file to Plot3D multiple curve file - 7.15.
cape-steptri2crv: Extract TRI file nodes on STEP curves - 7.16.
cape-uh3d2tri: Convert UH3D triangulation to Cart3D format - 7.17.
cape-tec: Export image from Tecplot(R) layout file - 7.18.
cape-tri2plt: Convert Triangulation to Tecplot PLT Format - 7.19.
cape-tri2uh3d: Convert Cart3D Triangulation to UH3D Format - 7.20.
cape-tri2surf: Convert surf triangulation to AFLR3 format - 7.21.
cape-expandjson: Expand a JSON file and remove comments - 7.22.
pyfun-plt2triq: Convert FUN3D Tecplot file to Cart3D tri file - 7.23.
triqfm: Calculate forces and moments on a.triqfile
- 7.1.
Reference
API Documenattion
- Introduction to CAPE Application Program Interface
cape.cfdx: Templates for CFD control toolscape.pycart: Interfaces to Cart3Dcape.pyfun: FUN3D interfacescape.lava: Interfaces to LAVA from NASA Amescape.pylch: Interfaces to Loci/CHEMcape.pykes: Interfaces to CREATE-AV Kestrelcape.pyover: Interfaces to OVERFLOWcape.pyus: US3D interfacescape.dkit: Package for “datakits”: database + toolkitcape.tnakit: Basic TNA Python tool kit- The
capemodule
cape.filecntl: Interfaces for text control filesargread: Parse command-line arguments and optionscape.atm: Atmosphere Modelscapeio: Binary file input/output toolscape.capeconfig: Interface to user-specific CAPE configurationcape.cgns: CGNS file interfacecape.cli: Othercapecommand-line interface functionscape.color: Color conversion toolscape.config: Surface configuration modulecape.console: Console and Prompt Toolscape.convert: Unit and angle conversion utilitiescape.convert1to2: Utilities to modify CAPE 1.x scripts to 2.0cape.errors: Customized exceptions for CAPEcape.geom: Generic geometry utilitiesgruvoc.umesh: Unstructured volume mesh classcape.gruvoc.umeshbase: Base class for unstructured meshgruvoc.avmfile: Tools for reading CREATE-AVavmfilesgruvoc.flowfile: Tools FUN3D.flowfilesgruvoc.frofile: Tools FUN3D.flowfilesgruvoc.meshbfile: Tools for reading INRIAmeshbfilesgruvoc.solbfile: Tools for reading INRIAsolbfilesgruvoc.pltfile: Tools for Tecplot (R).pltfilesgruvoc.ugridfile: Tools for reading AFLR3ugridfilesgruvoc.trifile: Tools for reading Cart3Dtrifilesgruvoc.ufuncfile: Tools for reading AFLR3ufuncfilesgruvoc.ugridfile: Tools for reading AFLR3ugridfilesgruvoc.trifile: Tools for reading Cart3Dtrifilescape.gruvoc.cli: Command-line interface for CAPE grid conversionsgruvoc.errors: Error classes forgruvocpackagegruvoc.fileutils: Common file analysis toolsgruvoc.geom: Geometry manipulation tools forgruvocgruvoc.surfconfig: Surface name, ID, and property managementgruvoc.volcomp: Functions to calculate element volumescape.fileutils: Pure-Python file information utilitiescape.msh: FLUENT mesh modulenmlfile: Interface to Fortran namelistcape.nmlfile.nmlerr: Errors forNmlFiledataoptdict: Advanceddict-based options interfaceopterror: Errors forOptionsDicttoolsoptdict.optitem: Tools to access items from option listscape.plot3d: Python interface to Plot3D filescape.plt: Interface to Tecplot data filescape.pvutils: Utilities for using PyVista with CAPEcape.sequtils: Tools to analyze 1D iterative historiescape.splitzones: Mesh zone splitting utilitiescape.statutils: Statistics toolscape.step: Python interface to STEP Filescape.sysutils: System utilities for using CAPEcape.teccli: Command-line interfaces to Tecplot(R)cape.text: Text utilities re-exportcape.textutils: Text modification utils for CAPEcape.tri: Triangulated surface mesh interfacecape.tricli: Interfaces to.triand related filescape.triqfm: Command-line interface totriqfmtoolcape.units: Unit Conversion Modulecape.util: Cape utilitiescape.writell: Collect CAPE line load databookscape.xmlfile: Extended interface to XML files_cape: Compiled CAPE extensioncape.pycart: Interfaces to Cart3D
cape.pycart.cntl: Cart3D control modulecape.pycart.options: Cart3D and pyCart Settingscape.pycart.aerocshfile: Cart3Daero.cshinterfacecape.pycart.archivist: Archiving actions specific to Cart3Dcape.pycart.case: Case Control Modulecape.pycart.cli: Interface topycartexecutablecape.pycart.cmdgen: Create commands for Cart3D executablescape.pycart.cmdrun: Cart3D executable interface modulecape.pycart.databook: pyCart data book modulecape.pycart.inputcntlfile: Cart3Dinput.cntlinterfacecape.pycart.lineload: Sectional loads modulecape.pycart.pointSensor: Cart3D point sensors modulecape.pycart.prespecfile: Cart3DpreSpec.c3d.cntlInterfacecape.pycart.report: Automated report interfacecape.pycart.tri: Cart3D.trifile interfacecape.pycart.utilcape.pyfun: FUN3D interfaces
cape.pyfun.cntl: FUN3D control modulecape.pyfun.options: FUN3D and pyFun settingscape.pyfun.casecntl: FUN3D case control modulecape.pyfun.cli: Interface topyfunexecutablecape.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.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.datacape.pyfun.tricli: Special FUN3D triangulation interfacescape.pykes: Interfaces to CREATE-AV Kestrel
cape.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.cli: Interface topykesexecutablecape.pykes.jobxml: Interface to Kestrel main XML control filecape.pykes.cmdgen: Create commands for Kestrel executablescape.pykes.databook: Kestrel data book modulecape.pykes.report: Automated report interfacecape.pyover: Interfaces to OVERFLOW
cape.pyover.cntl: OVERFLOW control modulecape.pyover.options: Options interface for pyOver/OVERFLOWcape.pyover.case: OVERFLOW case control modulecape.pyover.cli: Interface topyoverexecutablecape.pyover.cmdgen: Create commands for OVERFLOW executablescape.pyover.databook: DataBook module for OVERFLOWcape.pyover.overnmlfile: OVERFLOW namelist modulecape.pyover.plot3d: Interface to OVERFLOW Plot3D filescape.pyover.pointsensor: OVERFLOW point sensor data interfacecape.pyover.report: Automated report interfacecape.pyover.util: Utilities forpyovercape.dkit: Package for “datakits”: database + toolkit
cape.dkit: Package for datakits: database + tookitcape.dkit.basedata: Common ATTDB data containercape.dkit.basefile: Common ATTDB file type attributescapefile: Reader for CAPE-specific binary filescape.dkit.csvfile: Comma-separated value read/writecape.dkit.rdb: Main DataKit modulecape.dkit.datakithub: Hub for importing DataKits by namecape.dkit.datakitloader: DataKit collection toolscape.dkit.dbfm: Specialized force & moment DataKitscape.dkit.dbll: Aerodynamic line load DataKitscape.dkit.froot: Nonlinear equation solvercape.dkit.gitutils: Very simple git utils for DataKitscape.dkit.matfile: MATLAB data interfacecape.dkit.metautils: Metadata tools for DataKit collectionscape.dkit.modutils: Module docstring utils for DataKitcape.dkit.pkgutils: Tools for creating DataKit packagescape.dkit.rdbaero: Database Template for Aerospace Variablescape.dkit.tecdatfile: ASCII Tecplot(R) column filescape.dkit.textdata: Generic textual data interfacecape.dkit.tsvfile: Space-separated value read/writecape.dkit.vendorutils: Package Vendorization Utilitiescape.dkit.writedb: Write DataKit processed data to filecape.dkit.xlsfile: Excel spreadsheet data interfacecape.tnakit: Basic TNA Python tool kit
cape.tnakit.kwutils: Tools for Processing Keyword Argumentscape.tnakit.optitem: Option list item access toolscape.plot_mpl: Matplotlib/Pyplot Interfacescape.tnakit.promptutils: Interactive Console Promptcape.tnakit.rstutils: Tools for writing ReST filescape.tnakit.textutils.wrap: Text-wrapping toolkitcape.tnakit.typeutils: Python 2/3 type-check utils- Links to built-in Python features
- Links to third-party modules
Testing
Authors
@ddalle: Derek Dalle <derek.j.dalle@nasa.gov>
@dvicker: Darby Vicker <darby.vicker-1@nasa.gov>
@serogers: Stuart Rogers (retired)
@jmeeroff: Jamie Meeroff <jamie.g.meeroff@nasa.gov>
@aburkhea: Aaron Burkhead <aaron.c.burkhead@nasa.gov>
@jfdiaz3: Josh Diaz <joshua.f.diaz@nasa.gov>
@dschauer: Guy Schauerhamer <daniel.g.schauerhamer@nasa.gov>
Contributing
Notices
Copyright © 2022 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.
Disclaimers
No Warranty: THE SUBJECT SOFTWARE IS PROVIDED “AS IS” WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT “AS IS.”
Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT’S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT’S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT’S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.