cape.plt
: Python interface to Tecplot PLT files¶
This module provides the class cape.plt.Plt
, which intends to read and
write Tecplot binary or ASCII PLT files for surface grid solutions. It does
not use the TecIO library to avoid causing unnecessary dependencies for the
software.
This class cannot read any generic .plt
file; it focuses on surface grids
with a mix of triangles and quads. In particular it is closely paired with
the trifile
triangulation module. The initial driving cause for
creating this module was to read FUN3D boundary solution files and convert them
to annotated Cart3D triq
format for input to triload
and other
post-processing based on the trifile
module.
See also:
trifile
pc_Tri2Plt
pc_Plt2Tri
- class cape.plt.Plt(fname=None, dat=None, triq=None, **kw)¶
Interface for Tecplot PLT files
- Call:
>>> plt = cape.plt.Plt(fname=None, dat=None, triq=None, **kw)
- Inputs:
- fname: {
None
} |str
Name of binary PLT file to read
- dat: {
None
} |str
Name of ASCII file to read
- triq: {
None
} |trifile.Triq
Annotated triangulation interface
- fname: {
- Outputs:
- plt:
cape.plt.Plt
Tecplot PLT interface
- plt.nVar:
int
Number of variables
- plt.Vars:
list
(str
) List of of variable names
- plt.nZone:
int
Number of zones
- plt.Zone:
int
Name of each zone
- plt.nPt:
np.ndarray
(int
, nZone) Number of points in each zone
- plt.nElem:
np.ndarray
(int
, nZone) Number of elements in each zone
- plt.Tris:
list
(np.ndarray
(N,4)) List of triangle node indices for each zone
- plt:
- Versions:
2016-11-22
@ddalle
: First version2017-08-24
@ddalle
: Added ASCII input capability
- ConvertTriq(triq, **kw)¶
Create a PLT object by reading data from a Tri/Triq object
- Call:
>>> plt.ConvertTriq(triq)
- Inputs:
- plt:
cape.plt.Plt
Tecplot PLT interface
- triq:
trifile.Triq
Surface triangulation with or without solution (triq.q)
- CompIDs:
list
(int
) List of CompIDs to consider
- plt:
- Versions:
2017-03-30
@ddalle
: First version
- CreateTri(**kw)¶
Create a Cart3D triangulation (
.tri
) file- Call:
>>> tri = plt.CreateTri(**kw)
- Inputs:
- plt:
pyFun.plt.Plt
Tecplot PLT interface
- CompID: {
range(len(plt.nZone))
} |list
Optional list of zone numbers to use
- plt:
- Outputs:
- tri:
trifile.Tri
Cart3D triangulation interface
- tri:
- Versions:
2016-12-19
@ddalle
: Version 1.02021-01-06
@ddalle
: Version 1.1; fork CreateTriq()
- CreateTriq(**kw)¶
Create a Cart3D annotated triangulation (
triq
) interfaceThe primary purpose is creating a properly-formatted triangulation for calculating line loads with the Chimera Grid Tools function
triloadCmd
, which requires the five fundamental states plus the pressure coefficient for inviscid sectional loads. For complete sectional loads including viscous contributions, the Tecplot interface must also have the skin friction coefficients.The triq interface will have either 6 or 9 states, depending on whether or not the viscous coefficients are present.
Alternatively, if the optional input triload is
False
, the triq output will have whatever states are present in plt.- Call:
>>> triq = plt.CreateTriq(mach=1.0, triload=True, **kw)
- Inputs:
- plt:
pyFun.plt.Plt
Tecplot PLT interface
- mach: {
1.0
} | positivefloat
Freestream Mach number for skin friction coeff conversion
- CompID: {
range(len(plt.nZone))
} |list
Optional list of zone numbers to use
- triload: {
True
} |False
Whether or not to write a triq tailored for
triloadCmd
- avg: {
True
} |False
Use time-averaged states if available
- rms:
True
| {False
} Use root-mean-square variation instead of nominal value
- plt:
- Outputs:
- triq:
trifile.Triq
Annotated Cart3D triangulation interface
- triq:
- Versions:
2016-12-19
@ddalle
: First version
- Read(fname)¶
Read a Fun3D boundary Tecplot binary file
- Call:
>>> plt.Read(fname)
- Inputs:
- plt:
pyFun.plt.Plt
Tecplot PLT interface
- fname:
str
Name of file to read
- plt:
- Versions:
2016-11-22
@ddalle
: Version 1.02022-09-16
@ddalle
: Version 2.0; unstruc volume
- ReadDat(fname)¶
Read an ASCII Tecplot data file
- Call:
>>> plt.ReadData(fname)
- Inputs:
- plt:
pyFun.plt.Plt
Tecplot PLT interface
- fname:
str
Name of file to read
- plt:
- Versions:
2017-08-24
@ddalle
: Version 1.02022-08-30
@ddalle
: Version 1.1; default title
- Write(fname, Vars=None, **kw)¶
Write a Fun3D boundary Tecplot binary file
- Call:
>>> plt.Write(fname, Vars=None, **kw)
- Inputs:
- plt:
pyFun.plt.Plt
Tecplot PLT interface
- fname:
str
Name of file to read
- Vars: {
None
} |list
(str
) List of variables (by default, use all variables)
- CompID: {
range(len(plt.nZone))
} |list
Optional list of zone numbers to use
- plt:
- Versions:
2017-03-29
@ddalle
: Version 1.02017-05-16
@ddalle
: Version 1.1; variable list2017-12-18
@ddalle
: Version 1.2; CompID input
- WriteDat(fname, Vars=None, **kw)¶
Write Tecplot PLT file to ASCII format (
.dat
)- Call:
>>> plt.WriteDat(fname, Vars=None, **kw)
- Inputs:
- plt:
cape.plt.Plt
Tecplot PLT interface
- fname:
str
Name of DAT file to write
- Vars: {
None
} |list
(str
) List of variables (by default, use all variables)
- CompID: {
range(len(plt.nZone))
} |list
Optional list of zone numbers to use
- feblock: {
True
} |False
Option to use (deprecated) FEBLOCK format
- plt:
- Versions:
2017-03-30
@ddalle
: v1.02017-05-16
@ddalle
: v1.1; add variable list2017-12-18
@ddalle
: v1.2; add CompID input2023-07-14
@ddalle
: v1.3; make ‘FEBLOCK’ optional
- cape.plt.Plt2Triq(fplt, ftriq=None, **kw)¶
Convert a Tecplot PLT file to a Cart3D annotated triangulation (TRIQ)
- Call:
>>> Plt2Triq(fplt, ftriq=None, **kw)
- Inputs:
- fplt:
str
Name of Tecplot PLT file
- ftriq: {
None
} |str
Name of output file (default: replace extension with
.triq
)- mach: {
1.0
} | positivefloat
Freestream Mach number for skin friction coeff conversion
- triload: {
True
} |False
Whether or not to write a triq tailored for
triloadCmd
- avg: {
True
} |False
Use time-averaged states if available
- rms:
True
| {False
} Use root-mean-square variation instead of nominal value
- fplt:
- Versions:
2016-12-20
@ddalle
: First version
- cape.plt.getind(V, k, j=None)¶
Get an index of a variable in a list if possible
- Call:
>>> i = getind(V, k, j=None)
- Inputs:
- V:
list
(str
) List of headers
- k:
str
Header name
- j:
int
| {None
} Default index if k not in V
- V:
- Outputs:
- i:
int
|None
Index of k in V if possible
- i:
- Versions:
2016-12-19
@ddalle
: First version