MATLAB Answers

How can I get velocity values for stream3 function

3 views (last 30 days)
Brian Mojarrad
Brian Mojarrad on 6 Apr 2020
Commented: darova on 6 Apr 2020
Hello,
I have a 3D flow domain in which I have created matrix format of x, y , z coordinates as well as u , v , w for my velocity vector. I would like to do a particle tracing for the particle release from a cetrain coodrnates. Then I would like to have x , y, z coordinates and u, v, w values of the particle along it's trajectory (my final aim is to calculate the particle travel time within the domain released from a specfic point).
I used the following codes to get the coordinates of the particle along it's path (x,y,z,u,v,w are known):
[sx,sy,sz] = meshgrid(2.6,2.6,-5);
XYZ_Data=stream3(x,y,z,u,v,w,sx,sy,sz);
However, I don't know how can I get the velocity vector of the corresponding coordinates of XYZ_Data! It would be really appreciated if anybody could help me in this issue.
Bests,

  0 Comments

Sign in to comment.

Accepted Answer

darova
darova on 6 Apr 2020
A short example
clc,clear
cla
load wind
[sx sy sz] = meshgrid(80,20:10:50,0:5:15);
h = streamline(stream3(x,y,z,u,v,w,sx,sy,sz));
xx = get(h,'xdata');
yy = get(h,'ydata');
zz = get(h,'zdata');
ii = 10;
x1 = xx{ii};
y1 = yy{ii};
z1 = zz{ii};
u1 = interp3(x,y,z,u,x1,y1,z1);
v1 = interp3(x,y,z,v,x1,y1,z1);
w1 = interp3(x,y,z,w,x1,y1,z1);
hold on
jj = 1:30:length(x1);
quiver3(x1(jj),y1(jj),z1(jj),u1(jj),v1(jj),w1(jj),'r')
hold off

  2 Comments

Brian Mojarrad
Brian Mojarrad on 6 Apr 2020
Many thanks for your help! very efficient and straight forward!

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by