Galerkin FEM for elliptic PDEs
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

sphereBox.geo 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. D0 = 10; // Top of magnet
  9. D1 = 11; // Bottom of magnet
  10. radius = 2.25; // Radius of the damn thing
  11. lc = 2*radius; // 0.25; // Target element size
  12. // Total Solution Space
  13. Box = 6*radius; // The down side of potential
  14. X0 = -Box;
  15. X1 = Box;
  16. Y0 = -Box;
  17. Y1 = Box;
  18. Z0 = -Box;
  19. Z1 = Box;
  20. cellSize=lc; //300;
  21. dd = 0 ; // 1e-5; //cellSize; // .01;
  22. pio2=Pi/2;
  23. /////////////////////////////////////
  24. // Large Bounding box
  25. pp = newp;
  26. Point(pp) = {X0, Y0, Z0, lc};
  27. Point(pp+1) = {X1, Y0, Z0, lc};
  28. Point(pp+2) = {X1, Y1, Z0, lc};
  29. Point(pp+3) = {X0, Y1, Z0, lc};
  30. lv = newl;
  31. Line(lv) = {pp,pp+1};
  32. Line(lv+1) = {pp+1,pp+2};
  33. Line(lv+2) = {pp+2,pp+3};
  34. Line(lv+3) = {pp+3,pp};
  35. Line Loop(lv+4) = {lv, lv+1, lv+2, lv+3};
  36. // Hard coded doom
  37. Plane Surface(125) = {lv+4};
  38. //v = newv;
  39. v[] = Extrude {0, 0, Z1-Z0} { Surface{125}; };
  40. // // Calculate offset effect
  41. // theta = Asin(dd/radius);
  42. // rr = radius * Cos(theta);
  43. //
  44. // ///////////////////////////////////
  45. // // Positive half sphere
  46. // // create inner 1/8 shell
  47. // p0 = newp;
  48. // Point(p0) = { 0, 0, 0, cellSize}; // origin
  49. // Point(p0+1) = { -rr, 0, dd, cellSize};
  50. // Point(p0+2) = { 0, rr, dd, cellSize};
  51. // Point(p0+3) = { 0, 0, radius, cellSize};
  52. // Point(p0+4) = { 0, 0, dd, cellSize}; // origin
  53. //
  54. // c0 = newc;
  55. // Circle(c0 ) = {p0+1, p0+4, p0+2}; // Tricky, This one needs to be offset!
  56. // Circle(c0+1) = {p0+3, p0, p0+1};
  57. // Circle(c0+2) = {p0+3, p0, p0+2};
  58. //
  59. // Line Loop(10) = {c0, -(c0+2), c0+1} ;
  60. // Ruled Surface (60) = {10};
  61. //
  62. // ////////////////////////////////////////////////////////////
  63. // // Negative half sphere
  64. // p = newp;
  65. // Point( p) = { 0, 0, 0, cellSize};
  66. // Point(p+1) = { -rr, 0, -dd, cellSize};
  67. // Point(p+2) = { 0, rr, -dd, cellSize};
  68. // Point(p+3) = { 0, 0, -radius, cellSize};
  69. // Point(p+4) = { 0, 0, -dd, cellSize};
  70. //
  71. // cc = newc;
  72. // Circle(cc ) = {p+1, p+4, p+2};
  73. // Circle(cc+1) = {p+3, p, p+1};
  74. // Circle(cc+2) = {p+3, p, p+2};
  75. //
  76. // Circle(cc+3) = {p+3, p, p+2};
  77. // Circle(cc+4) = {p+3, p, p+2};
  78. // Circle(cc+5) = {p+3, p, p+2};
  79. //
  80. // ccl = newl;
  81. // Line(ccl) = { p0+3, p+3 };
  82. //
  83. // Line Loop(11) = {cc, -(cc+2), cc+1} ;
  84. // Ruled Surface (61) = {11};
  85. //
  86. // // create remaining 7/8 inner shells
  87. // t1[] = Rotate {{0,0,1},{0,0,0},pio2 } {Duplicata{Surface{60};}};
  88. // t2[] = Rotate {{0,0,1},{0,0,0},pio2*2} {Duplicata{Surface{60};}};
  89. // t3[] = Rotate {{0,0,1},{0,0,0},pio2*3} {Duplicata{Surface{60};}};
  90. // //
  91. // t4[] = Rotate {{0,0,1},{0,0,0},pio2 } {Duplicata{Surface{61};}};
  92. // t5[] = Rotate {{0,0,1},{0,0,0},pio2*2} {Duplicata{Surface{61};}};
  93. // t6[] = Rotate {{0,0,1},{0,0,0},pio2*3} {Duplicata{Surface{61};}};
  94. //
  95. // /* This is GOOD */
  96. // Surface{60} In Volume{v[1]};
  97. // Surface{t1[0]} In Volume{v[1]};
  98. // Surface{t2[0]} In Volume{v[1]};
  99. // Surface{t3[0]} In Volume{v[1]};
  100. //
  101. // Surface{61} In Volume{v[1]};
  102. // Surface{t4[0]} In Volume{v[1]};
  103. // Surface{t5[0]} In Volume{v[1]};
  104. // Surface{t6[0]} In Volume{v[1]};
  105. //
  106. // ///////////////////////////////////////////////
  107. // // Attractor Field
  108. //
  109. // //Field[1] = Attractor;
  110. // //Field[1].NodesList = {p}; //0, p0+1, p0+2, p0+3, p0+4, p, p+1, p+2, p+3, p+4};
  111. //
  112. // //Field[2] = MathEval;
  113. // //Field[2].F = Sprintf("(2.25 - F1)^2 + %g", cellSize*10 ); // WORKS
  114. // //Field[2].F = Sprintf("(%g - F1)^2 + %g", radius, 2*cellSize );
  115. // //Background Field = 2;
  116. //
  117. // // Don't extend the elements sizes from the boundary inside the domain
  118. // //Mesh.CharacteristicLengthExtendFromBoundary = 0;
  119. //
  120. // Physical Volume(1) = {v[1]};
  121. // To create the mesh run
  122. // gmsh sphere.gmsh -2 -v 0 -format msh -o sphere.msh
  123. //gmsh -3 -format msh1 -o outfile.msh sphere.geo