Prosessing ACII data from Fluent
4 次查看(过去 30 天)
显示 更早的评论
I possess a data set in ASCII format that includes locations, velocities, and temperatures. When I process my data, I observe unexpected results near the wall, and I am uncertain why. I do not observe these results in Fluent, and I am unsure of what I did incorrectly. My code is as follows. I believe that the issue is related to the interpolation of the data. i cant add my data is too larg
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;
%Flat flow data
dataf = openFile();
dataWallf = openFile();
xf = dataf.x_coordinate;
yf = dataf.y_coordinate;
uf = dataf.x_velocity;
% vf = dataf.y_velocity;
Tf = dataf.temperature;
Vf = dataf.velocity_magnitude;
TwF = dataWallf.temperature;
xTwF = dataWallf.x_coordinate;
yTwF = dataWallf.y_coordinate;
%Flow parameters
D = 0.005;
Dh = D;
h = D;
NuD =8.23;% for uniform q''
rho = 998.2;
mu = 0.000998 ;
nu = mu/rho;
k = 0.597;%W/mK
q = 500000; %heat flux
%% Sample velocity data in the coragated area
% for the all area
xn = x((max(Xw)>=x)&(x>=min(Xw)));
yn = y((max(Xw)>=x)&(x>=min(Xw)));
un = u((max(Xw)>=x)&(x>=min(Xw)));
vn = v((max(Xw)>=x)&(x>=min(Xw)));
Tn = T((max(Xw)>=x)&(x>=min(Xw)));
Pn = P((max(Xw)>=x)&(x>=min(Xw)));
%% %% Calaulating and presenting the velocity, Pressure and Temperature
%Present the x and y cordinat
x_unique = unique(xn);
y_unique = unique(yn);
[xq,yq] = meshgrid(x_unique, y_unique);
% Load your ASCII data and extract x, y, v, u, T, and P arrays
% Define the desired number of rows and columns for the new matrices
int = 20;
desired_rows = length(x_unique)*int;
desired_columns = length(y_unique)*int;
% Create a grid for the new matrices based on the range of x and y values
x_min = min(xn); % Replace with your actual x data
x_max = max(xn); % Replace with your actual x data
y_min = min(yn); % Replace with your actual y data
y_max = max(yn); % Replace with your actual y data
x_new = linspace(x_min, x_max, desired_columns);
y_new = linspace(y_min, y_max, desired_rows);
[X_new, Y_new] = meshgrid(x_new, y_new);
% Interpolate the v, u, T, and P values onto the new grid
v_new = griddata(xn, yn, vn, X_new, Y_new, 'v4');
u_new = griddata(xn, yn, un, X_new, Y_new, 'v4');
T_new = griddata(xn, yn, Tn, X_new, Y_new, 'v4');
P_new = griddata(xn, yn, Pn, X_new, Y_new, 'v4');
V_new = sqrt(v_new.^2 + u_new.^2);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1480846/image.png)
4 个评论
dpb
2023-9-14
Without a dataset that would let somebody here reproduce the problem there's essentially nothing can do -- we don't even have a klew as to what you think is "unexpected" in the result.
If zipping the file isn't enough to reduce it to the allowable size to attach, then you'll have to save a smaller subsection that contains the problem. The latter would be far better anyway, undoubtedly it would not take the whole output array to reproduce the issue and smaller datasets are much easier to debug than huge ones.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!