## Displaying Crank Angle for a Multi-cycle Simulation

Four stroke internal combustion engines have a cycle of 720 degrees. Many CONVERGE users want to see crank angle represented as values from 0-720. CONVERGE simulations may span multiple engine cycles, so you could easily end up with solution times from 0-3600 (for example). The following PyTecplot code will create Zone Auxiliary data with the “true” crank angle. The user can then display the value on the plot using &(AUXZONE[ACTIVEOFFSET=1]:Crank_Angle) […]

## Understanding and Automating Viewer Position Angles

Problem: How do I change the viewing angles Psi, Alpha, and Theta from the viewer’s perspective? Also, please help me understand how these angles are defined. Solution: Below is a diagram from the 360 User’s Manual describing how Tecplot defines Psi (Ψ), Theta (θ), and Alpha (α). The following exercise uses PyTecplot to change each of the three angles by 5 degrees and manifests the result after each step. 1)  […]

## Adding a PyTecplot Script to the Quick Macro Panel

Problem: Can I play a PyTecplot script from the Quick Macro Panel (QMP) in Tecplot? Solution: Yes! This procedure describes how to add a PyTecplot script to your QMP using the Histogram.py (found in the python handy scripts of our GitHub): 1) Make sure PyTecplot is installed and updated, along with other modules used in your PyTecplot script (such as numpy). It is also recommended that you install the latest version of Tecplot […]

## Running a Recorded PyTecplot Script Gives Error

Problem: When I run my PyTecplot Python script, I receive a TypeError, ValueError, KeyError, or AttributeError. However, I recorded this script from the 360 user interface, or wrote it using the current Pytecplot documentation, so it should be correct. What is causing this error? For example, running a recorded script using plot.fieldmaps(6,7,8,9,10,11) with PyTecplot 1.0 gives the following error: Traceback (most recent call last): File “C:\recorded_pytecplot.py”, line 17, in <module> tp.active_frame().plot().fieldmaps(6,7,8,9,10,11).mesh.show=False TypeError: […]

## PyTecplot TecplotLibraryNotFoundError Using Python 3.8+

Problem: In batch mode, when I run my PyTecplot script using Python 3.8+ on Windows, I receive an error stating that: tecplot.exception.TecplotLibraryNotFoundError: The Tecplot batch library or one of its dependencies could not be found… What is causing this error? Solution: It is likely that you are using an out-of-date version of PyTecplot. Using PyTecplot in batch mode with Python 3.8 on Windows 10 requires version 1.1 or later. Python […]

## Extract Boundary Layer Values

This article describes both a macro and a PyTecplot script that extracts a field variable along a line normal to a surface. We recommend using PyTecplot insofar as possible. Example: Load the M6-Wing example file, which can be found in your Tecplot Installation Directory: …/Tecplot/Tecplot 360 EX 20xx R1/examples/OneraM6wing/OneraM6_SU2_RANS.plt. To better visualize the node at which we’ll probe, let’s turn on the mesh for the second zone. Zoom somewhere on […]

In the release of PyTecplot 1.0, Frame Linking has been implemented in the API. Frame Linking allows users to quickly link attributes of frames together like position, 3D view, and solution time. To link the view simply implement the following commands on both frames: for frame in tp.frames(): plot = frame.plot(PlotType.Cartesian3D) plot.activate() frame_linking = plot.linking_between_frames frame_linking.group = 1 frame_linking.link_view = True frame_linking.link_solution_time = True This allows all of the frames […]

## Explanation of Cell-Centered data when using NumPy Arrays in PyTecplot

Problem: When reading data of ordered zones in PyTecplot, cell-centered data array lengths do not match the shape of the zone. A cell-centered variable with a 9,9,9 shape has a length of 900. Solution: This is to be expected. In Tecplot 360, for nodal ordered data, the number of nodes is the product of the I-, J-, and K-dimensions. For nodal data, the number of stored values is equal to […]

## Generating Animations One Frame at a Time in Parallel Using PyTecplot

Leveraging Python’s multiprocessing library when paired with PyTecplot scripting creates powerful efficiency. One such example is using multiprocessing to output a large amount of images in parallel. As a result, reducing the time needed to execute. This ParallelImageCreator.py script located in the Tecplot handyscripts GitHub saves every timestep of the active frame as an individual png image. It contains the following arguments: positional arguments: layoutfile Tecplot layout file to open […]