-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgeometry.edp
157 lines (127 loc) · 5.28 KB
/
geometry.edp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/* Florian OMNES (florian.omnes@upmc.fr) */
/* Charles DAPOGNY (charles.dapogny@univ-grenoble-alpes.fr) */
/* Pascal FREY (pascal.frey@upmc.fr) */
/* Yannick PRIVAT (yannick.privat@upmc.fr */
/* Copyright Sorbonne-Universités 2015-2018 */
/* PLEASE DO NOT REMOVE THIS BANNER */
include "getARGV.idp"
int config = getARGV("--config", 0);
mesh Th;
real ll = 1.5;
int pp = getARGV("--pp", 40);
real hv = .3; /* Si config = 3 Hauteur d'un espace entre deux e/s à droite (x=ll) */
real hs = 1./3; /* Si config = 3 Hauteur droite (x=ll) */
real he = 1./3; /* Si config = 3 Hauteur gauche (x=0) */
/* Si config = 0 ou 4 */
real l1=1./3, l2=2./3, l3=1./3;
real lt = l1+l2+l3;
real h1=1./3, h2=1./3, h3=1./3;
real ht = h1+h2+h3;
real r0 = 1./8;
func real param(real a, real b, real t) {
return (1-t)*a+t*b;
}
func real circlearcx(real xo, real r, real a1, real a2, real t) {
return xo + r*cos(param(a1,a2,t));
}
func real circlearcy(real yo, real r, real a1, real a2, real t) {
return yo + r*sin(param(a1,a2,t));
}
/*
Inlet 1
Outlet 2
Free boundary 3
*/
string meshname = getARGV("--mesh", "");
/* Bend with orthogonal inlet and outlet */
if (config == 1) {
border in(t=0,1) {x=param(0,1./3,t); y=0; label = 2;};
border sig1(t=0,1){x=circlearcx(1,2./3,pi,pi/2,t);y=circlearcy(0,2./3,pi,pi/2,t);label=3;};
border out(t=0,1) {x=1; y=param(2./3,1,t);label=1;};
border sig2(t=0,1){x=circlearcx(1,1,pi/2,pi,1-(1-t));y=circlearcy(0,1,pi/2,pi,1-(1-t));label=3;};
Th = buildmesh(in(pp/2)+sig1(pp)+out(pp/2)+sig2(pp));
Th = adaptmesh(Th, IsMetric=1, 1./30);
}
if (config == 2) { // Configuration (II) : 4 inlets, 1 outlet
real tt = 1./10;
real ttt = 1-tt;
border in(t=0,1){x=0; y=2./3-1./3*t;label=2;};
border sig11(t=0,1){x=ttt*(ll-1./3)*t; y= 1./3; label=3;};
border sig12(t=0,1){x=ttt*(ll-1./3)+tt*(ll-1./3)*t;y=1./3-1./3*t;label=3;};
border out11(t=0,1./3){x=ll-1./3+1./3*t; y=1./3*t;label=1;};
border sign1(t=1./3,2./3){x=ll-1./3+1./3*t; y=1./3*t;label=3;};
border out12(t=2./3,1){x=ll-1./3+1./3*t; y=1./3*t;label=1;};
border sig2(t=0,1){x=ll; y=1./3+t*1./3;label=3;};
border out21(t=0,1./3){x=ll-1./3*t; y=2./3+1./3*t;label=1;};
border sign2(t=1./3,2./3){x=ll-1./3*t; y=2./3+1./3*t;label=3;};
border out22(t=2./3,1){x=ll-1./3*t; y=2./3+1./3*t;label=1;};
border sig31(t=1,0){x=ttt*(ll-1./3)*t;y=2./3;label=3;};
border sig32(t=1,0){x=ttt*(ll-1./3)+tt*(ll-1./3)*t;y=2./3+1./3*t;label=3;};
Th = buildmesh(in(pp/2)+sig11(pp)+sig12(pp)+out11(pp/2)+sign1(pp/2)+out12(pp/2)+sig2(pp)+out21(pp/2)+sign2(pp/2)+out22(pp/2)+sig32(pp)+sig31(pp));
Th = adaptmesh(Th, IsMetric=1, 1./30);
}
if(config == 3) {
border b1(t=0,1){x=param(0,ll,t);y=0;label=3;};
border out1(t=0,1){x=ll;y=t;label=2;};
border b2(t=0,1){x=param(ll,0,t);y=1;label=3;};
border in(t=0,1){x=0;y=param(1,0,t);label=1;};
Th = buildmesh(b1(pp)+out1(pp)+b2(pp)+in(pp));
}
if(config == 4) {
border b1(t=0,1){x=param(0,ll,t);y=0;label=1;};
border out1(t=0,1){x=ll;y=t;label=2;};
border b2(t=0,1){x=param(ll,0,t);y=1;label=1;};
border in(t=0,1){x=0;y=param(1,0,t);label=1;};
border cav(t=2*pi,0){x=ll/2+.1*cos(t);y=1./2+.1*sin(t);label=3;};
Th = buildmesh(b1(pp)+out1(pp)+b2(pp)+in(pp)+cav(2*pp));
Th = movemesh(Th, [x, y-.5]);
}
if (config == 5) {
/* border in(t=0,1){x=0; y=2./3-1./3*t;label=2;}; */
/* border sig1(t=0,1){x=(ll-1./3)*t; y=1./3-1./3*t;label=3;}; */
/* border out1(t=0,1){x=ll-1./3+1./3*t; y=1./3*t;label=1;}; */
/* border sig2(t=0,1){x=ll; y=1./3+t*1./3;label=3;}; */
/* /\* border sig2(t=0,1){x=circlearcx(ll, -1./40, -pi/2, pi/2, t); y=circlearcy(1./3+1./6, 1./6, -pi/2, pi/2, t);label=3;}; *\/ */
/* border out2(t=0,1){x=ll-1./3*t; y=2./3+1./3*t;label=1;}; */
/* border sig3(t=0,1){x=(ll-1./3)*(1-t); y=1-1./3*t;label=3;}; */
/* Th = buildmesh(in(pp/2)+sig1(2*pp)+out1(pp/2)+sig2(pp)+out2(pp/2)+sig3(2*pp)); */
cout << "Sorry this mesh cannot be re-generated" << endl;
exit(1);
}
/*
Inlet 1
Outlet 2
Free boundary 3
*/
if (config == 6) { // Pipe with sliding outlet
real h1 = .3;
real h2 = 1;
border b1(t=0,1){x=param(0,ll,t);y=.05*sin(2*pi*t)+param(0,h2,t);label=3;};
border b2(t=0,1){x=ll;y=param(h2,h1+h2,t);label=4;};
border b3(t=0,1){x=param(ll,0,t);y=.05*sin(2*pi*t)+param(h1+h2,h1,t);label=3;};
border b4(t=0,1){x=0;y=param(h1,0,t);label=1;};
Th = buildmesh(b1(pp/2)+b2(pp)+b3(pp)+b4(pp/2));
Th = adaptmesh(Th, IsMetric=1, 1./30);
}
if (config == 7) {
real l1 = 2;
real l2 = 1;
real h1 = 1;
real h2 = 4;
real r = .2;
border b1(t=0,1){x=param(0,l1-r,t);y=-h1/2;label=3;};
border b2(t=0,1){x=circlearcx(l1-r,r,pi/2,0,t);y=circlearcy(-h1/2-r,r,pi/2,0,t);label=3;};
border b3(t=0,1){x=l1;y=param(-h1/2-r,-h2/2,t);label=3;};
border b4(t=0,1){x=param(l1,l1+l2,t);y=-h2/2;label=2;};
border b5(t=0,1){x=l1+l2;y=param(-h2/2,h2/2,t);label=3;};
border b6(t=0,1){x=param(l1+l2,l1,t);y=h2/2;label=2;};
border b7(t=0,1){x=l1;y=param(h2/2,h1/2+r,t);label=3;};
border b8(t=0,1){x=circlearcx(l1-r,r,0,-pi/2,t);y=circlearcy(h1/2+r,r,0,-pi/2,t);label=3;};
border b9(t=0,1){x=param(l1-r,0,t);y=h1/2;label=3;};
border b10(t=0,1){x=0;y=param(h1/2,-h1/2,t);label=1;};
Th = buildmesh(b1(pp)+b2(pp/2)+b3(pp)+b4(pp)+b5(pp)+b6(pp)+b7(pp)+b8(pp/2)+b9(pp)+b10(pp));
Th = adaptmesh(Th, IsMetric=1, 1./10);
plot(Th);
}
savemesh(Th,"meshes/mesh"+config+".mesh");
plot(Th, wait=1);