circumferential averge streamwise velocity using Tecplot and Matlab

 

Input:

results from solver

 

output:

circumferential averge physical quantities( such as streamwise velocity)

 

How to?

1. draw an structured 2D axial meshin Pointwise

   a. similar nodes distribution as the mesh  in the solver ( normally unstructured)

  b. export as plot3D format

 

2. interpolate solution results on the 2D plane in Tecplot

a. import the CFD results in Tecplot

b. import the 2D mesh

file /load data/

c. interpolate data on the 2D mesh

d. rotate the 2D mesh and then interpolate again ( using for loop)

tecplot macro

#!MC 1410
$!Varset |NumLoop|=360
$!Loop |NumLoop|
$!Varset |num|=(|Loop|*1+0)
$!RotateData 
  ZoneList =  [4]
  Angle = |num|
  XVar = 1
  YVar = 2
  ZVar = 3
  NormalX = 1
  NormalY = 0
  NormalZ = 0
$!LinearInterpolate 
  SourceZones =  [1]
  DestinationZone = 4
  VarList =  [4-9]
  LinearInterPConst = 0
  LinearInterpMode = DontChange
$!WriteDataSet  "C:\Users\kaiming\Documents\ZJU\output_|num|.dat"
  IncludeText = No
  IncludeGeom = No
  IncludeDataShareLinkage = Yes
  ZoneList =  [4]
  Binary = No
  UsePointFormat = Yes
  Precision = 9
  TecplotVersionToWrite = TecplotCurrent
$!EndLoop

 output like this

average the result , reshape the data into an array, then get the circumferential average results with 2D matrix distribution -- matlab

  matlab code  is as follows:

n=359;
a=[];
b=[];
c=[];
for i=1:n
    filename=sprintf('output_%d.dat',i);
    fileinfo = importdata(filename);
    ux=fileinfo.data(:,7);
    uy=fileinfo.data(:,8);
    uz=fileinfo.data(:,9);
    a=[a,ux];
    b=[b,uy];
    c=[c,uz];

end
aver_Ux=sum(a,2)/n;
aver_Uy=sum(b,2)/n;
aver_Uz=sum(c,2)/n;
aver_Ux=aver_Ux.' % transpose
aver_Uy=aver_Uy.'  % transpose
aver_Uz=aver_Uz.'  % transpose
aver_Ux_array=reshape(aver_Ux, 499,[]); aver_Uy_array=reshape(aver_Uy, 499,[]); aver_Uz_array=reshape(aver_Uz, 499, []); save -ascii aver_ux_array.dat aver_Ux_array; save -ascii aver_uy_array.dat aver_Uy_array; save -ascii aver_uz_array.dat aver_Uz_array;

 

posted @ 2019-03-07 19:42  kaiming_ai  阅读(616)  评论(0编辑  收藏  举报