CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > Tecplot

mat2tecplot

Register Blogs Community New Posts Updated Threads Search

Like Tree22Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 6, 2015, 05:53
Default
  #41
New Member
 
Oğuzhan Medet
Join Date: Jul 2015
Posts: 3
Rep Power: 11
the_aviator is on a distinguished road
i need help about processing a test data in matlab. after processing matlab, i have to transfer it to tecplot. Who can help me?
the_aviator is offline   Reply With Quote

Old   July 6, 2015, 19:23
Default
  #42
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
I can if you describe your data and upload a mat file somewhere
wenlong is offline   Reply With Quote

Old   July 7, 2015, 02:15
Default
  #43
New Member
 
Oğuzhan Medet
Join Date: Jul 2015
Posts: 3
Rep Power: 11
the_aviator is on a distinguished road
my data is 240*216 matrix. My task is to transform it to a form which tecplot can read and can plot a graph or can simulate it.
the_aviator is offline   Reply With Quote

Old   July 7, 2015, 04:52
Default
  #44
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
very easy, follow one of the 2D ij- examples in mat2tecplot
wenlong is offline   Reply With Quote

Old   July 7, 2015, 05:14
Default
  #45
New Member
 
Oğuzhan Medet
Join Date: Jul 2015
Posts: 3
Rep Power: 11
the_aviator is on a distinguished road
can you send me the link?
the_aviator is offline   Reply With Quote

Old   July 7, 2015, 23:49
Default
  #46
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
Look at the first few posts of this thread
wenlong is offline   Reply With Quote

Old   July 21, 2015, 13:17
Default Problem with cell-centered variable
  #47
New Member
 
Victor Magri
Join Date: Jul 2015
Posts: 2
Rep Power: 0
victorapm is on a distinguished road
Dear friends,

I'm trying to use mat2tecplot for writing cell centered variables through surfaces, but the binary file generated does not give me the expected answer. For example, consider the code:
Code:
tdata=[];
tdata.Nvar=5;
tdata.vformat(1:tdata.Nvar) = 2;
tdata.varnames={'x','y','z','T', 'P'};
tdata.surfaces(1).zonename='mysurface zone';
tdata.surfaces(1).x=[1,2,3;1,2,3;1,2,3];    %size 3x3
tdata.surfaces(1).y=[1,1,1;2,2,2;3,3,3];    %size 3x3
tdata.surfaces(1).order=3;
tdata.surfaces(1).v=[];
tdata.surfaces(1).v(1,:,:)=[10,20;30 40];
tdata.surfaces(1).v(2,:,:)=[50,60;70 80];
tdata.surfaces(1).varloc=1;
mat2tecplot(tdata,'mysurf2DT_xy_cellcenter.plt')
If I open it on Tecplot Focus 2013R1 and go to File->Write Data File, the ASCII file generated is the following one:
Code:
TITLE     = "tecplot data"
VARIABLES = "x"
"y"
"z"
"T"
"P"
ZONE T="mysurface zone"
 STRANDID=1, SOLUTIONTIME=0
 I=3, J=3, K=1, ZONETYPE=Ordered
 DATAPACKING=BLOCK
 VARLOCATION=([3-5]=CELLCENTERED)
 DT=(DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE )
 1.000000000E+000 1.000000000E+000 1.000000000E+000 2.000000000E+000 2.000000000E+000
 2.000000000E+000 3.000000000E+000 3.000000000E+000 3.000000000E+000
 1.000000000E+000 2.000000000E+000 3.000000000E+000 1.000000000E+000 2.000000000E+000
 3.000000000E+000 1.000000000E+000 2.000000000E+000 3.000000000E+000
 0.000000000E+000 0.000000000E+000 0.000000000E+000 0.000000000E+000
 0.000000000E+000 0.000000000E+000 1.000000000E+001 3.000000000E+001
 4.000000000E+001 0.000000000E+000 0.000000000E+000 0.000000000E+000
In the last two lines, I was expecting to have:
Code:
 1.000000000E+001 3.000000000E+001 2.000000000E+001 4.000000000E+001
 5.000000000E+001 7.000000000E+001 6.000000000E+001 8.000000000E+001
I tried to dig into mat2tecplot file but could not find the reason for this difference. Do you have any thought on that? I appreciate!

I'm using the mat2tecplot version provided in the website: http://www.tecplot.com/blog/2014/07/...s-matlab-data/

Thank you so much for your help!
victorapm is offline   Reply With Quote

Old   July 21, 2015, 17:00
Default
  #48
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
Pls see if the following works:

tdata=[]; tdata.Nvar=5; tdata.vformat(1:tdata.Nvar) = 2;
tdata.varnames={'x','y','z','T', 'P'};
tdata.surfaces(1).zonename='mysurface zone';
tdata.surfaces(1).x=[1,2,3;1,2,3;1,2,3]; %size 3x3
tdata.surfaces(1).y=[1,1,1;2,2,2;3,3,3]; %size 3x3
tdata.surfaces(1).z=[0,0;0,0] %size 2x2
tdata.surfaces(1).order=3;
tdata.surfaces(1).v=[];
tdata.surfaces(1).v(1,:,: )=[10,20;30 40]; %size 2x2
tdata.surfaces(1).v(2,:, : )=[50,60;70 80]; %size 2x2
tdata.surfaces(1).varloc=1;
mat2tecplot(tdata,'mysurf2DT_xy_cellcenter.plt')
wenlong is offline   Reply With Quote

Old   July 21, 2015, 22:58
Default Problem with cell-centered variable
  #49
New Member
 
Victor Magri
Join Date: Jul 2015
Posts: 2
Rep Power: 0
victorapm is on a distinguished road
Dear Wen Long,

it gave exactly the same result as before. So, the problem is not with the variable "z". My opinion is that it is around the lines 9165-9185, which write the variables "P" and "T":

Code:
switch(iv)  %by default matlab fwrite() writes array A[Imax,Jmax,Kmax]
    %with i=1:Imax, j=1:Jmax,k=1:Kmax and with i varying the fastest,
    %j the second and k the last
    %hence  we do not have to have k,j,i nested loops as above
    case 1
        surface_data_value=x_data(1:Imax-1,1:Jmax-1);
    case 2
        surface_data_value=y_data(1:Imax-1,1:Jmax-1);
    case 3
        surface_data_value=z_data(1:Imax-1,1:Jmax-1);
    otherwise
        surface_data_value=tdata.surfaces(isurf).v(iv-3,1:Imax-1,1:Jmax-1);
        
end
%also need to pad zeros to make sure it (only needed for ordered data)
%occupies the same size as nodal
%variables
surface_data_value=reshape(surface_data_value,[1,(Imax-1)*(Jmax-1)]);
surface_data_value=[surface_data_value zeros([1,Imax*Jmax-(Imax-1)*(Jmax-1)])];
fwrite(fid_out,surface_data_value,var_formatstr{iv});
Thank you for your help
victorapm is offline   Reply With Quote

Old   August 9, 2015, 15:33
Default
  #50
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
I think it is an issue with Tecplot itself on how contours are rendered . The data writer is still okay.


Attached example have same values for T and P, yet the plots are different Attachment 41330

See attached zip file

-Wen
Attached Files
File Type: zip mat2tecplot_v1.4.zip (82.1 KB, 12 views)

Last edited by wenlong; August 10, 2015 at 15:52.
wenlong is offline   Reply With Quote

Old   August 10, 2015, 15:55
Default update (v1.4)
  #51
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
Quote:
Originally Posted by wenlong View Post
fix a few typos in readme
A slightly corrected version (v1.4)

-Wen
Attached Files
File Type: zip mat2tecplot_v1.4.zip (82.1 KB, 23 views)
wenlong is offline   Reply With Quote

Old   September 16, 2015, 21:00
Default
  #52
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
Quote:
Originally Posted by wenlong View Post
fix a few typos in readme
Quote:
Originally Posted by victorapm View Post
Dear Wen Long,

it gave exactly the same result as before. So, the problem is not with the variable "z". My opinion is that it is around the lines 9165-9185, which write the variables "P" and "T":

Code:
switch(iv)  %by default matlab fwrite() writes array A[Imax,Jmax,Kmax]
    %with i=1:Imax, j=1:Jmax,k=1:Kmax and with i varying the fastest,
    %j the second and k the last
    %hence  we do not have to have k,j,i nested loops as above
    case 1
        surface_data_value=x_data(1:Imax-1,1:Jmax-1);
    case 2
        surface_data_value=y_data(1:Imax-1,1:Jmax-1);
    case 3
        surface_data_value=z_data(1:Imax-1,1:Jmax-1);
    otherwise
        surface_data_value=tdata.surfaces(isurf).v(iv-3,1:Imax-1,1:Jmax-1);
        
end
%also need to pad zeros to make sure it (only needed for ordered data)
%occupies the same size as nodal
%variables
surface_data_value=reshape(surface_data_value,[1,(Imax-1)*(Jmax-1)]);
surface_data_value=[surface_data_value zeros([1,Imax*Jmax-(Imax-1)*(Jmax-1)])];
fwrite(fid_out,surface_data_value,var_formatstr{iv});
Thank you for your help

This is now fixed in v1.5 See attached file with an example.
Attached Files
File Type: zip mat2tecplot_v1.5.zip (96.0 KB, 154 views)
wenlong is offline   Reply With Quote

Old   September 17, 2015, 15:33
Default
  #53
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
V1.5 updated in the end. Or simple click the clip(attachment) on the top right of the thread
wenlong is offline   Reply With Quote

Old   October 1, 2015, 16:24
Default
  #54
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
This is solved in version 1.5 above

Quote:
Originally Posted by victorapm View Post
Dear Wen Long,

it gave exactly the same result as before. So, the problem is not with the variable "z". My opinion is that it is around the lines 9165-9185, which write the variables "P" and "T":

Code:
switch(iv)  %by default matlab fwrite() writes array A[Imax,Jmax,Kmax]
    %with i=1:Imax, j=1:Jmax,k=1:Kmax and with i varying the fastest,
    %j the second and k the last
    %hence  we do not have to have k,j,i nested loops as above
    case 1
        surface_data_value=x_data(1:Imax-1,1:Jmax-1);
    case 2
        surface_data_value=y_data(1:Imax-1,1:Jmax-1);
    case 3
        surface_data_value=z_data(1:Imax-1,1:Jmax-1);
    otherwise
        surface_data_value=tdata.surfaces(isurf).v(iv-3,1:Imax-1,1:Jmax-1);
        
end
%also need to pad zeros to make sure it (only needed for ordered data)
%occupies the same size as nodal
%variables
surface_data_value=reshape(surface_data_value,[1,(Imax-1)*(Jmax-1)]);
surface_data_value=[surface_data_value zeros([1,Imax*Jmax-(Imax-1)*(Jmax-1)])];
fwrite(fid_out,surface_data_value,var_formatstr{iv});
Thank you for your help
wenlong is offline   Reply With Quote

Old   October 13, 2015, 11:44
Default
  #55
New Member
 
Join Date: Mar 2012
Posts: 27
Rep Power: 14
peterputer is on a distinguished road
Hi
can someone please check if Example 2 v1.5 works?
For me it doesnt T=0 instead of the values specified if I read it into Tecplot 360EX 2015 R2.


Code:
  Example 2:  generate a 2D line in (x,y) with temperature T defined on
              (x,y). Note there is no z in this case. By default
              line is defined by points of (x,y) pairs, and 
              variable T is a function defined on the line.
       tdata=[];
       tdata.Nvar=3;
       tdata.varnames={'x','y','T'};
       tdata.lines(1).zonename='myline zone';
       tdata.lines(1).x=[1,2,3,4,5,6,7,8,9,10];
       tdata.lines(1).y=[1,2,3,4,5,6,7,8,9,10]+10;
       tdata.lines(1).v(1,:)=[10,20,30,30,20,10,10,10,20,20];
       mat2tecplot(tdata,'myline2DT_xy.plt')
peterputer is offline   Reply With Quote

Old   October 27, 2015, 15:17
Default
  #56
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
Hi, Peterputer

The third variable 'T' is treated as z internally and it is given values as zero when z is not explicitly defined. This seems to be a bug for the code. To overcome this problem, you can use:


%
%test Example 2
%


tdata=[];
tdata.Nvar=4;
tdata.varnames={'x','y','z','T'};
tdata.lines(1).zonename='myline zone';
tdata.lines(1).x=[1,2,3,4,5,6,7,8,9,10];
tdata.lines(1).y=[1,2,3,4,5,6,7,8,9,10]+10;
tdata.lines(1).v(1,=0*[10,20,30,30,20,10,10,10,20,20];

tdata.lines(1).v(2,=[10,20,30,30,20,10,10,10,20,20];

mat2tecplot(tdata,'myline2DT_xy.plt')

and use x,y,T instead.


Or you can also try instead of getting it in the v, put the T value in z as below:


tdata=[];
tdata.Nvar=3;
tdata.varnames={'x','y','T'};
tdata.lines(1).zonename='myline zone';
tdata.lines(1).x=[1,2,3,4,5,6,7,8,9,10];
tdata.lines(1).y=[1,2,3,4,5,6,7,8,9,10]+10;
tdata.lines(1).z=[10,20,30,30,20,10,10,10,20,20];
mat2tecplot(tdata,'myline2DT_xyT.plt')

In essence, only use v if you have more than 3 variable, v(i, is supposed to be corresponding to the i+3'th variable in varnames list
wenlong is offline   Reply With Quote

Old   January 28, 2016, 13:51
Default Visualization on tecplot
  #57
New Member
 
Nicholas Prince
Join Date: Jan 2016
Posts: 1
Rep Power: 0
Echem is on a distinguished road
Quote:
Originally Posted by wenlong View Post
Hi ciccio

Cubes are simple, because you have 36x36x36 for the cubes vertex points and your u,v,w are on the center of each cube, that means you should supply u,v,w as 35x35x35 arrays instead.

Here is an example code

----------------------
tdata=[];

tdata.Nvar=6;
tdata.varnames={'x','y','z','u','v','w'};
tdata.cubes(1).zonename='my IJK volume cubes zone';

x=(1:1:36);
y=(1:1:36);
z=z(1:1:36);
[x3d,y3d,z3d]=meshgrid(x,y,z);
tdata.cubes(1).x=x3d;
tdata.cubes(1).y=y3d;
tdata.cubes(1).z=z3d;
u3d=repmat(random('norm',0.1,0.2,35),[1,1,35]);
v3d=repmat(random('norm',0.1,0.2,35),[1,1,35]);
w3d=repmat(random('norm',0.1,0.2,35),[1,1,35]);
tdata.cubes(1).v(1,:,:,: )=u3d;
tdata.cubes(1).v(2,:,:,: )=v3d;
tdata.cubes(1).v(3,:,:,: )=w3d;
tdata.cubes(1).varloc=1;
mat2tecplot(tdata,'mycube_IJK_volume_cellcenter.pl t')

------------------
Then you can view the plot in tecplot, and attached pic is what I got.



Wen
Nice work Wen. I'm new to tecplot, how do I visualize this matlab m file in tecplot please? I attached the m file for a clearer understanding.

Thank you.

Any other member is welcome to help me out.
cheers
Attached Files
File Type: pdf code_pdf.pdf (32.2 KB, 48 views)
Echem is offline   Reply With Quote

Old   February 3, 2016, 20:06
Question mat2tecplot 3d matrix..please help..
  #58
New Member
 
Erkam BULUR
Join Date: Jan 2016
Posts: 1
Rep Power: 0
blr123 is on a distinguished road
Hi my friends.. I have a data as 3d matrix like A(x,y,z). I have created it in matlab. I want to learn how to draw contour plot according to the variable z and make animation in tecplot. Variables x and y are my datas which are created after running my program. and Variable z is as time or step per calculation(for loop).
blr123 is offline   Reply With Quote

Old   February 17, 2016, 15:03
Default
  #59
New Member
 
wen long
Join Date: May 2012
Posts: 29
Rep Power: 14
wenlong is on a distinguished road
Quote:
Originally Posted by blr123 View Post
Hi my friends.. I have a data as 3d matrix like A(x,y,z). I have created it in matlab. I want to learn how to draw contour plot according to the variable z and make animation in tecplot. Variables x and y are my datas which are created after running my program. and Variable z is as time or step per calculation(for loop).
Try to use solutiontime and 2D surface for your purpose.

create many zones, each zone give it a solutiontime that corresponds to your z value. Then use value of A for any given z on all (x,y) points.

http://www.cfd-online.com/Forums/mis...ments&t=103860
wenlong is offline   Reply With Quote

Old   December 13, 2018, 00:57
Default how can i do for matlab to tecplot ?
  #60
New Member
 
chiang chi yang
Join Date: Dec 2018
Posts: 1
Rep Power: 0
nick0221008 is on a distinguished road
i have a imformatin 1440*16(x,y,z,u,v,w,dudx....)

i want to make vortex z in tecplot

how can i make for this problem

help me plz

i am tw.
nick0221008 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 00:59.