CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Tecplot (https://www.cfd-online.com/Forums/tecplot/)
-   -   mat2tecplot (https://www.cfd-online.com/Forums/tecplot/103860-mat2tecplot.html)

wenlong June 4, 2014 09:50

Open mat2tecplot.m in a text editor, search for "magic number"
which is the version number, change to earlier version

Wen

chernac2000 June 4, 2014 11:26

mat2tecplot.m
 
Hi wen,
I have a tecplot version 10, what is the earlier version of TDV that I will add it.
Thanks

wenlong June 4, 2014 12:32

Try TDV010 or TDV100

chernac2000 June 4, 2014 13:04

I have another problem when I put TDV100 and TDV010. The TDV100 give error as : "out of space while allocating var names" and /invalid header in binary datafile" and "unable to read binary datafile header.

The TDV010 give error as: unexpected end of file in datafile header

wenlong June 4, 2014 13:28

Oops, that means you would have to experiment a bit, the binary file format may have been changed from 10.0 to 11.0.
not sure what exactly your line of the magic number looks like unless you post it

also try "#!TDV101" which means 10.1 or "!TDV75 " for version 7.5 notice there is a space after 75

chernac2000 June 4, 2014 14:29

I've tested (TDV101 and TDV75 ), but they give the same error as TDV100. all older versions TDV105 give the same error

scott_rumage June 5, 2014 11:53

I do believe you will need to upgrade your Tecplot license to the new version, as the option to use “Preplot” does not apply to the mat2tecplot.m application.

Preplot is used to convert Tecplot ASCII formatted data to Tecplot binary formatted data – which is not the situation for the use of mat2tecplot.m

Here is a link to the product page on Preplot (and TecIO) if you want to learn more about this application: http://www.tecplot.com/downloads/tecio-library/ . BTW – Preplot is already installed on your computer in the Tecplot 360 “bin” folder.

Contact Tecplot via the email -- sales at Tecplot dot com -- to get your license upgraded.

Scott

scott_rumage July 30, 2014 17:43

Tecplot intern Devon Simpson has written a blog that provides a script and data showing how to use Wen Long’s Mat2Tecplot.m converter. The blog is located here: http://www.tecplot.com/blog/2014/07/28/create-tecplot-format-files-matlab-data/ .


Regards,
Scott

lbmagis December 12, 2014 10:38

Hello Sarah,
i have data which is updating (iterating method) as isotherms computing in matlab(its updating until we reach the convergence creteria)
my question is : how to get the last image in tecplot file (.plt)???
Thank you so much

Durrell4 December 12, 2014 16:05

What version of Tecplot are you using
 
Hi nacera,

What version of Tecplot are you using?

Durrell

lbmagis December 30, 2014 12:36

how can i visualize isotherms and streamlines using this way?
 
Hello,
Could any one tell us how to use this way to visualize isotherms and streamlines in 2Dimensions.
Thank you

Durrell4 December 30, 2014 12:51

Check out the videos at the link below
 
Quote:

Originally Posted by lbmagis (Post 525592)
Hello,
Could any one tell us how to use this way to visualize isotherms and streamlines in 2Dimensions.
Thank you

One can add streamlines interactively via the streamtrace placement tool on the sidebar.


Isotherms can be produced via our contour groups and using a surface contour.

Check out some the videos on using Tecplot here http://www.tecplot.com/products/tecp...deo-tutorials/

Best

Durrell

lbmagis February 2, 2015 08:38

Superpose two matlab figures or more in one figure like these
 
1 Attachment(s)
Hello and thank you so much for your quick reply

what i am intresting in is how to put many contours on the same matlab's figure? like these below: look to one of these figures ,please let's choose the first one on the left, did you observe that on the first contour (dashed lines), there's another one but with (solid lines).

how can i make the same thing???
NB: no way to imagesc them at the same time on the matlab code, we obtain these contours one by one .... so i thinking about export them (2 contours or more) together to tecplot wishing make the necessary post-processing treatment
in order to get the same result
Thanks

shhe February 27, 2015 21:39

Quote:

Originally Posted by sarah440 (Post 410899)
Hi,

I have a DNS database which includes the coordinate matrices x, y, z as well as the velocity fields u, v and w. All matrices have the same size of nl*nc*ns. Then I use Matlab to compute some new parameters like swirling rate. At the end of my own script I use mat2tecplot.m to convert mat files to PLT format. Here is what I put at the end of my script:

PLTout = strcat(outputAddress,PLTout_name); %The output name and address
tdata=[];
tdata.Nvar=7; %number of variables
tdata.vformat = 2*ones(1,tdata.Nvar); %Double precision for each variable (optional)
tdata.varnames={'x','y','z','u','v','w','Lambda'};
tdata.cubes(1).zonename=eval('PLTout_name'); %any name
tdata.cubes(1).x=x(nl*nc*ns);
tdata.cubes(1).y=y(nl*nc*ns);
tdata.cubes(1).z=z(nl*nc*ns);
tdata.cubes(1).v(1,:,:,: )=u(nl*nc*ns);
tdata.cubes(1).v(2,:,:,: )=v(nl*nc*ns);
tdata.cubes(1).v(3,:,:,: )=w(nl*nc*ns);
tdata.cubes(1).v(4,:,:,: )=lambda(nl*nc*ns);
mat2tecplot(tdata,eval('PLTout'))

I can easily visulize this PLT file in Tecplot
Hope this helps

Hi,
I have tried to do as you but unfortunately, it failed to generate the tecplot file. My code as following:

tdata=[];
tdata.Nvar=5; %number of variables
tdata.vformat = 2*ones(1,tdata.Nvar); %Double precision for each variable (optional)
tdata.varnames={'X','Y','Z','TEMP','TEMP_GRADIENT_ NON_UNITY'};
tdata.cubes(1).zonename='TEMP_GRADIENT_NON_UNITY'; %any name
%tdata.cubes(1).zonename=eval('TEMP_GRADIENT_NON_U NITY'); %any name
tdata.cubes(1).x=X;
tdata.cubes(1).y=Y;
tdata.cubes(1).z=Z;
tdata.cubes(1).v(1,:,:,: )=TEMP;
tdata.cubes(1).v(2,:,:,: )=TEMP_GRADIENT_NON_UNITY;
mat2tecplot(tdata,'TEMP_GRADIENT_NON_UNITY.plt')


I have gotten the following error:
Error : cube 1 v 2nd, 3rd, 4th dimension
must be of the same size as x, y, z

To your knwledge, my domain is 201*201*201

sarah440 February 28, 2015 14:45

Quote:

Originally Posted by shhe (Post 533732)
Hi,
I have tried to do as you but unfortunately, it failed to generate the tecplot file. My code as following:

tdata=[];
tdata.Nvar=5; %number of variables
tdata.vformat = 2*ones(1,tdata.Nvar); %Double precision for each variable (optional)
tdata.varnames={'X','Y','Z','TEMP','TEMP_GRADIENT_ NON_UNITY'};
tdata.cubes(1).zonename='TEMP_GRADIENT_NON_UNITY'; %any name
%tdata.cubes(1).zonename=eval('TEMP_GRADIENT_NON_U NITY'); %any name
tdata.cubes(1).x=X;
tdata.cubes(1).y=Y;
tdata.cubes(1).z=Z;
tdata.cubes(1).v(1,:,:,: )=TEMP;
tdata.cubes(1).v(2,:,:,: )=TEMP_GRADIENT_NON_UNITY;
mat2tecplot(tdata,'TEMP_GRADIENT_NON_UNITY.plt')


I have gotten the following error:
Error : cube 1 v 2nd, 3rd, 4th dimension
must be of the same size as x, y, z

To your knwledge, my domain is 201*201*201

Hi,

It seems that the sizes of your arrays are not the same. Here is the error display lines in the script:

if(Imax_v~=Imax || Jmax_v~=Jmax || Kmax_v ~= Kmax)
s=-1;
display(['Error : cube ' int2str(icube) ' v 2nd, 3rd, 4th dimension']);
display([' must be of the same size as x, y, z']);

Are you sure that your arrays (including x, y, z) are all 3D with the same size?

shhe March 1, 2015 02:47

1 Attachment(s)
Quote:

Originally Posted by sarah440 (Post 533798)
Hi,

It seems that the sizes of your arrays are not the same. Here is the error display lines in the script:

if(Imax_v~=Imax || Jmax_v~=Jmax || Kmax_v ~= Kmax)
s=-1;
display(['Error : cube ' int2str(icube) ' v 2nd, 3rd, 4th dimension']);
display([' must be of the same size as x, y, z']);

Are you sure that your arrays (including x, y, z) are all 3D with the same size?

Yes, I am sure that the dimensions in 3d (201*201*201). Just look on the attached snapshot for print screen. You will see in workspaces the dimension of each variables after loading the file and then execute input_to_matlab script which has the following lines:
%TEMP_GRADIENT_NON_UNITY = strcat(outputAddress,TEMP_GRADIENT_NON_UNITY_name) ; %The output name and address
tdata=[];
tdata.Nvar=5; %number of variables
tdata.vformat = 2*ones(1,tdata.Nvar); %Double precision for each variable (optional)
tdata.varnames={'X','Y','Z','TEMP','TEMP_GRADIENT_ NON_UNITY'};
tdata.cubes(1).zonename='TEMP_GRADIENT_NON_UNITY'; %any name
%tdata.cubes(1).zonename=eval('TEMP_GRADIENT_NON_U NITY'); %any name
tdata.cubes(1).x=X;
tdata.cubes(1).y=Y;
tdata.cubes(1).z=Z;
tdata.cubes(1).v(1,:,:,:)=TEMP;
tdata.cubes(1).v(2,:,:,:)=TEMP_GRADIENT_NON_UNITY;
mat2tecplot(tdata,'TEMP_GRADIENT_NON_UNITY.plt')

sarah440 March 1, 2015 10:14

What I see here is that X, Y, Z are 201*1, you need them to be 201*201*201 like TEMP. First, use "meshgrid" function to convert X, Y, Z to rectangular grid. It should work then.

shhe March 1, 2015 14:52

Quote:

Originally Posted by sarah440 (Post 533855)
What I see here is that X, Y, Z are 201*1, you need them to be 201*201*201 like TEMP. First, use "meshgrid" function to convert X, Y, Z to rectangular grid. It should work then.

Thank you very much, meshgrid was the solution. It works well now.

lbmagis March 24, 2015 16:21

error in this line: function name(inputs)
 
Hello,
Thank you for the good explanation!
i tried this but did'nt work!!!

function name(inputs) ------> error in this
could you show us a program as an example, where did you write this part of program in your code???
Thank you again.

Quote:

Originally Posted by Hoggs17 (Post 405985)
After reading through the mat2tecplot.m documentation, this is what I did in order to export my matlab data into a readable Tecplot file. Hope this will help any other users out there that aren't quite using it right. This is just my interpretation of Wen Long's code; all credit must be given to him for writing it.

1. You must keep the mat2tecplot.m in the same directory as your other files as your main program will call mat2tecplot.m (should be self-explanatory but you know never know).

2. In your program, you must call mat2tecplot.m and specify what data you are transferring.

3. Following the examples given in the documentation (I followed example 3 I believe), you can change a few lines of code to reflect which data you want to export. My code is as follows.

function name(inputs)

tdata=[];
tdata.Nvar=6;
tdata.varnames={'x','y','z','u','v','p_new'};
tdata.surfaces(1).zonename='mysurface zone';
tdata.surfaces(1).x=x;
tdata.surfaces(1).y=y;
tdata.surfaces(1).v(1,:,: )=u;
tdata.surfaces(1).v(2,:,: )=v;
tdata.surfaces(1).v(3,:,: )=p_new;
mat2tecplot(tdata,'SIMPLE Results.plt')

end

You have to make sure that the value specified in tdata.Nvar is equal to the number of variables you place in tdata.varnames. I specified 6 variables and then had 6 names given. I have 2-D flow (x,y,z=0) and want my data for u and v momentum and pressure exported. "tdata.surfaces(1).x= " is used to specify your domain. In the example, coordinates are given for x,y,z; in my code; i simply set the .x value equal to my x-values on my defined mesh. The same was done for the y-values. if you specify nothing (as with z), it is assumed 0.

The "tdata.surfaces(1).v(1,:,: )= " code specifies which data you want displayed as a result. i set it equal to my u momentum. To add multiple data to the same file, you change the .v(1,:,: ) to .v(2,:,: ) etc... for as many different data sets as you like. I had 3 data sets (u,v,pressure) so I have 3 lines.

Finally, the last line in the code calls mat2tecplot using the values you have specified and outputs an easily readable tecplot input file (called 'SIMPLE Results'). My contour plots for momentum and pressure look much better than they did on matlab plus you now have the flexibility of using tecplot to manipulate your visualization axis, contour # etc...

You just have to add a few lines of code to your matlab program and the mat2tecplot.m does all the work for you.

Now if I could just figure out how to transfer my streamline data I'd be all set - anyone have any tips?


wenlong April 9, 2015 16:14

lbmagis

You seem to not understanding that: tecplot data file does not contain information about "contours", it is designed to have the data that the contours should be based on.

So instead of trying to put "contours" into the data file, just put in the original data. Contours are viewable once you have the data file in .plt format and open it in tecplot software.

Plus: post your code directly so that we can help

Wen


All times are GMT -4. The time now is 03:12.