halbacharray.geo 1010 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // This file creates the 2D geometry of 5 aligned permanent magnets.
  2. // Domain radius in meters:
  3. rdom = 0.07;
  4. // Magnet size in meters:
  5. l = 0.01;
  6. // Steel disk radius in meters:
  7. rdisk = 0.01;
  8. // Choose mesh size:
  9. Mesh.CharacteristicLengthFactor = 0.1;
  10. SetFactory("OpenCASCADE");
  11. Rectangle(1) = {-2.5*l, 0, 0, l, l, 0};
  12. Rectangle(2) = {-1.5*l, 0, 0, l, l, 0};
  13. Rectangle(3) = {-0.5*l, 0, 0, l, l, 0};
  14. Rectangle(4) = {0.5*l, 0, 0, l, l, 0};
  15. Rectangle(5) = {1.5*l, 0, 0, l, l, 0};
  16. Disk(6) = {3.5*l, rdisk+l*1.5, 0, rdisk, rdisk};
  17. Disk(7) = {0, rdisk, 0, rdom, rdom};
  18. // Break down the geometry:
  19. Coherence;
  20. // Define the physical regions:
  21. magnet1 = 1; magnet2 = 2; magnet3 = 3; magnet4 = 4; magnet5 = 5; steel = 6; air = 7; zeropotential = 8;
  22. Physical Surface(magnet1) = {1};
  23. Physical Surface(magnet2) = {2};
  24. Physical Surface(magnet3) = {3};
  25. Physical Surface(magnet4) = {4};
  26. Physical Surface(magnet5) = {5};
  27. Physical Surface(steel) = {6};
  28. Physical Surface(air) = {7};
  29. Physical Point(zeropotential) = {2};