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.

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