cape.pykes.dataBook: Kestrel data book module

This module provides Kestrel-specific interfaces to the various CFD outputs tracked by the cape package.

class cape.pykes.dataBook.CaseFM(comp=None)

Iterative force & moment history for one component, one case

Call:
>>> fm = CaseFM(comp=None)
Inputs:
comp: str

Name of component

Outputs:
fm: CaseFM

One-case iterative history

Versions:
  • 2021-11-08 @ddalle: Version 1.0

create_fname_coeff_dat(comp=None)

Generate full file name for coeff.dat

Call:
>>> fdat = fm.create_fname_coeff_dat(comp=None)
Inputs:
fm: CaseFM

Case force/moment history

comp: {fm.comp} | str

Name of component

Outputs:
fdat: str

Name of file to read

Versions:
  • 2021-11-08 @ddalle: Version 1.0

genr8_fname_coeff_dat(comp=None)

Generate full file name for coeff.dat

Call:
>>> fdat = fm.genr8_fname_coeff_dat(comp=None)
Inputs:
fm: CaseFM

Case force/moment history

comp: {fm.comp} | str

Name of component

Outputs:
fdat: str

Name of file to read

Versions:
  • 2021-11-08 @ddalle: Version 1.0

init_data()

Initialize standard force/moment attributes

Call:
>>> fm.init_data()
Inputs:
fm: CaseFM

Case force/moment history

Versions:
  • 2021-11-08 @ddalle: Version 1.0

read_coeff_dat(fdat=None)

Read coeff.dat from expected data file

Call:
>>> fm.read_coeff_dat(fdat=None)
Inputs:
fm: CaseFM

Case force/moment history

fdat: {None} | str

Optional specific file name

Versions:
  • 2021-11-08 @ddalle: Version 1.0

class cape.pykes.dataBook.CaseProp(fname, **kw)

Iterative property history

Call:
>>> prop = CaseProp(fname)
Inputs:
fname: str

Name of file relative to outputs/ folder

Outputs:
prop: CaseProp

Iterative history of properties in fname

Versions:
  • 2022-01-28 @ddalle: Version 1.0

read_colnames(fname)

Determine column names

Call:
>>> nhdr, cols, coeffs, inds = fm.read_colnames(fname)
Inputs:
fm: CaseFM

Case force/moment history

fname: str

Name of file to process

Outputs:
nhdr: int

Number of header rows to skip

cols: list[str]

List of column names

coeffs: list[str]

List of coefficient names

inds: list[int]

List of column indices for each entry of cols

Versions:
read_dat(fdat)

Read a data file in expected Kestrel format

Call:
>>> prop.read_dat(fdat)
Inputs:
prop: CaseProp

Iterative property history

fdat: str

Name of file to read

Versions:
  • 2022-01-28 @ddalle: Version 1.0

class cape.pykes.dataBook.CaseResid(comp=None)

Iterative residual history for one component, one case

Call:
>>> hist = CaseResid(comp=None)
Inputs:
comp: {None} | str

Name of component

Outputs:
hist: CaseResid

One-case iterative history

Versions:
  • 2021-11-08 @ddalle: Version 1.0

create_fnames(comp=None)

Generate file names for cfd.{core,turb}.dat

Call:
>>> fcore, fturb = hist.create_fnames(comp=None)
Inputs:
hist: CaseResid

Case residual history

comp: {fm.comp} | str

Name of component

Outputs:
fcore: str

Path to cfd.core.dat relative to case folder

fturb: str

Path to cfd.turb.dat relative to case folder

Versions:
  • 2021-11-08 @ddalle: Version 1.0

genr8_fnames(comp=None)

Generate file names for cfd.{core,turb}.dat

Call:
>>> fcore, ftrub = hist.genr8_fnames(comp=None)
Inputs:
hist: CaseResid

Case residual history

comp: {fm.comp} | str

Name of component

Outputs:
fcore: str

Path to cfd.core.dat relative to case folder

fturb: str

Path to cfd.turb.dat relative to case folder

Versions:
  • 2021-11-08 @ddalle: Version 1.0

init_data()

Initialize standard force/moment attributes

Call:
>>> fm.init_data()
Inputs:
fm: CaseFM

Case force/moment history

Versions:
  • 2021-11-08 @ddalle: Version 1.0

make_comp(comp=None)

Figure out a “component” name to use

Call:
>>> comp = hist.make_comp(comp=None)
Inputs:
hist: CaseResid

Case residual history

comp: {None} | str

Directly-specified component name

Outputs:
comp: str | None

Component name, usually first folder found

Versions:
  • 2021-11-08 @ddalle: Version 1.0

read_colnames(fname)

Determine column names

Call:
>>> nhdr, cols, coeffs, inds = hist.read_colnames(fname)
Inputs:
fm: CaseFM

Case force/moment history

fname: str

Name of file to process

Outputs:
nhdr: int

Number of header rows to skip

cols: list[str]

List of column names

coeffs: list[str]

List of coefficient names

inds: list[int]

List of column indices for each entry of cols

Versions:
  • 2021-11-08 @ddalle: Version 1.0

read_core_dat(fdat=None)

Read cfd.core.dat from expected data file

Call:
>>> hist.read_core_dat(fdat=None)
Inputs:
hist: CaseResid

Case residual history

fdat: {None} | str

Optional specific file name

Versions:
  • 2021-11-08 @ddalle: Version 1.0

read_turb_dat(fdat=None)

Read cfd.turb.dat from expected data file

Call:
>>> hist.read_turb_dat(fdat=None)
Inputs:
hist: CaseResid

Case residual history

fdat: {None} | str

Optional specific file name

Versions:
  • 2021-11-08 @ddalle: Version 1.0

save_coeff(col, v)

Save data to coefficient attribute called col

Call:
>>> hist.save_coeff(col, v)
Inputs:
hist: CaseResid

Case residual history

col: str

Name of column

v: np.ndarray

Values to save/append

Versions:
  • 2021-11-08 @ddalle: Version 1.0

save_col(col, v)

Save data to attribute called col

Call:
>>> hist.save_col(col, v)
Inputs:
hist: CaseResid

Case residual history

col: str

Name of column

v: np.ndarray

Values to save/append

Versions:
  • 2021-11-08 @ddalle: Version 1.0

class cape.pykes.dataBook.DBComp(comp, cntl, targ=None, check=False, lock=False, **kw)
class cape.pykes.dataBook.DBTarget(targ, x, opts, RootDir=None)
class cape.pykes.dataBook.DataBook(cntl, RootDir=None, targ=None, **kw)

Primary databook class for Kestrel

Call:
>>> db = DataBook(x, opts)
Inputs:
x: RunMatrix

Current run matrix

opts: Options

Global CAPE options instance

Outputs:
db: DataBook

Databook instance

Versions:
  • 21-11-08 @ddalle: Version 1.0

GetCurrentIter()

Determine iteration number of current folder

Call:
>>> n = db.GetCurrentIter()
Inputs:
db: DataBook

Databook for one run matrix

Outputs:
n: int | None

Iteration number

Versions:
  • 2021-11-08 @ddalle: Version 1.0

ReadCaseFM(comp)

Read a CaseFM object

Call:
>>> fm = db.ReadCaseFM(comp)
Inputs:
db: DataBook

Databook for one run matrix

comp: str

Name of component

Outputs:
fm: CaseFM

Force and moment history

Versions:
  • 2021-11-08 @ddalle: Version 1.0

ReadCaseProp(comp)

Read a CaseProp object

Call:
>>> fm = db.ReadCaseProp(comp)
Inputs:
db: DataBook

Databook for one run matrix

comp: str

Name of component

Outputs:
fm: CaseFM

Force and moment history

Versions:
  • 2022-04-08 @ddalle: Version 1.0

ReadCaseResid()

Read a CaseResid object

Call:
>>> H = DB.ReadCaseResid()
Inputs:
db: DataBook

Databook for one run matrix

Outputs:
H: CaseResid

Residual history

Versions:
  • 2021-11-08 @ddalle: Version 1.0

ReadDBComp(comp, check=False, lock=False)

Initialize data book for one component

Call:
>>> db.ReadDBComp(comp, check=False, lock=False)
Inputs:
db: DataBook

Databook for one run matrix

comp: str

Name of component

check: True | {False}

Whether or not to check LOCK status

lock: True | {False}

If True, wait if the LOCK file exists

Versions:
  • 2021-11-08 @ddalle: Version 1.0

cape.pykes.dataBook.normalize_colname(colname)

Normalize a Kestrel column name, removing special chars

Call:
>>> col = normalize_colname(colname)
Inputs:
colname: str

Raw column name from Kestrel output file

Outputs:
col: str

Normalized column name

Versions:
  • 2021-11-08 @ddalle: Version 1.0