Defining an implicit function over a specific interval

조회 수: 9 (최근 30일)
mohammad faghih
mohammad faghih 2018년 9월 3일
댓글: KSSV 2018년 9월 4일
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

채택된 답변

KSSV
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
mohammad faghih
mohammad faghih 2018년 9월 3일
Apart from the meshing and CFD question I have. I still need to know a basic thing in MATLAB.
Is it possible to define an implicit function over only a trapezoidal space? For example, we know a circle has an implicit function as x^2+y^2=R^2, right? But what if I want to define it only for 0<x<R and 0<y<R. You know that this interval of 0<x<R and 0<y<R would correspond to a square in space, right? So, how would I define a trapezoidal space within which my function is defined.
KSSV
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개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by