Переглянути джерело

Adding toroid example

master
Trevor Irons 9 роки тому
джерело
коміт
18dffffc74
1 змінених файлів з 105 додано та 0 видалено
  1. 105
    0
      examples/magnet/toroid.geo

+ 105
- 0
examples/magnet/toroid.geo Переглянути файл

@@ -0,0 +1,105 @@
1
+/* This file is part of Lemma, a geophysical modelling and inversion API.
2
+ * More information is available at http://lemmasoftware.org
3
+ */
4
+
5
+/* This Source Code Form is subject to the terms of the Mozilla Public
6
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
7
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
+ */
9
+
10
+/**
11
+ * @file
12
+ * @date      02/04/2016 02:58:54 PM
13
+ * @version   $Id$
14
+ * @author    Trevor Irons (ti)
15
+ * @email     tirons@egi.utah.edu
16
+ * @copyright Copyright (c) 2016, University of Utah
17
+ * @copyright Copyright (c) 2016, Lemma Software, LLC
18
+ */
19
+
20
+radius = 3.25;   // Radius of the damn thing
21
+blc = radius/2;  //  0.25;   // Target element size
22
+Box = 3*radius;  // The down side of potential
23
+lc = radius/2;        // toroid characteristic length
24
+
25
+
26
+tpp = newp;
27
+ts = 1;         // height of toroid
28
+tx = radius;  // radial width of toroid, measured in centre of ring
29
+tl = 0;         // centre of rotation
30
+
31
+Point(tpp  ) = {    tx,    0, 0,  lc};
32
+Point(tpp+1) = { ts+tx,    0, 0,  lc};
33
+Point(tpp+2) = {    tx,   ts, 0,  lc};
34
+Point(tpp+3) = {    tx,  -ts, 0,  lc};
35
+Point(tpp+4) = {-ts+tx,    0, 0,  lc};
36
+
37
+cc = newc;
38
+Circle(cc  ) = {tpp+1, tpp, tpp+2};
39
+Circle(cc+1) = {tpp+2, tpp, tpp+4};
40
+Circle(cc+2) = {tpp+4, tpp, tpp+3};
41
+Circle(cc+3) = {tpp+3, tpp, tpp+1};
42
+
43
+ll = newll;
44
+Line Loop(ll) = {cc, cc+1, cc+2, cc+3};
45
+
46
+ps = news;
47
+pio2=Pi/2;
48
+Plane Surface(ps) = {ll};
49
+tv1[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{ps}; };
50
+tv2[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{28}; };
51
+tv3[] = Extrude {{0, 1, 0},{-tl,0,0}, 2*Pi/3} { Surface{50}; };
52
+//t1[] = Rotate {{0,0,1},{0,0,0},pio2  } {Duplicata{Surface{ps};}};
53
+//Extrude Surface {ps, {0,1,0}, {-tl,0,0}, 2*Pi/3} { Recombine ;};
54
+//Extrude Surface {28, {0,1,0}, {-tl,0,0}, 2*Pi/3}; //{Layers{10,73,1};};
55
+//Extrude Surface {50, {0,1,0}, {-tl,0,0}, 2*Pi/3}; //{Layers{10,73,1};};
56
+
57
+/* Make a list of a ring (annulus) of surfaces around the hole */
58
+allParts[] = {tv1[0], tv2[0], tv3[0]};
59
+
60
+/* Make surfaces to be meshed by transfinite algorithm */
61
+//Transfinite Surface {allParts[]};
62
+
63
+/* The "Recombine Surface" command is issued in order to
64
+ * crate quadrilateral elements.
65
+ */
66
+//Recombine Surface {allParts[]};
67
+
68
+// Extrude Surface {12, {0,0,1}, {0,0,0}, 2*Pi/3} {
69
+//   Recombine ; Layers { 6, 54, 1 } ;
70
+// } ;
71
+
72
+// Total Solution Space
73
+X0 = -Box;
74
+X1 =  Box;
75
+Y0 = -Box;
76
+Y1 =  Box;
77
+Z0 = -Box;
78
+Z1 =  Box;
79
+/////////////////////////////////////
80
+// Large Bounding box
81
+pp = newp;
82
+Point(pp)    = {X0, Y0, Z0, blc};
83
+Point(pp+1)  = {X1, Y0, Z0, blc};
84
+Point(pp+2)  = {X1, Y1, Z0, blc};
85
+Point(pp+3)  = {X0, Y1, Z0, blc};
86
+//
87
+lv = newl;
88
+Line(lv) = {pp,pp+1};
89
+Line(lv+1) = {pp+1,pp+2};
90
+Line(lv+2) = {pp+2,pp+3};
91
+Line(lv+3) = {pp+3,pp};
92
+Line Loop(lv+4) = {lv, lv+1, lv+2, lv+3};
93
+//
94
+// Hard coded doom
95
+bs = news;
96
+Plane Surface(bs) = {lv+4};
97
+//
98
+//v = newv;
99
+v[] = Extrude {0, 0, Z1-Z0} { Surface{bs}; };
100
+
101
+/* This is GOOD */
102
+Surface{ allParts } In Volume{v[1]};
103
+//Surface{t1[0]} In Volume{v[1]};
104
+//Surface{t2[0]} In Volume{v[1]};
105
+//Surface{t3[0]} In Volume{v[1]};

Завантаження…
Відмінити
Зберегти