Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
tutorials
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
documentation
tutorials
Commits
12680b6e
Commit
12680b6e
authored
9 months ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix outer surface
parent
e08ebfc6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
MagneticForces/InfiniteBox.geo
+15
-21
15 additions, 21 deletions
MagneticForces/InfiniteBox.geo
MagneticForces/magnets.geo
+6
-20
6 additions, 20 deletions
MagneticForces/magnets.geo
MagneticForces/magnets_common.pro
+4
-4
4 additions, 4 deletions
MagneticForces/magnets_common.pro
with
25 additions
and
45 deletions
MagneticForces/InfiniteBox.geo
+
15
−
21
View file @
12680b6e
...
...
@@ -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
This diff is collapsed.
Click to expand it.
MagneticForces/magnets.geo
+
6
−
20
View file @
12680b6e
...
...
@@ -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
[]
};
This diff is collapsed.
Click to expand it.
MagneticForces/magnets_common.pro
+
4
−
4
View file @
12680b6e
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment