Defining an implicit function over a specific interval
9 次查看(过去 30 天)
显示 更早的评论
Hi guys;
I have a 2-D (fluid) flow domain with the inlet and outlet as shown in Fig. attached as Geometry. My origin is in the lower left corner.
I have numerically calculated the stream function for this flow domain, which is obviously an implicit function of x and y. I have a few questions:
First, how can I specifically define my implicit function for only my flow domain (which is a trapezoidal region in the space). When I try to plot a sample streamline, the actual implicit function goes beyond my flow domain as seen in the Fig. attached as streamline. In fact, I need to define my implicit function only within my flow domain and get rid of the rest.
Specifically, I need a mesh grid of a trapezoidal shape with its node located at (0,0) (0.008,0) (0.008,0.000641) (0,0.0012).
I though maybe I could do it with meshgrid, but I could not find a way to mesh my trapezoidal domain.
Looking at the attached Fig. named ROI, I only want my function defined at the section marked by a check mark and get rid of the rest.
Second, I need to mesh my flow domain into fine grids, then do some mathematical calculation on it. Specifically, since I have the velocity profile both in x and y direction, I need to calculate shear stress along each streamline. So, I need to know how to discretize my domain for further post-processing.
Please let me know if you need further clarification on my question.
Thanks
0 个评论
采纳的回答
KSSV
2018-9-3
You can genearte, grid in your interested domain using transfinite interpolation. Have a look on the following file exchange functions:
3 个评论
KSSV
2018-9-4
% Trapezium coordinates
P1 = [0 0] ;
P2 = [8 0] ;
P3 = [8 0.641] ;
P4 = [0 1.2] ;
P5 = P1 ;
T = [P1; P2; P3;P4;P5] ;
N = 100 ;
x = linspace(min(T(:,1)),max(T(:,1)),N) ;
y = linspace(min(T(:,2)),max(T(:,2)),N) ;
[X,Y] = meshgrid(x,y) ;
idx = inpolygon(X(:),Y(:),T(:,1),T(:,2)) ;
% TRapizum coordinates
tx = X(idx) ; ty = Y(idx) ;
figure
hold on
plot(T(:,1),T(:,2),'r')
hold on
plot(tx,ty,'.b')
Now define, your function on (tx,ty)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!