cape.plt: Interface to Tecplot data files¶
This module provides the class cape.pltfile.Plt, which intends to
read and write Tecplot binary or ASCII PLT files for surface grid
solutions. (It may also support other file types.) 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 cape.tri 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
cape.tri module.
See also:
cape.tri
cape.pyfun.plt
- class cape.pltfile.Plt(fname=None, dat=None, triq=None, **kw)¶
Interface for Tecplot PLT files
- Call:
>>> plt = cape.pltfile.Plt(fname=None, dat=None, triq=None, **kw)
- Inputs:
- Outputs:
- plt:
cape.pltfile.Plt Tecplot PLT interface
- pltfile.nVar:
int Number of variables
- pltfile.Vars:
list(str) List of of variable names
- pltfile.nZone:
int Number of zones
- pltfile.Zone:
int Name of each zone
- pltfile.nPt:
np.ndarray(int, nZone) Number of points in each zone
- pltfile.nElem:
np.ndarray(int, nZone) Number of elements in each zone
- pltfile.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:
>>> pltfile.ConvertTriq(triq)
- Inputs:
- plt:
cape.pltfile.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 = pltfile.CreateTri(**kw)
- Inputs:
- plt:
pyFun.pltfile.Plt Tecplot PLT interface
- CompID: {
range(len(pltfile.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 = pltfile.CreateTriq(mach=1.0, triload=True, **kw)
- Inputs:
- plt:
pyFun.pltfile.Plt Tecplot PLT interface
- mach: {
1.0} | positivefloat Freestream Mach number for skin friction coeff conversion
- CompID: {
range(len(pltfile.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:
>>> pltfile.Read(fname)
- Inputs:
- plt:
pyFun.pltfile.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:
>>> pltfile.ReadData(fname)
- Inputs:
- plt:
pyFun.pltfile.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:
>>> pltfile.Write(fname, Vars=None, **kw)
- Inputs:
- 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:
>>> pltfile.WriteDat(fname, Vars=None, **kw)
- Inputs:
- plt:
cape.pltfile.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(pltfile.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.pltfile.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.pltfile.getind(V, k, j=None)¶
Get an index of a variable in a list if possible