The cape.pycart module

The cape.pycart module contains the top-level interface for Cart3D setup. It loads the most important methods from the various submodules so that they are easier to access. Most tasks using the pyCart API can be accessed by loading this module.

import cape.pycart

For example the following will read in a global settings instance assuming that the present working directory contains the correct files. (If not, various defaults will be used, but it is unlikely that the resulting setup will be what you intended.)

import cape.pycart
cntl = pyCart.Cntl()

A simpler example is to simply read a .tri file, rotate it about the x-axis by 20 degrees, and write it to a new file.

# Import the module.
import cape.pycart
# Read the .tri file.
tri = pyCart.Tri('bJet.i.tri')
# Rotate it.
tri.Rotate([0.,0.,0.], [1.,0.,0.], 20)
# Write it to a new file.
tri.Write('bJet_rotated.i.tri')

Most of the pyCart submodules essentially contain a one or more class definitions, and some of these classes are accessible directly from cape.pycart.

The module also contains the cape.pycart.bin module, which contains functions that run the main Cart3D binaries: autoInputs, cubes, mgPrep, and flowCart.

The following classes are imported in this module, so that code like cape.pycart.Tri will work (although cape.pycart.tri.Tri) will also work.

Modules included within this one are outlined below.

The following lists the pyCart submodules, which contain the main functionality and define the classes that are the workhorses of pyCart.