How to plot specific velocity contour in matlab from fluent data

6 ビュー (過去 30 日間)
Kaleemullah Mohammed
Kaleemullah Mohammed 2022 年 9 月 27 日
回答済み: Vinayak 2023 年 8 月 29 日
Hi,
I have my velocity(x and y) exported from fluent and I am trying to plot them in matlab.When I plot them I am getting contours outside of my domain. How can I get the contours only inside of my domain and the rest is white. Also how do I plot or contour specific values of velocity. Say for example I want to plot only the negative values of the velocity in the flow field using surf command.
  2 件のコメント
Davide Masiello
Davide Masiello 2022 年 9 月 27 日
Please attach the file you export from Fluent.
Kaleemullah Mohammed
Kaleemullah Mohammed 2022 年 9 月 27 日

サインインしてコメントする。

回答 (1 件)

Vinayak
Vinayak 2023 年 8 月 29 日
Hi,
We can achieve this by setting he values of velocity that are greater than or equal to zero to NaN using logical indexing. Then, we use surf to plot the surface of the velocity data.
I have attached a sample code snippet below:-
% Example velocity data
x = linspace(-10, 10, 100); % x coordinates
y = linspace(-10, 10, 100); % y coordinates
[X, Y] = meshgrid(x, y); % Create a meshgrid
velocity = X + Y; % Example velocity data (replace with your actual data)
% Set negative values to NaN
velocity(velocity >= 0) = NaN;
% Plot the surface
surf(X, Y, velocity);
% Add labels and title
xlabel('X');
ylabel('Y');
zlabel('Velocity');
title('Negative Velocity');
% Show the plot
Thanks,
Vinayak

カテゴリ

Help Center および File ExchangeGeneral Physics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by