cape.pyfun.dataBook: pyFun data book module

This module contains functions for reading and processing forces, moments, and other statistics from cases in a trajectory. Data books are usually created by using the cape.pyfun.cntl.Cntl.ReadDataBook() function.

# Read FUN3D control instance
cntl = pyFun.Cntl("pyFun.json")
# Read the data book
cntl.ReadDataBook()
# Get a handle
DB = cntl.DataBook

# Read a line load component
DB.ReadLineLoad("CORE_LL")
DBL = DB.LineLoads["CORE_LL"]
# Read a target
DB.ReadTarget("t97")
DBT = DB.Targets["t97"]

Data books can be created without an overall control structure, but it requires creating a run matrix object using pyFun.runmatrix.RunMatrix, so it is a more involved process.

Data book modules are also invoked during update and reporting command-line calls.

$ pyfun --aero
$ pyfun --ll
$ pyfun --pt
$ pyfun --triqfm
$ pyfun --report

The available components mirror those described on the template data book modules, cape.cfdx.dataBook, cape.cfdx.lineLoad, and cape.cfdx.pointSensor. However, some data book types may not be implemented for all CFD solvers.

See Also:

Global pyFun data book: pyFun.dataBook.DataBook

class cape.pyfun.dataBook.DataBook(cntl, RootDir=None, targ=None, **kw)

This class provides an interface to the data book for a given CFD run matrix.

Call:
>>> DB = pyFun.dataBook.DataBook(x, opts)
Inputs:
x: pyFun.runmatrix.RunMatrix

The current pyFun trajectory (i.e. run matrix)

opts: pyFun.options.Options

Global pyFun options instance

Outputs:
DB: pyFun.dataBook.DataBook

Instance of the pyFun data book class

Versions:
  • 2015-10-20 @ddalle: Started

Individual data books

class cape.pyfun.dataBook.DBComp(comp, cntl, targ=None, check=False, lock=False, **kw)

Individual component data book

This class is derived from cape.cfdx.dataBook.DBBase.

Call:
>>> DBc = DBComp(comp, cntl)
Inputs:
comp: str

Name of the component

x: cape.runmatrix.RunMatrix

RunMatrix for processing variable types

opts: cape.options.Options

Global pyCart options instance

targ: {None} | str

If used, read a duplicate data book as a target named targ

Outputs:
DBc: pyOver.dataBook.DBComp

An individual component data book

Versions:
  • 2016-09-15 @ddalle: Version 1.0

class cape.pyfun.dataBook.DBTarget(targ, x, opts, RootDir=None)

Class to handle data from data book target files

There are more constraints on target files than the files that data book creates, and raw data books created by pyCart are not valid target files.

Call:
>>> DBT = DBTarget(targ, x, opts)
Inputs:
targ: pyFun.options.DataBook.DBTarget

Instance of a target source options interface

x: pyFun.runmatrix.RunMatrix

Run matrix interface

opts: pyFun.options.Options

Global pyCart options instance to determine which fields are useful

Outputs:
DBT: pyFun.dataBook.DBTarget

Instance of the pyCart data book target data carrier

Versions:
  • 2014-12-20 @ddalle: Started

Data book classes for individual cases

class cape.pyfun.dataBook.CaseFM(proj, comp)

Iterative force & moment histories for one case, one component

This class contains methods for reading data about an the history of an individual component for a single case. It reads the Tecplot file $proj_fm_$comp.dat where proj is the lower-case root project name and comp is the name of the component. From this file it determines which coefficients are recorded automatically.

Call:
>>> FM = CaseFM(proj, comp)
Inputs:
proj: str

Root name of the project

comp: str

Name of component to process

Outputs:
FM: pyFun.aero.FM

Instance of the force and moment class

FM.C: list[str]

List of coefficients

FM.i: numpy.ndarray shape=(0,)

List of iteration numbers

FM.CA: numpy.ndarray shape=(0,)

Axial force coefficient at each iteration

FM.CY: numpy.ndarray shape=(0,)

Lateral force coefficient at each iteration

FM.CN: numpy.ndarray shape=(0,)

Normal force coefficient at each iteration

FM.CLL: numpy.ndarray shape=(0,)

Rolling moment coefficient at each iteration

FM.CLM: numpy.ndarray shape=(0,)

Pitching moment coefficient at each iteration

FM.CLN: numpy.ndarray shape=(0,)

Yaw moment coefficient at each iteration

Versions:
  • 2014-11-12 @ddalle: Starter version

  • 2014-12-21 @ddalle: Copied from previous aero.FM

  • 2015-10-16 @ddalle: Self-contained version

  • 2016-05-05 @ddalle: Handles adaptive;

    pyfun00,pyfun01,...

  • 2016-10-28 @ddalle: Catching iteration resets

class cape.pyfun.dataBook.CaseResid(proj)

FUN3D iterative history class

This class provides an interface to residuals, CPU time, and similar data for a given case

Call:
>>> hist = pyFun.dataBook.CaseResid(proj)
Inputs:
proj: str

Project root name

Outputs:
hist: pyFun.dataBook.CaseResid

Instance of the run history class

Versions:
  • 2015-10-21 @ddalle: Version 1.0

  • 2016-10-28 @ddalle: Catching iteration resets

Other cape.pyfun.dataBook methods