CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Tecplot (https://www.cfd-online.com/Forums/tecplot/)
-   -   Need help in loading data (https://www.cfd-online.com/Forums/tecplot/218440-need-help-loading-data.html)

@sher June 20, 2019 08:19

Need help in loading data
 
Hi all!
I ran a transient simulation with the solution export in Tecplot format enabled. I was exporting data every 100 time-steps. This gave me a large number of files in Tecplot format (.plt). Now, when I load all files at once in Tecplot, it opens all files at once, merging them together. The option of solution animation is also greyed out. What am I doing wrong?

wsfowler June 24, 2019 13:47

For data to be recognized as transient, Tecplot zones need both a Solution Time and Strand attribute assigned to them.

Strand is an integer value which identifies "like" zones through time. A positive value indicates transient. A value of zero indicates non-transient.

If this information is not embedded in the file by your solver, Tecplot will (as you've noticed) not recognize the data as transient and will attempt to load all the data at once.

You could use PyTecplot, the Python API to Tecplot 360 to modify the PLT files as such:

Code:

import glob
import tecplot as tp
files = glob.glob("*.plt")
for plt_file in files:
    tp.new_layout()
    dataset = tp.data.load_tecplot(plt_file )
    for zone in dataset.zones():
        zone.solution_time = some_solution_time
        zone.strand = some_strand
    tp.data.save_tecplot_plt(plt_file )

You'll have to come up with a strategy for determining the Strand numbers for each zone. If each of your PLT files has the same number of zones, the easiest approach would be to simply use the zone number like so:

Code:

zone.strand = zone.index+1
Note that indices in PyTecplot are zero based, hence the +1.

@sher June 24, 2019 15:26

Quote:

Originally Posted by wsfowler (Post 737119)
For data to be recognized as transient, Tecplot zones need both a Solution Time and Strand attribute assigned to them.

Strand is an integer value which identifies "like" zones through time. A positive value indicates transient. A value of zero indicates non-transient.

If this information is not embedded in the file by your solver, Tecplot will (as you've noticed) not recognize the data as transient and will attempt to load all the data at once.

You could use PyTecplot, the Python API to Tecplot 360 to modify the PLT files as such:

Code:

import glob
import tecplot as tp
files = glob.glob("*.plt")
for plt_file in files:
    tp.new_layout()
    dataset = tp.data.load_tecplot(plt_file )
    for zone in dataset.zones():
        zone.solution_time = some_solution_time
        zone.strand = some_strand
    tp.data.save_tecplot_plt(plt_file )

You'll have to come up with a strategy for determining the Strand numbers for each zone. If each of your PLT files has the same number of zones, the easiest approach would be to simply use the zone number like so:

Code:

zone.strand = zone.index+1
Note that indices in PyTecplot are zero based, hence the +1.



I really appreciate the time you took to help me out. I'll work on it and post whether I made any progress. Thanks!

ztnuaa August 2, 2019 03:49

wsfowler's solution is very good and PyTecplot is really awesome.
If you don't want to learn PyTecplot's api, here is an easy way.
I assume your .plt file is formatted( which you can edit them directly), just add
"SOLUTIONTIME=your_data_time" under
the line "Zone T=" your_data_zone " ".
Here is an example:

Code:

Variables = "X", "Y", "Z", "X Velocity", "Y Velocity", "Z Velocity", "Diameter", " Temperature"
Zone T=" Droplet-0.031 "
 SOLUTIONTIME=0.031
0.0398262        -0.00222718        -0.0048075        35.3844        -0.0931421        -0.145178        2.65511e-05        348.83

If you have many data files to edit, it's better to write a program to add the solutiontime line automatically. Then load them to tecplot and it will recognized the time strands.

wsfowler August 5, 2019 14:30

By convention binary files are .plt and ASCII files are .dat. Of course we can't regulate that out in the real world. Your solution is a good one for ASCII files, but won't work with binary files.


All times are GMT -4. The time now is 11:31.