Galerkin FEM for elliptic PDEs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

boreholeMagnetPlus.geo 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /**
  2. * Trevor P. Irons, XRI Geophysics, LLC
  3. * Test of Coloumbic Magnetic Potential
  4. */
  5. Function Cyl
  6. // centre
  7. pp0 = newp; Point(pp0) = { 0, 0, D0, lc2};
  8. // Points defining outer ring
  9. pp1 = newp; Point(pp1) = { R2, 0, D0, lc2};
  10. pp2 = newp; Point(pp2) = { 0, R2, D0, lc2};
  11. pp3 = newp; Point(pp3) = {-R2, 0, D0, lc2};
  12. pp4 = newp; Point(pp4) = { 0, -R2, D0, lc2};
  13. cc1 = newc; Circle(cc1) = {pp1, pp0, pp2};
  14. cc2 = newc; Circle(cc2) = {pp2, pp0, pp3};
  15. cc3 = newc; Circle(cc3) = {pp3, pp0, pp4};
  16. cc4 = newc; Circle(cc4) = {pp4, pp0, pp1};
  17. ll1 = newl; Line Loop(ll1) = {cc1, cc2, cc3, cc4};
  18. ss1 = news; Plane Surface(ss1) = {ll1};
  19. //v1 = newv; v1 =
  20. //newv vol2;
  21. vol2[] = Extrude {0, 0, D1-D0} { Surface{ss1}; };
  22. Return
  23. lc = 5e-2; // Target element size
  24. R = .05; // Magnet Radius
  25. D0 = 10; // Top of magnet
  26. D1 = 11; // Bottom of magnet
  27. p0 = newp; Point(p0) = { 0, 0, D0, lc};
  28. p1 = newp; Point(p1) = { R, 0, D0, lc};
  29. p2 = newp; Point(p2) = { 0, R, D0, lc};
  30. p3 = newp; Point(p3) = {-R, 0, D0, lc};
  31. p4 = newp; Point(p4) = { 0,-R, D0, lc};
  32. c1 = newc; Circle(c1) = {p1, p0, p2};
  33. c2 = newc; Circle(c2) = {p2, p0, p3};
  34. c3 = newc; Circle(c3) = {p3, p0, p4};
  35. c4 = newc; Circle(c4) = {p4, p0, p1};
  36. ll0 = newl; Line Loop(ll0) = {1,2,3,4};
  37. Plane Surface(6) = {5};
  38. vol2[] = Extrude {0,0,D1-D0} {
  39. Surface{6};
  40. };
  41. /*
  42. vol1[] = Extrude {0, 0, D1-D0} { Line{c1:c4}; };
  43. */
  44. ////////////////////////////////////////////////////
  45. // Big Cylinder
  46. ////////////////////////////////////////////////////
  47. /*
  48. lc2 = 1e-2; // Target element size
  49. R2 = .175; // Minimum Radius
  50. D0 = 9.75; // Top of mesh
  51. D1 = 11.25; // Bottom of mesh
  52. Call Cyl;
  53. //newv vol3;
  54. //Compound Volume(vol3) = {vol1[1], vol2[1]};
  55. Field[1] = Attractor;
  56. Field[1].NodesList = {p0,p1,p2,p3,p4};
  57. Field[2] = Threshold;
  58. Field[2].IField = 1;
  59. Field[2].LcMin = lc / 5;
  60. Field[2].LcMax = lc;
  61. Field[2].DistMin = 0.05;
  62. Field[2].DistMax = 0.5;
  63. // Use minimum of all the fields as the background field
  64. Field[3] = Min;
  65. Field[3].FieldsList = {2};
  66. Background Field = 2;
  67. // Don't extend the elements sizes from the boundary inside the domain
  68. Mesh.CharacteristicLengthExtendFromBoundary = 0;
  69. Mesh.CharacteristicLengthFromPoints = 1 ;
  70. */
  71. Mesh 3;
  72. /*
  73. Delete { Volume{vol1[1]}; }
  74. Delete { Volume{vol2[1]}; }
  75. Delete { Point{p0}; }
  76. Delete { Point{p1}; }
  77. Delete { Point{p2}; }
  78. Delete { Point{p3}; }
  79. Delete { Point{p4}; }
  80. Delete { Line{c1}; }
  81. Delete { Line{c2}; }
  82. Delete { Line{c3}; }
  83. Delete { Line{c4}; }
  84. */
  85. //Delete { Line{ll0}; }
  86. //Delete { Volume{vol2}; }
  87. /*
  88. ////////////////////////////////////
  89. // South Pole
  90. Point(8) = { 0, -0.0001, D0, lc};
  91. Point(9) = { R, -0.0001, D0, lc};
  92. Point(10) = { 0, -R, D0, lc};
  93. Point(11) = {-R, -0.0001, D0, lc};
  94. // Connect up the points
  95. Circle(12) = {11, 8, 9};
  96. Line(13) = {9, 11};
  97. Line Loop(14) = {12, 13};
  98. Plane Surface(15) = {14};
  99. */
  100. //////////////////////////////////////
  101. // Extrude magnet
  102. //Extrude {0, 0, D1-D0} { Surface{7}; }
  103. //Extrude {0, 0, D1-D0} { Surface{15}; }
  104. /*
  105. // Large Bounding box
  106. Point(116) = {X0, Y0, Z0};
  107. Point(117) = {X1, Y0, Z0};
  108. Point(118) = {X1, Y1, Z0};
  109. Point(119) = {X0, Y1, Z0};
  110. Line(120) = {116,117};
  111. Line(121) = {117,118};
  112. Line(122) = {118,119};
  113. Line(123) = {119,116};
  114. Line Loop(124) = {120, 121, 122, 123};
  115. Plane Surface(125) = {124};
  116. Extrude {0, 0, Z1-Z0} { Surface{125}; }
  117. */
  118. //////////////////////////////////////
  119. // Volumes
  120. //Physical Volume("plus") = {2};
  121. //Physical Volume("minus") = {1};
  122. //Physical Volume("background") = {3};
  123. /*
  124. Delete {
  125. Surface{9};
  126. }
  127. Delete {
  128. Surface{13};
  129. }
  130. Delete {
  131. Surface{17};
  132. }
  133. Delete {
  134. Surface{21};
  135. }
  136. */
  137. Compound Volume(49) = {1};
  138. Compound Volume(50) = {49, 1};