How do I plot Streamlines of velocity components of spherical coordinate system?
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jagadeesh Korukonda
am 13 Dez. 2022
Kommentiert: Jagadeesh Korukonda
am 15 Dez. 2022
I solved Navier stokes in Spherical coordinates and I got velocity field inside a sphere i.e
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1229657/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1229662/image.png)
If I plot contours using the code below its working. But, The same technique is not working for streamlines, instead I'm getting blank.
The streamlines are look like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1229667/image.jpeg)
nr = 21;
nth = 21;
L = 1;
r = linspace(0,1,nr);
th = linspace(0,pi,nth);
[R,Th] = meshgrid(r,th);
Xi = R.*cos(Th); Yi = R.*sin(Th);
ui = (R.^2-1)/2/(L+1).*cos(Th);
vi = (1-2*R.^2)/2/(L+1).*sin(Th);
figure;contourf(Xi,Yi,ui,100,'LineStyle','none');axis image
figure;contourf(Xi,Yi,vi,100,'LineStyle','none');axis image
figure;streamline(Xi,Yi,ui,vi)
I'm getting streamlines as empty, can anyone help me in this regard?
Thanks in advance.
0 Kommentare
Akzeptierte Antwort
VBBV
am 13 Dez. 2022
verts = stream2(Xi,Yi,ui,vi,R,Th);
streamline(verts);
5 Kommentare
VBBV
am 15 Dez. 2022
Ok, it seems your equations are in spherical coordinates, so use sph2cart function
clc
clear all
close all
nr = 21;
nth = 21;
L = 1;
r =linspace(-1,1,nr);
th =linspace(0,pi,nth);
[R,Th] = meshgrid(r,th);
[x y z] = sph2cart(cos(Th),sin(Th),R);
Xi = (R).*cos(Th);
Yi = R.*sin(Th);
ui = ((R.^2-1)/(2*(L+1))).*cos(Th);
vi = ((1-2*R.^2)/(2*(L+1))).*sin(Th);
% figure;contourf(Xi,Yi,ui,100,'LineStyle','none');axis image
% figure;contourf(Xi,Yi,vi,100,'LineStyle','none');axis image
streamslice(x,y,ui,vi);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!