Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

TECPLOT.markdown 6.15 KB
Newer Older
1
2
3
author: Camilla D. K. Harris

email: cdha@umich.edu
4
5
6
7
8
9
10
11
12
13
14
15

Visualization of SWMF output with Tecplot
=========================================
To be completed.

Generating Tecplot-readable output
----------------------------------
- summary of tecplot functionality in #SAVEPLOT command
- use of #SAVETECPLOT and #SAVETECPLOTBINARY commands

Using pytecplot
---------------
16
17
18
Tecplot and pytecplot require a valid Tecplot 360 license to use. Please
consult the [pytecplot documentation](https://www.tecplot.com/docs/pytecplot/)
for the most definitive and up-to-date information.
19
20

The latest version of pytecplot can be installed with `pip install pytecplot`.
21
22
Linux and Windows users should consult the installation sections of the
[pytecplot documentation](https://www.tecplot.com/docs/pytecplot/install.html)
23
24
25
26
for further details; the rest of this section pertains to MacOS users.

MacOS users running python scripts which use pytecplot can connect to the
Tecplot engine either through a running instance of the Tecplot GUI or
27
28
29
automatically in "batch" mode by setting the appropriate environment variable.

### Connect a python script to a running instance of Tecplot
30
31

To connect a script to a running instance of Tecplot, open the Tecplot GUI.
32
33
34
35
Select *Scripting > PyTecplot Connections...* from the drop-down menus to open
the **PyTecplot Connections** dialog. Then tick the box to 
**Accept connections** from the port number of your choice. Then in your python
script add the following line immediately after your import statements:
36
37
38
39
40
41
42
43
```python
import tecplot

tecplot.session.connect(port=7600)

...
```
Be sure that the port numbers match.
44
In the terminal you will be able to run your script:
45
46
47
48
49
```bash
python my_pytecplot_script.py
```
And the effects will be mirrored in the GUI.

50
51
### Run a python script in batch mode

52
53
54
To run a script without connecting to a running instance of Tecplot requires
setting the `DYLD_LIBRARY_PATH` environment variable so that it references the
Tecplot libraries. However, it is not recommended to set this variable
55
56
57
58
permanently as this will cause severe conflicts with other applications.
Tecplot provides their own [recommendations for temporarily setting the
environment variable](https://www.tecplot.com/docs/pytecplot/install.html#id22)
but a simple solution is as follows:
59
60
61
62
63
64

Add the following line to your `.bash_profile` or `.bashrc` file:
```bash
alias runpytecplot='env DYLD_LIBRARY_PATH="/Applications/Tecplot 360 EX 2019 R1/Tecplot 360 EX 2019 R1.app/Contents/MacOS/"'
```
Be sure to replace `2019 R1` with the appropriate version and check that the
65
66
67
path is valid on your system. Use `source` with your bash profile to make the
alias available to your environment. Then your script can be run from the
terminal like so:
68
69
```bash
runpytecplot python my_pytecplot_script.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
```

The SZL file format
------------------
Tecplot can show and manipulate data that is stored on a remote machine such as
NASA Pleiades from the GUI on your university desktop. There are a few
limitations and caveats:

- The remote machine should use a linux operating system (as do most
  supercomputers) and have Tecplot installed.
- The remote machine should have the `szlserver` tool installed (this ships
  with Tecplot and can be installed in the user’s home directory). See
  Tecplot's [advice regarding szlserver](https://www.tecplot.com/products/szl-server/).
- The remote data must be in the SZL file format (files can be converted easily
  with tecplot’s batch processing command line tool).

After the initial set up there are a couple extra steps, but once remote data
is loaded it can be manipulated and inspected in the Tecplot GUI just as if the
data was stored on the client computer. SWMF users may find this useful for
inspecting simulations in progress before committing to a possibly lengthy
download.

### Setting up

#### Install szlserver

Log in to the remote machine and run the installation script provided by
Tecplot.
```bash
bash /path/to/tecplot/2019r1/360ex_2019r1/szlserver/tecplotszlserver2019r1_linux64.sh
```
The path will certainly change as new versions of Tecplot are released, so be
sure to check that the path is valid and up to date. Bear in mind that you may
need to load a Tecplot module to access the software; consult the remote
system's user guide or software documentation.

On most HPC systems you will not have root privileges, so follow the prompts to
install the tool in your home directory. Afterwards you will need to add the
tool to your path; in bash you can do this by adding the following line to your
bash profile:
```bash
PATH=$PATH:$HOME/tecplotszlserver2019r1/bin
```
Again, be sure the version and path is correct. Afterwards use `source` and try
`which szlserver` to be sure that the tool is installed and on your system's
path.

#### Convert data to SZL file format

On the remote machine navigate to the directory where your data is located. Try
`which tec360` to be sure that the Tecplot batch processing tool is installed.
If it is not installed see the [Tecplot User's Guide](http://download.tecplot.com/360/current/360_users_manual.pdf)
for details on batch processing.

Run the following command to convert a single file to SZL format:
```bash
tec360 z=0_mhd.plt -o output.szplt
```

If your simulation results span many `.plt` files (multiple time steps, or
multiple iterations) you can combine the multiple zones into one SZL file.
```bash
tec360 z=0_mhd_*.plt -o output.szplt
```

### Loading remote data

On your desktop, open the Tecplot GUI. Select *File > Load Remote Data...* from
the drop-down menus to open the **Remote Data Load Options** dialog. Select 
**Manual Connection** and from there select **Connect**. This will open the 
**Waiting for Server Connection** dialog.

The dialog will provide you with a command that will look something like:
```bash
szlserver -m ???.???.???.??? -p ????? -k ?????????
```

Log into the remote machine and run the command that Tecplot provided.

Once the connection is established, the **Waiting...** dialog on your local
machine should close and the **Remote...** dialog should permit you to select
data from the remote machine. Find the SZL data and load it.

From here the remote data can be manipulated in the GUI and plots can be
exported on your local machine.