root / Final-Parameters_sm_fsn_fss_fsv / geometry1.cpp @ 16
Historique | Voir | Annoter | Télécharger (4,1 ko)
1 |
|
---|---|
2 |
/*************************************************************
|
3 |
* GEOMETRY and MESH
|
4 |
* **********************************************************/
|
5 |
|
6 |
// ----------------- external boundary
|
7 |
|
8 |
//border a1(t=0,1){x=lx/2+t*(-lx);y=0;label=1;}; //ok
|
9 |
real rnect=lx/2-vthickness;
|
10 |
real tB=2*pi-acos(rnect/R);
|
11 |
real tA=pi+acos(rnect/R); |
12 |
real xC=0;
|
13 |
real yC=sqrt(R*R-rnect*rnect); |
14 |
|
15 |
border a1(t=0,1){x=lx/2+t*(lx/2-vthickness-lx/2);y=0;label=11;}; //ok |
16 |
border a2(t=tB,tA){x=xC+R*cos(t);y=yC+R*sin(t);label=12;}; //ok |
17 |
//border a2(t=0,1){x=rnect+t*(-2*rnect);y=0;label=12;}; //ok
|
18 |
border a3(t=0,1){x=-lx/2+vthickness+t*(-lx/2-(-lx/2+vthickness));y=0;label=13;}; //ok |
19 |
|
20 |
border b1(t=0,1){x=-lx/2;y=t*(-ly);label=2;}; //ok |
21 |
|
22 |
border c1(t=0,1){x=-lx/2+t*(-cwidth/2-vthickness+lx/2);y=-ly;label=31;}; //ok |
23 |
border c2(t=0,1){x=-cwidth/2-vthickness+t*vthickness;y=-ly;label=32;}; //ok |
24 |
border cc(t=0,1){x=-cwidth/2+t*cwidth; y=-ly; label=35;}; // bouchon |
25 |
border c3(t=0,1){x=cwidth/2+t*vthickness;y=-ly;label=33;}; |
26 |
border c4(t=0,1){x=cwidth/2+vthickness+t*(lx/2-cwidth/2-vthickness);y=-ly;label=34;}; |
27 |
|
28 |
border d1(t=0,1){x=lx/2;y=-ly+t*(ly);label=4;}; //ok |
29 |
|
30 |
// -------------------- internal boundary
|
31 |
|
32 |
real xA=-rnect; real yA=0;
|
33 |
real xB=-cwidth/2; real yB=-ly;
|
34 |
real D=lineD(xA, xB, yA, yB); |
35 |
real C=lineC(xA, xB, yA, yB); |
36 |
real delta=D^2*(C-yC)^2-(1+D^2)*((C-yC)^2-(R+hnect)^2); |
37 |
real xM=(-D*(C-yC)+sqrt(delta))/(D^2+1); |
38 |
real yM=D*xM+C; |
39 |
real tN=2*pi+asin(-sqrt((R+hnect)^2-xM^2)/(R+hnect)); |
40 |
real tM=3*pi-tN;
|
41 |
/*
|
42 |
cout<<"xM="<<xM<<" yM="<<yM<<endl;
|
43 |
cout<<"xxM="<<xC+(R+hnect)*cos(tM)<<" yyM="<<yC+(R+hnect)*sin(tM)<<endl;
|
44 |
cout<<"xxN="<<xC+(R+hnect)*cos(tN)<<" yyN="<<yC+(R+hnect)*sin(tN)<<endl;
|
45 |
*/
|
46 |
|
47 |
border vide1(t=0,1){x=-cwidth/2+t*(xM+cwidth/2);y=-ly+t*(yM+ly);label=51;};//ok |
48 |
border vide2(t=tM,tN){x=xC+(R+hnect)*cos(t);y=yC+(R+hnect)*sin(t);label=52;};
|
49 |
//border vide2(t=0,1){x=xM+(-2*xM)*t;y=yM;label=52;};
|
50 |
border vide3(t=0,1){x=-xM+t*(cwidth/2+xM);y=yM+t*(-ly-yM);label=53;};//ok |
51 |
|
52 |
// ------------------- define the mesh
|
53 |
|
54 |
//border circle(t=2*pi,0){x=xC+R*cos(t);y=yC+R*sin(t);label=12;};
|
55 |
//mesh Th = buildmesh(circle(-nvertex*lx));
|
56 |
|
57 |
/*
|
58 |
plot(a1(nvertex*vthickness)+a2(nvertex*2*rnect)+a3(nvertex*vthickness)
|
59 |
+ b1(nvertex*ly)
|
60 |
+ c1(nvertex*lx/2) + c2(nvertex*vthickness)
|
61 |
+ vide1(nvertex*ly) + vide2(nvertex*(lx-2*vthickness)) + vide3(nvertex*ly) //hole
|
62 |
//+ cc(nvertex*cwidth)
|
63 |
+ c3(nvertex*vthickness) + c4(nvertex*lx/2)
|
64 |
+ d1(nvertex*ly), wait=1
|
65 |
);
|
66 |
*/
|
67 |
|
68 |
mesh Th = buildmesh (a1(nvertex*vthickness)+a2(nvertex*2*rnect)+a3(nvertex*vthickness)
|
69 |
+ b1(nvertex*ly) |
70 |
+ c1(nvertex*lx/2) + c2(nvertex*vthickness)
|
71 |
+ vide1(nvertex*ly) + vide2(nvertex*(lx-2*vthickness)) + vide3(nvertex*ly) //hole |
72 |
//+ cc(nvertex*cwidth)
|
73 |
+ c3(nvertex*vthickness) + c4(nvertex*lx/2)
|
74 |
+ d1(nvertex*ly) |
75 |
); |
76 |
|
77 |
|
78 |
/*************************************************************
|
79 |
* DEFINITION OF DOMAINS
|
80 |
* **********************************************************/
|
81 |
|
82 |
//vposition=-xM;
|
83 |
|
84 |
real xA1=-(vposition+vthickness), yA1=-hnect; |
85 |
real xB1=-cwidth/2-vthickness, yB1=-ly;
|
86 |
real xA2=(vposition+vthickness), yA2=-hnect; |
87 |
real xB2=cwidth/2+vthickness, yB2=-ly;
|
88 |
real D1=lineD(xA1, xB1, yA1, yB1); |
89 |
real C1=lineC(xA1, xB1, yA1, yB1); |
90 |
real D2=lineD(xA2, xB2, yA2, yB2); |
91 |
real C2=lineC(xA2, xB2, yA2, yB2); |
92 |
|
93 |
func bool vasculatureBool(real xx, real yy)
|
94 |
{ return (((yy>D1*xx+C1) && (yy<D1*(xx-vthickness)+C1)) || ((yy>D2*xx+C2)&& (yy<D2*(xx+vthickness)+C2)) );
|
95 |
} |
96 |
|
97 |
/*
|
98 |
func bool nectaryBool(real xx, real yy)
|
99 |
{ return (yy>-hnect)&&(yy>D1*(xx-vthickness)+C1)&&(yy>D2*(xx+vthickness)+C2);
|
100 |
}*/
|
101 |
|
102 |
func bool nectaryBool(real xx, real yy)
|
103 |
{ return (yy>D1*(xx-vthickness)+C1)&&(yy>D2*(xx+vthickness)+C2);
|
104 |
} |
105 |
|
106 |
|
107 |
func bool sideBool(real xx, real yy)
|
108 |
{ return (yy>-hside) && (((xx<-lx/2+lside)&&(yy<D1*xx+C1)) || ( (xx>lx/2-lside)&& (yy<D2*xx+C2)) ); |
109 |
} |
110 |
|
111 |
func bool mesophylBool(real xx, real yy)
|
112 |
{ return (!vasculatureBool(xx,yy)) && (!nectaryBool(xx,yy)) && (!sideBool(xx,yy));
|
113 |
} |
114 |
|
115 |
|