tecio.cli.tecelretyp

tecio.cli.tecelretyp#

Retype finite-element zones whose cells are all stored as a larger cell type.

Most unstructured mesh multi-physics solvers support volume cells with degenerate edges such that multiple cell types can be stored in the same block with square connectivity arrays. However, if all cells are upcast when they are written to disk as FEBRICK for all classical volume cells and FEQUADRILATERAL for surface cells, node indices of upcast cells are repeated describe the smaller cells and incurring more memory. Therefore, zones where all cells are upcast can be rewritten with the zone type with the least required memory allocation and a compact node map. For example a solution file containing tetrahedra volume cells and triangle surface cells can be written with hexahedral and quadralateral cells respectively. tecelretyp finds such zones and downcasts them as:

  • FEBRICK zones whose cells are all tetrahedra become FETETRAHEDRON.

  • FEQUADRILATERAL zones whose cells are all triangles become FETRIANGLE.

Detection does not assume a repeat convention (see tecio.classify_cells()), and the handedness of each cell is kept. Node indices are not renumbered, so every variable, nodal or cell-centered, is copied unchanged. Zones that share connectivity are retyped together.

A zone that holds several cell shapes, such as tetrahedra with pyramids and prisms, has no classic zone type to collapse to. With --femixed it is written as a FEMIXED zone instead, with one section per shape (see tecio.split_cells_by_shape()). The cells are then grouped by shape, so cell-centered variables are reordered to match. FEMIXED zones need .szplt output. Every other zone is copied unchanged.

--dry-run lists what would change and ends with the estimated size of the connectivity (the node maps, which are the part retyping changes) under each option, including as polyhedral or polygonal zones, and with the commands that give each saving. Poly output cannot be written by this tool and is only an estimate.

Usage:

tecelretyp [-h] [-z LIST] [--femixed] [--dry-run] [--check]
           [--drop-face-neighbors] [-o PATH] [-f] PATH
Positional Arguments:
PATH

Path to the input Tecplot file (.szplt, .plt or .dat).

Options:
-z LIST, --zones LIST

Comma-separated list of 0-based zone indices to consider (e.g. -z 0,2). Other zones are copied unchanged. A group of zones sharing connectivity is only retyped if every zone in it is listed. If omitted, all zones are considered.

--femixed

Write zones that hold several cell shapes as FEMIXED zones. Needs .szplt output, which is then the default for the output name. Face-neighbor data is discarded, as for any .szplt output.

--dry-run

Print what would change, the estimated sizes and suggested commands, and write nothing.

--check

Like --dry-run, and exit with status 1 if any zone could be retyped (and 0 if none could), for use in scripts. Errors exit with status 2.

--drop-face-neighbors

Retype zones that have face-neighbor data, discarding that data. Face numbers depend on the cell type, so the data cannot be carried over, and without this flag such zones are left as they are. Ignored for .szplt output, which does not store face-neighbor data.

-o PATH, --output PATH

Output file path. The extension controls the output format: .szplt, .plt or .dat. Defaults to <stem>_retyped<ext> in the same directory as the input file.

-f, --force

Overwrite the output file if it already exists.

Returns:

A new Tecplot file with the retypable zones rewritten, all other zones unchanged. If no zone can be retyped, no file is written. Exit code 0 on success and 1 if the input cannot be read, a zone index is out of range, the output exists without --force, --femixed is given with .plt or .dat output, or writing fails (2 for errors under --check).

Examples

See what could be retyped, and how much it would save, without writing anything:

$ tecelretyp --dry-run flow.plt

Retype and write to a new file:

$ tecelretyp flow.plt -o flow_compact.plt

Retype and convert to SZL in one step:

$ tecelretyp flow.plt -o flow_compact.szplt

Also write zones of mixed cell shapes as FEMIXED:

$ tecelretyp --femixed flow.plt -o flow_compact.szplt

Fail a pipeline if a file still holds upcast cells:

$ tecelretyp --check flow.plt

Call directly from a Python session:

from tecio.cli.tecelretyp import main as tecelretyp

tecelretyp(["flow.plt", "-o", "flow_compact.plt"])

See also

tecio.collapse_cells(), tecio.split_cells_by_shape() and tecio.classify_cells() - The node map functions this tool is built on.

tecio.cli.teconvert - Convert between Tecplot file formats.

Functions

main([argv])

Retype finite-element zones that hold only smaller cells.