Manuel Hasert asks Tecplot Support:
I'm interested in coupling my Lattice Boltzmann code to the tecio library.
I have written an interface for outputting ascii formatted tecplot files. But now as my simulations get bigger, I would like to create binary files directly. As the simulations are unsteady, I have created a zone for each timestep. The geometry is purely cartesian and includes some variables as pressure, density and velocity.
Now, could you give me a hint, how to use the tecio most efficiently. It seems to be quite powerful, but I don't need all the functionality. I have attached a sample tecplot file and the output routine.
Your help is greatly appreciated.
Dipl.-Ing. Manuel Hasert
Scalable Computing & Coupled Systems
High Performance Computing Center Stuttgart (HLRS)
First, the header is written:
write(11,*) 'title="LBM-Simulation Re=',tNum2,'umax=',tNum3,'"'
write(11,*) 'VARIABLES = X, Y, PRESS,uX, uY, density, state'
write(11,*) 'VARIABLES = X, Y, Z, PRESS, uX, uY, uZ, density, state'
Then, the values are written out in a loop over each point in the
press , &
& real(lb_dom%gu(LB_NODE(1,i,j,k)), 4),real(lb_dom%gu(LB_NODE(2,i,j,k)),4), &
& real(lb_dom%grho(i,j,k),4), real(lb_dom
%g_y(j),s_par%g_z(k), press , &
A sample of the current ASCII data file:
title="LBM-Simulation Re= 300.0 umax=0.010 "
VARIABLES = X, Y, PRESS,uX, uY, density, state
ZONE T=" 1 ", I= 70 , J= 70 , F=POINT
0.000000 0.000000 0.000001 0.000543 -0.000483 1.000000 10.00
1.000000 0.000000 0.000001 0.000558 -0.000481 1.000000 10.00
2.000000 0.000000 0.000001 0.000573 -0.000477 1.000000 10.00
3.000000 0.000000 0.000001 0.000588 -0.000473 1.000000 10.00
4.000000 0.000000 0.000001 0.000604 -0.000468 1.000000 10.00
5.000000 0.000000 0.000001 0.000620 -0.000462 1.000000 10.00
6.000000 0.000000 0.000001 0.000636 -0.000456 1.000000 10.00
7.000000 0.000000 0.000001 0.000652 -0.000449 1.000000 10.00
8.000000 0.000000 0.000001 0.000668 -0.000441 1.000000 10.00
9.000000 0.000000 0.000001 0.000684 -0.000433 1.000000 10.00
10.000000 0.000000 0.000001 0.000700 -0.000423 1.000000 10.00
Jay Noble, a Tecplot developer, responds:
Here are some steps to write out your data with the TecIO library. These are to give you an idea of what the function calls would look like but are not programmatically correct.
1) Create the file that you want to write to using TECINI112(Title, Variables, FName, ScratchDir, FileType, Debug, VIsDouble)
For example: TECINI112("LBM-Simulation", "X Y PRESS uX uY density state", "your_file_name.plt", "your_scratch_directory", 0, 0, 0)
2) For each zone, specify the zone information:
a) Write out the zone header using TECZNE112(ZoneTitle, ZoneType, Imax, Jmax, Kmax, ICellMax, JCellMax, KCellMax, SolutionTime, StrandID, ParentZone, IsBlock, NumFaceConnections, FaceNeighborMode, TotalNumFaceNodes, NumConnectedBoundaryFaces, TotalNumBoundaryConnections, PassiveVarList, ValueLocation, ShareVarFromZone, ShareConnectivityFromZone)
For example: TECZNE112("1", 0, 70, 70, 1, 0, 0, 0, 0.1, 1, 0, 1, 0, 0, 0, 0, 0, NULL, NULL, NULL, 0)
b) For each of your variables call TECDAT112(N, Data, IsDouble)
For example: TECDAT112(70, X, 0)
*) It looks like your data is ordered so there's no need to call TECNOD112() to supply the connectivity list
3) Finish the file by calling TECEND112()
The TecIO library requires variable data to be in block format so that each variable can be written out to its own section in the file. I would highly recommend that you write your ascii data out in block format as well as the data can be read much faster than point format.
The Data Format Guide in your Tecplot documentation directory is a great resource for writing Tecplot data files. There are details on the functions I have mentioned as well as others if you would like to write out additional data. There are also TecIO source code examples located in the tecio/examples that can show you the use of these functions.
Manuel replies back to us that TecIO is working perfectly for him now, and graciously allows us to share these tips to TecplotTalk.
Please don't hesitate to contact us if you have questions on how to output the results of your code and the best use of the TecIO library.