Processing ACII Fluent data on a corregated wall
Afficher commentaires plus anciens
i have a ACII fluent data from a corregation wall analysis. For unknow reasen on the wall and in the close area of the wall, some wavey structure are acour(in the image), my wall have constant heat flux which mean it shoude be a smoth transition. i think it the interpulation but i dont know how to solve it? i add some of my data(one part of incline wall) with x y and T acoredently
function [data] = openFile()
%Open a file dialog to choose a file
[file, path] = uigetfile('*.*', 'Select an ASCII file to open');
% Check if a file was selected
if isequal(file, 0) || isequal(path, 0)
disp('No file selected.');
else
% Concatenate the path and file name
fullFilePath = fullfile(path, file);
% Specify the file type as 'text' explicitly
try
data = readtable(fullFilePath, 'FileType', 'text');
disp(['Successfully loaded file: ' fullFilePath]);
% Now you can work with the 'data' table
catch
disp('Error reading the file.');
end
end
%%
data = openFile(); %get flow data
dataWall = openFile(); %get wall data
%Coregation flow data
x = data.x_coordinate;
y = data.y_coordinate;
u = data.x_velocity;
v = data.y_velocity;
T = data.temperature;
V = data.velocity_magnitude;
P = data.pressure;
Tw = dataWall.temperature;
Xw = dataWall.x_coordinate;
Yw = dataWall.y_coordinate;
% Set a high DPI value (e.g., 300 or 600) for high resolution (optional)
dpi = 600;
%% Calculating Nu as function of x
L = length(Xw); %y vector length%
xnew = sort(Xw);% defiend x location along the tunnel%
TV = T.*V;%T moltiply by V coralation%
Tm = [];um = [];
for i = 1:L
um(i) = trapz(y(x==xnew(i)),V(x==xnew(i)))./h;
Tm(i) = trapz(y(x==xnew(i)),TV(x==xnew(i)))./(um(i)*h);
end
Tw_new = [];
Tw_new(:,1) = Xw;
Tw_new(:,2) = Tw;
Tw_new1 = sortrows(Tw_new,1);
Twall = Tw_new1(:,2);
% The heat transfer coeffition%
hf = q./(Twall'-Tm);
Numean = mean((hf*Dh)/k);
Nu = (hf*Dh)/k;
%For flat plat
L = length(xTwF); %y vector length%
x_newF = sort(xTwF);% defiend x location along the tunnel%
TVf = Tf.*Vf;%T moltiply by V coralation%
um = [];TmF=[];
for i = 1:L
um(i) = trapz(yf(xf==x_newF(i)),Vf(xf==x_newF(i)))./h;
TmF(i) = trapz(yf(xf==x_newF(i)),TVf(xf==x_newF(i)))./(um(i)*h);
end
Tw_newF = [];
Tw_newF(:,1) = xTwF;
Tw_newF(:,2) = TwF;
Tw_new1F = sortrows(Tw_newF,1);
TwallF = Tw_new1F(:,2);
% The heat transfer coeffition%
hfF = q./(TwallF'-TmF);
Nuf = (hfF*Dh)/k;
%% new interpulation
%Present the adge of the coregation
X_set(:,2) = min(x)+0.005:0.01:max(x)+0.005;%uper adge
X_set(:,1) = min(x):0.01:max(x);%lower adge
Y_max = 0.0035;
Y_min = 0;
desired_columns = 2000;
Mx_up=[]; My_up=[];Mx_down=[]; My_down=[];
vn_up=[];un_up=[];Tn_up=[];Pn_up=[];
vn_down=[];un_down=[];Tn_down=[];Pn_down=[];
for i =1:length(X_set)
%incline ogf the wall
x_new = linspace(X_set(i,1), X_set(i,2), desired_columns);
y_new = linspace(0, Y_max, desired_columns);
[Mx_up(:,:,i) My_up(:,:,i)] = meshgrid(x_new,y_new);
%decline of the wall
if i <13
x_new = linspace(X_set(i,2),X_set(i+1,1), desired_columns);
y_new = linspace(0, Y_max, desired_columns);
[Mx_down(:,:,i) My_down(:,:,i)] = meshgrid(x_new,y_new);
end
end
vn_up=[]; un_up=[]; Pn_up=[]; Tn_up=[];
vn_down=[]; un_down=[]; Tn_down=[]; Pn_down=[];
for i = 1:length(X_set)-1
%incline of the wall
xn = x((X_set(i,2)>=x)&(x>=X_set(i,1))&(Y_max>=y)&(y>=Y_min));
yn = y((X_set(i,2)>=x)&(x>=X_set(i,1))&(Y_max>=y)&(y>=Y_min));
un = u((X_set(i,2)>=x)&(x>=X_set(i,1))&(Y_max>=y)&(y>=Y_min));
vn = v((X_set(i,2)>=x)&(x>=X_set(i,1))&(Y_max>=y)&(y>=Y_min));
Tn = T((X_set(i,2)>=x)&(x>=X_set(i,1))&(Y_max>=y)&(y>=Y_min));
Pn = P((X_set(i,2)>=x)&(x>=X_set(i,1))&(Y_max>=y)&(y>=Y_min));
vn_up(:,:,i) = griddata(xn,yn,vn,Mx_up(:,:,i), My_up(:,:,i),'cubic');
un_up(:,:,i) = griddata(xn,yn,un,Mx_up(:,:,i), My_up(:,:,i),'cubic');
Tn_up(:,:,i) = griddata(xn,yn,Tn,Mx_up(:,:,i), My_up(:,:,i),'cubic');
Pn_up(:,:,i) = griddata(xn,yn,Pn,Mx_up(:,:,i), My_up(:,:,i),'cubic');
%decline of he wall
if i<13
xn = x((X_set(i+1,1)>=x)&(x>=X_set(i,2))&(Y_max>=y)&(y>=Y_min));
yn = y((X_set(i+1,1)>=x)&(x>=X_set(i,2))&(Y_max>=y)&(y>=Y_min));
un = u((X_set(i+1,1)>=x)&(x>=X_set(i,2))&(Y_max>=y)&(y>=Y_min));
vn = v((X_set(i+1,1)>=x)&(x>=X_set(i,2))&(Y_max>=y)&(y>=Y_min));
Tn = T((X_set(i+1,1)>=x)&(x>=X_set(i,2))&(Y_max>=y)&(y>=Y_min));
Pn = P((X_set(i+1,1)>=x)&(x>=X_set(i,2))&(Y_max>=y)&(y>=Y_min));
vn_down(:,:,i) = griddata(xn,yn,vn,Mx_down(:,:,i), My_down(:,:,i),'cubic');
un_down(:,:,i) = griddata(xn,yn,un,Mx_down(:,:,i), My_down(:,:,i),'cubic');
Pn_down(:,:,i) = griddata(xn,yn,Pn,Mx_down(:,:,i), My_down(:,:,i),'cubic');
Tn_down(:,:,i) = griddata(xn,yn,Tn,Mx_down(:,:,i), My_down(:,:,i),'cubic');
end
end

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!