cape.pyover.dataBook
: pyOver 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.pyover.cntl.Cntl.ReadDataBook()
function.
# Read OVERFLOW control instance cntl = pyOver.Cntl("pyOver.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
cape.pyover.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 --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:
- class cape.pyover.dataBook.CaseFM(proj, comp)¶
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 = pyOver.dataBook.CaseFM(proj, comp)
- Inputs:
- proj:
str
Root name of the project
- comp:
str
Name of component to process
- proj:
- Outputs:
- FM:
pyOver.dataBook.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
- FM:
- Versions:
2016-02-02
@ddalle
: First version
- GetFomocoInfo(fname, comp)¶
Get basic stats about an OVERFLOW fomoco file
- Call:
>>> ic, nc, ni = FM.GetFomocoInfo(fname, comp)
- Inputs:
- FM:
pyOver.dataBook.CaseFM
Force and moment iterative history
- fname:
str
Name of file to query
- comp:
str
Name of component to find
- FM:
- Outputs:
- ic:
int
|None
Index of component in the list of components
- nc:
int
|None
Number of components
- ni:
int
Number of iterations
- ic:
- Versions:
2016-02-03
@ddalle
: First version
- MakeEmpty(n=0)¶
Create empty CaseFM instance
- Call:
>>> FM.MakeEmpty()
- Inputs:
- FM:
pyOver.dataBook.CaseFM
Case force/moment history
- FM:
- Versions:
2016-02-03
@ddalle
: First version
- ReadFomocoData(fname, ic, nc, ni, n0=0)¶
Read data from a FOMOCO file with known indices and size
- Call:
>>> FM.ReadFomocoData(fname, ic, nc, ni, n0)
- Inputs:
- FM:
pyOver.dataBook.CaseFM
Force and moment history
- fname:
str
Name of fomoco file
- ic:
int
Index of FM.comp in list of components in fname
- nc:
int
Number of components in fname
- ni:
int
Number of iterations in fname
- n0:
int
Number of iterations already read into FM.data
- FM:
- Versions:
2016-02-03
@ddalle
: First version
- SaveAttributes()¶
Save columns of FM.data as named attributes
- Call:
>>> FM.SaveAttributes()
- Inputs:
- FM:
pyOver.dataBook.CaseFM
Case force/moment history
- FM:
- Versions:
2016-02-03
@ddalle
: First version
- class cape.pyover.dataBook.CaseResid(proj)¶
OVERFLOW iterative residual history class
This class provides an interface to residuals for a given case by reading the files
resid.out
,resid.tmp
,run.resid
,turb.out
,species.out
, etc.- Call:
>>> H = pyOver.dataBook.CaseResid(proj)
- Inputs:
- proj:
str
Project root name
- proj:
- Outputs:
- H:
pyOver.databook.CaseResid
Instance of the residual histroy class
- H:
- Versions:
2016-02-03
@ddalle
: Started
- GetNOrders(nStats=1)¶
Get the number of orders of magnitude of residual drop
- Call:
>>> nOrders = hist.GetNOrders(nStats=1)
- Inputs:
- hist:
pyCart.dataBook.CaseResid
Instance of the DataBook residual history
- nStats:
int
Number of iterations to use for averaging the final residual
- hist:
- Outputs:
- nOrders:
float
Number of orders of magnitude of residual drop
- nOrders:
- Versions:
2015-01-01
@ddalle
: First versoin
- PlotL2(n=None, nFirst=None, nLast=None, **kw)¶
Plot the L2 residual
- Call:
>>> h = hist.PlotL2(n=None, nFirst=None, nLast=None, **kw)
- Inputs:
- hist:
cape.cfdx.dataBook.CaseResid
Instance of the DataBook residual history
- n:
int
Only show the last n iterations
- nFirst:
int
Plot starting at iteration nStart
- nLast:
int
Plot up to iteration nLast
- FigWidth:
float
Figure width
- FigHeight:
float
Figure height
- hist:
- Outputs:
- h:
dict
Dictionary of figure/plot handles
- h:
- Versions:
2014-11-12
@ddalle
: First version2014-12-09
@ddalle
: Moved toAeroPlot
2015-02-15
@ddalle
: Transferred todataBook.Aero
2015-03-04
@ddalle
: Added nStart and nLast2015-10-21
@ddalle
: Referred toPlotResid()
- ReadGlobalHist(fname)¶
Read a condensed global residual file for faster read times
- Call:
>>> i, L = H.ReadGlobalHist(fname)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
i:
numpy.ndarray
(:class:- H:
- Versions:
2016-02-04
@ddalle
: First version
- ReadGlobalL2(grid=None)¶
Read entire global L2 history
The file
history.L2.dat
is also updated.- Call:
>>> H.ReadGlobalL2(grid=None)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- grid: {
None
} |int
|str
If used, read only one grid
- H:
- Versions:
2016-02-04
@ddalle
: First version2017-04-19
@ddalle
: Added grid option
- ReadGlobalLInf(grid=None)¶
Read entire L-infinity norm history
The file
history.LInf.dat
is also updated- Call:
>>> H.ReadGlobalLInf(grid=None)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- grid: {
None
} |int
|str
If used, read only one grid
- H:
- Versions:
2016-02-06
@ddalle
: First version2017-04-19
@ddalle
: Added grid option
- ReadResidGlobal(fname, coeff='L2', n=None, grid=None)¶
Read a global residual using
numpy.loadtxt()
from one file- Call:
>>> i, L2 = H.ReadResidGlobal(fname, coeff="L2", **kw) >>> i, LInf = H.ReadResidGlobal(fname, coeff="LInf", **kw)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- fname:
str
Name of file to process
- coeff:
str
Name of coefficient to read
- n: {
None
} |int
Number of last iteration that’s already processed
- grid: {
None
} |int
|str
If used, read only one grid
- H:
- Outputs:
- i:
np.ndarray
[float
] Array of iteration numbers
- L2:
np.ndarray
[float
] Array of weighted global L2 norms
- LInf:
np.ndarray
[float
] Array of global L-infinity norms
- i:
- Versions:
2016-02-04
@ddalle
: First version2017-04-19
@ddalle
: Added grid option
- ReadResidGrid(fname, grid=None, coeff='L2', n=None)¶
Read a global residual using
numpy.loadtxt()
from one file- Call:
>>> i, L2 = H.ReadResidGrid(fname, grid=None, coeff="L2", **kw) >>> i, LInf = H.ReadResidGrid(fname, grid=None, coeff="LInf", **kw)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- fname:
str
Name of file to process
- grid: {
None
} |int
|str
If used, read history of a single grid
- coeff:
str
Name of coefficient to read
- n:
int
|None
Number of last iteration that’s already processed
- H:
- Outputs:
- i:
np.ndarray
[float
] Array of iteration numbers
- L2:
np.ndarray
[float
] Array of weighted global L2 norms
- LInf:
np.ndarray
[float
] Array of global L-infinity norms
- i:
- Versions:
2017-04-19
@ddalle
: First version
- ReadSpeciesResidL2(grid=None)¶
Read the global L2 norm of the species equations
The file
history.species.L2.dat
is also updated- Call:
>>> H.ReadSpeciesResidL2(grid=None)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- grid: {
None
} |int
|str
If used, read only one grid
- H:
- Versions:
2016-02-06
@ddalle
: First version2017-04-19
@ddalle
: Added grid option
- ReadSpeciesResidLInf(grid=None)¶
Read the global L-infinity norm of the species equations
The file
history.species.LInf.dat
is also updated- Call:
>>> H.ReadSpeciesResidLInf(grid=None)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- grid: {
None
} |int
|str
If used, read only one grid
- H:
- Versions:
2016-02-06
@ddalle
: First version2017-04-19
@ddalle
: Added grid option
- ReadTurbResidL2(grid=None)¶
Read the entire L2 norm of the turbulence residuals
The file
history.turb.L2.dat
is also updated- Call:
>>> H.ReadTurbResidL2(grid=None)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- grid: {
None
} |int
|str
If used, read only one grid
- H:
- Versions:
2016-02-06
@ddalle
: First version2017-04-19
@ddalle
: Added grid option
- ReadTurbResidLInf(grid=None)¶
Read the global L-infinity norm of the turbulence residuals
The file
history.turb.LInf.dat
is also updated- Call:
>>> H.ReadTurbResidLInf()
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- grid: {
None
} |int
|str
If used, read only one grid
- H:
- Versions:
2016-02-06
@ddalle
: First version2017-04-19
@ddalle
: Added grid option
- WriteGlobalHist(fname, i, L, n=None)¶
Write a condensed global residual file for faster read times
- Call:
>>> H.WriteGlobalHist(fname, i, L, n=None)
- Inputs:
- H:
pyOver.dataBook.CaseResid
Iterative residual history class
- i:
np.ndarray
(float
|int
) Vector of iteration numbers
- L:
np.ndarray
[float
] Vector of residuals to write
- n:
int
|None
Last iteration already written to file.
- H:
- Versions:
2016-02-04
@ddalle
: First version
- class cape.pyover.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, x, opts)
- Inputs:
- comp:
str
Name of the component
- x:
pyOver.runmatrix.RunMatrix
RunMatrix for processing variable types
- opts:
pyOver.options.Options
Global pyCart options instance
- targ: {
None
} |str
If used, read a duplicate data book as a target named targ
- comp:
- Outputs:
- DBc:
pyOver.dataBook.DBComp
An individual component data book
- DBc:
- Versions:
2016-09-15
@ddalle
: First version
- class cape.pyover.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:
pyOver.options.DataBook.DBTarget
Instance of a target source options interface
- x:
pyOver.runmatrix.RunMatrix
Run matrix interface
- opts:
pyOver.options.Options
Global pyCart options instance to determine which fields are useful
- targ:
- Outputs:
- DBT:
pyOver.dataBook.DBTarget
Instance of the pyCart data book target data carrier
- DBT:
- Versions:
2014-12-20
@ddalle
: Started
- class cape.pyover.dataBook.DBTriqFM(x, opts, comp, **kw)¶
Force and moment component extracted from surface triangulation
- Call:
>>> DBF = DBTriqFM(x, opts, comp, RootDir=None)
- Inputs:
- x:
cape.runmatrix.RunMatrix
RunMatrix/run matrix interface
- opts:
cape.options.Options
Options interface
- comp:
str
Name of TriqFM component
- RootDir: {
None
} |st
Root directory for the configuration
- x:
- Outputs:
- DBF:
pyFun.dataBook.DBTriqFM
Instance of TriqFM data book
- DBF:
- Versions:
2017-03-28
@ddalle
: First version
- GetTriqFile()¶
Get most recent
triq
file and its associated iterations- Call:
>>> qpre, fq, n, i0, i1 = DBF.GetTriqFile()
- Inputs:
- DBL:
pyOver.dataBook.DBTriqFM
Instance of TriqFM data book
- DBL:
- Outputs:
- qpre: {
False
} Whether or not to convert file from other format
- fq:
str
Name of
q
file- n:
int
Number of iterations included
- i0:
int
First iteration in the averaging
- i1:
int
Last iteration in the averaging
- qpre: {
- Versions:
2016-12-19
@ddalle
: Added to the module
- PreprocessTriq(fq, **kw)¶
Perform any necessary preprocessing to create
triq
file- Call:
>>> ftriq = DBF.PreprocessTriq(fq, qpbs=False, f=None)
- Inputs:
- DBL:
pyOver.dataBook.DBTriqFM
TriqFM data book
- ftriq:
str
Name of q file
- qpbs:
True
| {False
} Whether or not to create a script and submit it
- f: {
None
} |file
File handle if writing PBS script
- DBL:
- Versions:
2016-12-20
@ddalle
: First version2016-12-21
@ddalle
: Added PBS
- ReadTriq(ftriq)¶
Read a
triq
annotated surface triangulation- Call:
>>> DBF.ReadTriq(ftriq)
- Inputs:
- DBF:
pyOver.dataBook.DBTriqFM
Instance of TriqFM data book
- ftriq:
str
Name of
triq
file
- DBF:
- Versions:
2017-03-29
@ddalle
: First version
- class cape.pyover.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
- x:
- Outputs:
- DB:
pyFun.dataBook.DataBook
Instance of the pyFun data book class
- DB:
- Versions:
2015-10-20
@ddalle
: Started
- GetCurrentIter()¶
Determine iteration number of current folder
- Call:
>>> n = DB.GetCurrentIter()
- Inputs:
- DB:
pyOver.dataBook.DataBook
Instance of data book class
- DB:
- Outputs:
- n:
int
|None
Iteration number
- n:
- Versions:
2017-04-13
@ddalle
: First separate version
- ReadCaseFM(comp)¶
Read a
CaseFM
object- Call:
>>> FM = DB.ReadCaseFM(comp)
- Inputs:
- DB:
cape.cfdx.dataBook.DataBook
Instance of data book class
- comp:
str
Name of component
- DB:
- Outputs:
- FM:
pyOver.dataBook.CaseFM
Residual history class
- FM:
- Versions:
2017-04-13
@ddalle
: First separate version
- ReadCaseResid()¶
Read a
CaseResid
object- Call:
>>> H = DB.ReadCaseResid()
- Inputs:
- DB:
cape.cfdx.dataBook.DataBook
Instance of data book class
- DB:
- Outputs:
- H:
pyOver.dataBook.CaseResid
Residual history class
- H:
- Versions:
2017-04-13
@ddalle
: First separate version
- ReadDBComp(comp, check=False, lock=False)¶
Initialize data book for one component
- Call:
>>> DB.ReadDBComp(comp, check=False, lock=False)
- Inputs:
- DB:
pyCart.dataBook.DataBook
Instance of the pyCart data book class
- 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
- DB:
- Versions:
2015-11-10
@ddalle
: First version2016-06-27
@ddalle
: Added targ keyword2017-04-13
@ddalle
: Self-contained and renamed
- ReadPointSensor(name)¶
Read a point sensor group if it is not already present
- Call:
>>> DB.ReadPointSensor(name)
- Inputs:
- DB:
pyOver.dataBook.DataBook
Instance of the pycart data book class
- name:
str
Name of point sensor group
- DB:
- Versions:
2015-12-04
@ddalle
: Copied from pyCart
- ReadTriqFM(comp, check=False, lock=False)¶
Read a TriqFM data book if not already present
- Call:
>>> DB.ReadTriqFM(comp)
- Inputs:
- DB:
pyOver.dataBook.DataBook
Instance of pyOver data book class
- comp:
str
Name of TriqFM component
- check:
True
| {False
} Whether or not to check LOCK status
- lock:
True
| {False
} If
True
, wait if the LOCK file exists
- DB:
- Versions:
2017-03-29
@ddalle
: First version
- cape.pyover.dataBook.ImportPyPlot()¶
Import
matplotlib.pyplot
if not loaded- Call:
>>> pyOver.dataBook.ImportPyPlot()
- Versions:
2014-12-27
@ddalle
: First version2016-01-02
@ddalle
: Copied from pyCart
- cape.pyover.dataBook.ReadFomocoComps(fname)¶
Get list of components in an OVERFLOW fomoco file
- Call:
>>> comps = pyOver.dataBook.ReadFomocoComps(fname)
- Inputs:
- fname:
str
Name of the file to read
- fname:
- Outputs:
- comps:
list
[str
] List of components
- comps:
- Versions:
2016-02-03
@ddalle
: First version
- cape.pyover.dataBook.ReadFomocoNIter(fname, nComp=None)¶
Get number of iterations in an OVERFLOW fomoco file
- Call:
>>> nIter = pyOver.dataBook.ReadFomocoNIter(fname) >>> nIter = pyOver.dataBook.ReadFomocoNIter(fname, nComp)
- Inputs:
- fname:
str
Name of file to read
- nComp:
int
|None
Number of components in each record
- fname:
- Outputs:
- nIter:
int
Number of iterations in the file
- nIter:
- Versions:
2016-02-03
@ddalle
: First version
- cape.pyover.dataBook.ReadResidFirstIter(fname)¶
Read the first iteration number in an OVERFLOW residual file
- Call:
>>> iIter = pyOver.dataBook.ReadResidFirstIter(fname) >>> iIter = pyOver.dataBook.ReadResidFirstIter(f)
- Inputs:
- fname:
str
Name of file to query
- f:
file
Already opened file handle to query
- fname:
- Outputs:
- iIter:
int
Iteration number from first line
- iIter:
- Versions:
2016-02-04
@ddalle
: First version
- cape.pyover.dataBook.ReadResidGrids(fname)¶
Get list of grids in an OVERFLOW residual file
- Call:
>>> grids = pyOver.dataBook.ReadResidGrids(fname)
- Inputs:
- fname:
str
Name of file to read
- fname:
- Outputs:
- grids:
list
[str
] List of grids
- grids:
- Versions:
2016-02-04
@ddalle
: First version
- cape.pyover.dataBook.ReadResidLastIter(fname)¶
Read the first iteration number in an OVERFLOW residual file
- Call:
>>> nIter = pyOver.dataBook.ReadResidLastIter(fname) >>> nIter = pyOver.dataBook.ReadResidLastIter(f)
- Inputs:
- fname:
str
Name of file to query
- f:
file
Already opened file handle to query
- fname:
- Outputs:
- nIter:
int
Iteration number from last line
- nIter:
- Versions:
2016-02-04
@ddalle
: First version
- cape.pyover.dataBook.ReadResidNGrids(fname)¶
Get number of grids from an OVERFLOW residual file
- Call:
>>> nGrid = pyOver.dataBook.ReadResidNGrids(fname)
- Inputs:
- fname:
str
Name of file to read
- fname:
- Outputs:
- nGrid:
int
Number of grids
- nGrid:
- Versions:
2016-02-04
@ddalle
: First version
- cape.pyover.dataBook.ReadResidNIter(fname)¶
Get number of iterations in an OVERFLOW residual file
- Call:
>>> nIter = pyOver.dataBook.ReadResidNIter(fname)
- Inputs:
- fname:
str
Name of file to query
- fname:
- Outputs:
- nIter:
int
Number of iterations
- nIter:
- Versions:
2016-02-04
@ddalle
: Version 1.02022-01-09
@ddalle
: Version 1.1; Python 3 int division