diff --git a/MagneticForces/InfiniteBox.geo b/MagneticForces/InfiniteBox.geo index b3a13268c555f672cd1f75467cda7d56d46f39da..8ff2566344e9dd24ea912dad596fb01d14828f70 100644 --- a/MagneticForces/InfiniteBox.geo +++ b/MagneticForces/InfiniteBox.geo @@ -33,15 +33,15 @@ v = newv; Volume(v) = { sl }; Printf("Cuboid v=%g", v); If( Flag_TransfInf ) - //Mesh.Algorithm3D = 4; + //Mesh.Algorithm3D = 4; // (4=Frontal, 5=Frontal Delaunay, 6=Frontal Hex, 7=MMG3D, 9=R-tree) - For num In { l12:l85 } + For num In { l12:l85 } Transfinite Line{ num } = 10; EndFor - For num In { l15:l48 } + For num In { l15:l48 } Transfinite Line{ num } = 5; EndFor - For num In { s1:s6 } + For num In { s1:s6 } Transfinite Surface{ num } ; EndFor Transfinite Volume{ v } ; @@ -91,9 +91,9 @@ EndIf // Compute aspect ratio of the Infinite Box diagInt = Sqrt[ xInt^2 + yInt^2 + zInt^2 ]; pp = 1.2; // pp=1 square InfBox, pp>3 Box and content have the same aspect ratio -xInt *= ratioBox*(diagInt/xInt)^(1/pp); -yInt *= ratioBox*(diagInt/yInt)^(1/pp); -zInt *= ratioBox*(diagInt/zInt)^(1/pp); +xInt *= ratioBox*(diagInt/xInt)^(1/pp); +yInt *= ratioBox*(diagInt/yInt)^(1/pp); +zInt *= ratioBox*(diagInt/zInt)^(1/pp); // FIXME is there another (better) way to convey the values calculated here to getDP @@ -133,19 +133,19 @@ If(Flag_InfiniteBox) pp7 = newp; Point (pp7) = {xCnt+xExt, yCnt+yExt, zCnt+zExt, lc2inf}; pp8 = newp; Point (pp8) = {xCnt-xExt, yCnt+yExt, zCnt+zExt, lc2inf}; - pnt[]={p1,p2,p3,p4,pp1,pp2,pp3,pp4}; Call Cuboid; + pnt[]={p1,p2,p3,p4,pp1,pp2,pp3,pp4}; Call Cuboid; VolInf[] = v; - // FIXME seems to be forbidden to have the command "VolInf[] = v;" - // on the same line as "Call Cuboid" - pnt[]={p5,p6,p7,p8,pp5,pp6,pp7,pp8}; Call Cuboid; + // FIXME seems to be forbidden to have the command "VolInf[] = v;" + // on the same line as "Call Cuboid" + pnt[]={p5,p6,p7,p8,pp5,pp6,pp7,pp8}; Call Cuboid; VolInf[] += v; - pnt[]={p1,p2,p6,p5,pp1,pp2,pp6,pp5}; Call Cuboid; + pnt[]={p1,p2,p6,p5,pp1,pp2,pp6,pp5}; Call Cuboid; VolInf[] += {v}; - pnt[]={p3,p4,p8,p7,pp3,pp4,pp8,pp7}; Call Cuboid; + pnt[]={p3,p4,p8,p7,pp3,pp4,pp8,pp7}; Call Cuboid; VolInf[] += {v}; - pnt[]={p2,p3,p7,p6,pp2,pp3,pp7,pp6}; Call Cuboid; + pnt[]={p2,p3,p7,p6,pp2,pp3,pp7,pp6}; Call Cuboid; VolInf[] += {v}; - pnt[]={p4,p1,p5,p8,pp4,pp1,pp5,pp8}; Call Cuboid; + pnt[]={p4,p1,p5,p8,pp4,pp1,pp5,pp8}; Call Cuboid; VolInf[] += {v}; Physical Volume("InfiniteX", 1) = { VolInf[4], VolInf[5] }; @@ -159,9 +159,3 @@ InteriorInfBox = v; For num In {0:#VolInf()-1} Printf("VolInf %5g", VolInf[num]); EndFor - - - - - - diff --git a/MagneticForces/magnets.geo b/MagneticForces/magnets.geo index 622703f5bfa8288c95abd0720ae1fd8d2f4fb044..2978617f5d003e1c4152d0a762dcb1924d85a7cb 100644 --- a/MagneticForces/magnets.geo +++ b/MagneticForces/magnets.geo @@ -6,11 +6,10 @@ mm = 1.e-3; SetFactory("OpenCASCADE"); - // set some global Gmsh options Mesh.Optimize = 1; // optimize quality of tetrahedra Mesh.VolumeEdges = 0; // Toggle mesh display -Mesh.SurfaceEdges = 0; +Mesh.SurfaceEdges = 0; Solver.AutoMesh = 2; // always remesh if necessary (don't reuse mesh on disk) VolMagnets[] = {}; @@ -27,12 +26,11 @@ For i In {1:NumMagnets} Rotate { {1,0,0}, {X~{i},Y~{i},Z~{i}}, deg*Rx~{i} } { Volume{ iLabel }; } Physical Volume(Sprintf("Magnet_%g",i),10*i) = { iLabel }; - skin~{i}[] = CombinedBoundary{ Volume{ iLabel }; }; + skin~{i}[] = Abs(CombinedBoundary{ Volume{ iLabel }; }); Physical Surface(Sprintf("SkinMagnet_%g",i),10*i+1) = -skin~{i}[]; // magnet skin VolMagnets[] += { iLabel }; EndFor - Include "InfiniteBox.geo"; // The overall dimensions of the model have been calculated in InfiniteBox.geo @@ -40,19 +38,14 @@ Include "InfiniteBox.geo"; Mesh.CharacteristicLengthMin = lc1inf; Mesh.CharacteristicLengthMax = lc1inf; - -AirBox[] = BooleanDifference{ - Volume{ InteriorInfBox }; Delete; -}{ - Volume{ VolMagnets[] }; -}; +AirBox[] = BooleanDifference{ Volume{ InteriorInfBox }; Delete; }{ + Volume{ VolMagnets[] }; }; Physical Volume("AirBox",4) = { AirBox[] }; Volumes[] = { VolInf[], VolMagnets[], AirBox[] }; -vv[] = BooleanFragments{ - Volume { Volumes[] }; Delete; }{}; +vv[] = BooleanFragments{ Volume { Volumes[] }; Delete; }{}; If( #vv[] > #Volumes[] ) Error("Overlapping magnets"); @@ -64,12 +57,5 @@ For num In {0:#vv()-1} Printf("Fragment %5g -> %g", Volumes[num], vv(num)); EndFor -Outer[] = CombinedBoundary{ Volume{ Volumes[] }; }; +Outer[] = Abs(CombinedBoundary{ Volume{ : }; }); Physical Surface("OuterSurface", 5) = { Outer[] }; - - - - - - - diff --git a/MagneticForces/magnets_common.pro b/MagneticForces/magnets_common.pro index 49aaef843dde8b5faa5f7c894001356e43ceabb5..be39e1bfc925fbf619603b6262acf75174f2e324 100644 --- a/MagneticForces/magnets_common.pro +++ b/MagneticForces/magnets_common.pro @@ -35,11 +35,11 @@ For i In {1:NumMagnets} Name Sprintf("Parameters/Magnet %g/1XZ aspect ration", i), Visible (M~{i} == 1) }, - Rx~{i} = {0, Min -Pi, Max Pi, Step Pi/180, Visible Flag_FullMenu, + Rx~{i} = {0, Min -180, Max 180, Step 1, Visible Flag_FullMenu, Name Sprintf("Parameters/Magnet %g/2X rotation [deg]", i) }, - Ry~{i} = {0, Min -Pi, Max Pi, Step Pi/180, Visible Flag_FullMenu, + Ry~{i} = {0, Min -180, Max 180, Step 1, Visible Flag_FullMenu, Name Sprintf("Parameters/Magnet %g/2Y rotation [deg]", i) }, - Rz~{i} = {0, Min -Pi, Max Pi, Step Pi/180, + Rz~{i} = {0, Min -180, Max 180, Step 1, Name Sprintf("Parameters/Magnet %g/2Z rotation [deg]", i) }, MUR~{i} = {(i==1)?1.:1000., @@ -49,7 +49,7 @@ For i In {1:NumMagnets} ]; EndFor -//The geometrical parameters of the Infinite box. +//The geometrical parameters of the Infinite box. DefineConstant[ xInt = {1, Name "Infinite box/xInt", Visible 0} yInt = {1, Name "Infinite box/yInt", Visible 0}