Browse Source

Another stab at toroid example

master
Trevor Irons 9 years ago
parent
commit
bf2b7c6670
1 changed files with 76 additions and 0 deletions
  1. 76
    0
      examples/magnet/toroid2.geo

+ 76
- 0
examples/magnet/toroid2.geo View File

@@ -0,0 +1,76 @@
1
+/////////////////////////
2
+// Geometric Inputs
3
+
4
+radius = 3.25;
5
+blc = radius/1;
6
+Box = 3*radius;
7
+lc = radius/1;
8
+
9
+ts = 1;         // height of toroid
10
+tx = radius;    // radial width of toroid, measured in centre of ring
11
+tl = 0;         // centre of rotation
12
+
13
+/////////////////////////////////////
14
+// Large Bounding box
15
+X0 = -Box;
16
+X1 =  Box;
17
+Y0 = -Box;
18
+Y1 =  Box;
19
+Z0 = -Box;
20
+Z1 =  Box;
21
+
22
+pp = newp;
23
+Point(pp)    = {X0, Y0, Z0, blc};
24
+Point(pp+1)  = {X1, Y0, Z0, blc};
25
+Point(pp+2)  = {X1, Y1, Z0, blc};
26
+Point(pp+3)  = {X0, Y1, Z0, blc};
27
+
28
+lv = newl;
29
+Line(lv) = {pp,pp+1};
30
+Line(lv+1) = {pp+1,pp+2};
31
+Line(lv+2) = {pp+2,pp+3};
32
+Line(lv+3) = {pp+3,pp};
33
+Line Loop(lv+4) = {lv, lv+1, lv+2, lv+3};
34
+
35
+bs = news;
36
+Plane Surface(bs) = {lv+4};
37
+v[] = Extrude {0, 0, Z1-Z0} { Surface{bs}; };
38
+
39
+/////////////////////////////////////////
40
+// Make a toroid
41
+tpp = newp;
42
+Point(tpp  ) = {    tx,    0, 0,  lc};
43
+Point(tpp+1) = { ts+tx,    0, 0,  lc};
44
+Point(tpp+2) = {    tx,   ts, 0,  lc};
45
+Point(tpp+3) = {    tx,  -ts, 0,  lc};
46
+Point(tpp+4) = {-ts+tx,    0, 0,  lc};
47
+
48
+cc = newc;
49
+Circle(cc  ) = {tpp+1, tpp, tpp+2};
50
+Circle(cc+1) = {tpp+2, tpp, tpp+4};
51
+Circle(cc+2) = {tpp+4, tpp, tpp+3};
52
+Circle(cc+3) = {tpp+3, tpp, tpp+1};
53
+
54
+ll = newll;
55
+Line Loop(ll) = {cc, cc+1, cc+2, cc+3};
56
+rs = news;
57
+
58
+ps = news;
59
+Plane Surface(ps) = {ll};
60
+
61
+tv1[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{ps}    ;};
62
+tv2[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{tv1[0]};};
63
+tv3[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{tv2[0]};};
64
+
65
+cv = newv;
66
+Compound Volume(cv) = {tv1[1], tv2[1], tv3[1] };
67
+
68
+//cs = news;
69
+//Compound Surface(cs) = {tv1[0], tv2[0], tv3[0] };
70
+
71
+// Not correct?
72
+Surface{tv1[0]} In Volume{v[1]};
73
+//Surface{tv2[0]} In Volume{v[1]};
74
+//Surface{tv3[0]} In Volume{v[1]};
75
+
76
+Physical Volume(1) = {v[1]};

Loading…
Cancel
Save