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
8366d870
Commit
8366d870
authored
4 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
pp
parent
2f8c50a4
No related branches found
No related tags found
No related merge requests found
Pipeline
#7585
passed
4 years ago
Stage: test
Changes
2
Pipelines
6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MagneticForces/magnets.pro
+60
-62
60 additions, 62 deletions
MagneticForces/magnets.pro
Magnetodynamics/transfo.pro
+3
-1
3 additions, 1 deletion
Magnetodynamics/transfo.pro
with
63 additions
and
63 deletions
MagneticForces/magnets.pro
+
60
−
62
View file @
8366d870
...
...
@@ -2,13 +2,13 @@
Tutorial 9 : 3D magnetostatic dual formulations and magnetic forces
Features:
- 3D Magnetostatics
- 3D Magnetostatics
- Dual vector and scalar magnetic potentials formulations
- Boundary condition at infinity with infinite elements
- Maxwell stress tensor and rigid-body magnetic forces
To compute the solution in a terminal:
First generate the (3D) mesh and then run getdp with the chosen resolution
First generate the (3D) mesh and then run getdp with the chosen resolution
gmsh magnets.geo -3
getdp magnets.pro -solve MagSta_a
OR
...
...
@@ -16,67 +16,66 @@
To compute the solution interactively from the Gmsh GUI:
File > Open > magnets.pro
Resolution can be chosen from the menu on the left:
Resolution can be chosen from the menu on the left:
MagSta_a (default) or MagSta_phi
Run (button at the bottom of the left panel)
------------------------------------------------------------------- */
/*
This tutorial solves the electromagnetic field
and the rigid-body forces acting on a set of magnetic pieces
of either parallelepipedic or cylindrical shape.
Besides position and dimension, each piece is attributed
a (constant) magnetic permeability and/or a remanence field.
Hereafter, the pieces are all, simply though imprecisely, referred to as "Magnet",
irresective of whether they are truly permanent magnets or ferromagnetic barrels.
This tutorial solves the electromagnetic field and the rigid-body forces acting
on a set of magnetic pieces of either parallelepipedic or cylindrical shape.
Besides position and dimension, each piece is attributed a (constant) magnetic
permeability and/or a remanence field. Hereafter, the pieces are all, simply
though imprecisely, referred to as "Magnet", irresective of whether they are
truly permanent magnets or ferromagnetic barrels.
The tutorial model proposes two dual 3D magnetostatic formulations:
- the magnetic vector potential formulation with spanning-tree gauging;
- the scalar magnetic potential formulation.
As there are no conductors, the later is rather simple. The source field "hs" is
directly the the known coercive field hc[]:
As there are no conductors, the later is rather simple. The source field "hs"
is directly the the known coercive field hc[]:
h = hs - grad phi , hs = -hc.
If the "Add infinite box" box is ticked, a transformation to infinity shell is
used to impose the exact zero-field boundary condition at infinity.
See also
Tutorial 2: magnetostatic field of an electromagnet.
The shell is generated
automatically by including "InfiniteBox.geo"
at the end of the geometrical description of the model.
It can be placed rather close of the magnets without
loss of accuracy.
The preferred way to compute electromagnetic forces in GetDP
is as an explicit
by-product of the Maxwell stress tensor "TM[{b}]",
which is a material
dependent function of the magnetic induction "b" field.
The magnetic force
acting on a rigid body in empty space can be evaluated
as the flux of the
Maxwell stress tensor through a surface "S" (surrounding the body).
A special
auxiliary function "g(S)" linked "S" is defined for each magnet, i.e.
"g(SkinMagnet~{i}) = un~{i}".
The resultant magnetic force acting on
"Magnet~{i}" is given by the integral:
If the "Add infinite box" box is ticked, a transformation to infinity shell is
used to impose the exact zero-field boundary condition at infinity.
See also
Tutorial 2: magnetostatic field of an electromagnet.
The shell is generated
automatically by including "InfiniteBox.geo"
at the end of the geometrical
description of the model. It can be placed rather close of the magnets without
loss of accuracy.
The preferred way to compute electromagnetic forces in GetDP
is as an explicit
by-product of the Maxwell stress tensor "TM[{b}]",
which is a material
dependent function of the magnetic induction "b" field.
The magnetic force
acting on a rigid body in empty space can be evaluated
as the flux of the
Maxwell stress tensor through a surface "S" (surrounding the body).
A special
auxiliary function "g(S)" linked "S" is defined for each magnet, i.e.
"g(SkinMagnet~{i}) = un~{i}".
The resultant magnetic force acting on
"Magnet~{i}" is given by the integral:
f~{i} = Integral [ TM[{b}] * {-grad un~{i}} ] ;
This approach is analogous to the computation of heat flux "q(S)" through a
surface "S" described in "Tutorial 5: thermal problem with contact resistances".
Note that the Maxwell stress tensor is always discontinuous on material discontinuities,
and that magnetic forces acting on rigid bodies
depend only on the Maxwell stress tensor in empty space,
and on the "b" and "h" field distribution,
on the external side of "SkinMagnet~{i}"
(side of the surface in contact with air).
"{-grad un~{i}}" in the above formula can be regarded
as the normal vector to "SkinMagnet~{i}"
in the one element thick layer "layer~{i}" of finite elements
around "Magnet~{i}", and "f~{i}", is thus indeed the flux of "TM[]"
through the surface of "Magnet~{i}".
The support of "{-grad un~{i}}" is limited to "layer~{i}",
which is much smaller than "AirBox".
To speed up the computation of forces, a special domain "Vol_Force"
for force integrations is defined, which contains only
the layers "layer~{i}" of all magnets.
This approach is analogous to the computation of heat flux "q(S)" through a
surface "S" described in "Tutorial 5: thermal problem with contact
resistances".
Note that the Maxwell stress tensor is always discontinuous on material
discontinuities, and that magnetic forces acting on rigid bodies depend only on
the Maxwell stress tensor in empty space, and on the "b" and "h" field
distribution, on the external side of "SkinMagnet~{i}" (side of the surface in
contact with air).
"{-grad un~{i}}" in the above formula can be regarded as the normal vector to
"SkinMagnet~{i}" in the one element thick layer "layer~{i}" of finite elements
around "Magnet~{i}", and "f~{i}", is thus indeed the flux of "TM[]" through the
surface of "Magnet~{i}".
The support of "{-grad un~{i}}" is limited to "layer~{i}", which is much
smaller than "AirBox". To speed up the computation of forces, a special domain
"Vol_Force" for force integrations is defined, which contains only the layers
"layer~{i}" of all magnets.
*/
Include
"magnets_common.pro"
...
...
@@ -98,20 +97,20 @@ Group{
Outer
=
Region
[
5
];
For
i
In
{
1
:
NumMagnets
}
Magnet
~
{
i
}
=
Region
[
{(
10
*
i
)}];
Magnet
~
{
i
}
=
Region
[
{(
10
*
i
)}];
SkinMagnet
~
{
i
}
=
Region
[
{(
10
*
i
+
1
)}
];
Layer
~
{
i
}
=
Region
[
AirBox
,
OnOneSideOf
SkinMagnet
~
{
i
}]
;
EndFor
// Abstract Groups (group geometrical regions into formulation relevant groups)
Vol_Inf
=
Region
[
{
domInfX
,
domInfY
,
domInfZ
}
];
Vol_Inf
=
Region
[
{
domInfX
,
domInfY
,
domInfZ
}
];
Vol_Air
=
Region
[
{
AirBox
,
Vol_Inf
}
];
Vol_Magnet
=
Region
[{}];
Sur_Magnet
=
Region
[{}];
Vol_Force
=
Region
[{}];
For
i
In
{
1
:
NumMagnets
}
Sur_Magnet
+=
Region
[
SkinMagnet
~
{
i
}];
Sur_Magnet
+=
Region
[
SkinMagnet
~
{
i
}];
Vol_Magnet
+=
Region
[
Magnet
~
{
i
}];
Vol_Layer
+=
Region
[
Layer
~
{
i
}];
EndFor
...
...
@@ -152,7 +151,7 @@ Jacobian {
{
Name
Vol
;
Case
{
{
Region
All
;
Jacobian
Vol
;
}
{
Region
domInfX
;
Jacobian
VolRectShell
{
xInt
,
xExt
,
1
,
xCnt
,
yCnt
,
zCnt
};}
{
Region
domInfX
;
Jacobian
VolRectShell
{
xInt
,
xExt
,
1
,
xCnt
,
yCnt
,
zCnt
};}
{
Region
domInfY
;
Jacobian
VolRectShell
{
yInt
,
yExt
,
2
,
xCnt
,
yCnt
,
zCnt
};}
{
Region
domInfZ
;
Jacobian
VolRectShell
{
zInt
,
zExt
,
3
,
xCnt
,
yCnt
,
zCnt
};}
}
...
...
@@ -160,7 +159,7 @@ Jacobian {
}
Integration
{
{
Name
Int
;
{
Name
Int
;
Case
{
{
Type
Gauss
;
Case
{
...
...
@@ -168,7 +167,7 @@ Integration {
{
GeoElement
Quadrangle
;
NumberOfPoints
4
;
}
{
GeoElement
Tetrahedron
;
NumberOfPoints
4
;
}
{
GeoElement
Hexahedron
;
NumberOfPoints
6
;
}
{
GeoElement
Prism
;
NumberOfPoints
6
;
}
{
GeoElement
Prism
;
NumberOfPoints
6
;
}
}
}
}
...
...
@@ -212,7 +211,7 @@ FunctionSpace {
}
{
Name
Hcurl_a
;
Type
Form1
;
// magnetic vector potential
BasisFunction
{
{
Name
se
;
NameOfCoef
ae
;
Function
BF_Edge
;
{
Name
se
;
NameOfCoef
ae
;
Function
BF_Edge
;
Support
Dom_Hcurl_a
;
Entity
EdgesOf
[
All
];
}
}
Constraint
{
...
...
@@ -268,7 +267,7 @@ Formulation {
In
Vol_mu
;
Jacobian
Vol
;
Integration
Int
;
}
Galerkin
{
[
nu
[]
*
br
[]
,
{
d
a
}
]
;
In
Vol_Magnet
;
Jacobian
Vol
;
Integration
Int
;
}
For
i
In
{
1
:
NumMagnets
}
For
i
In
{
1
:
NumMagnets
}
// dummy term to define dofs for fully fixed space
Galerkin
{
[
0
*
Dof
{
un
~
{
i
}}
,
{
un
~
{
i
}}
]
;
In
Vol_Air
;
Jacobian
Vol
;
Integration
Int
;
}
...
...
@@ -301,10 +300,10 @@ Resolution {
PostProcessing
{
{
Name
MagSta_phi
;
NameOfFormulation
MagSta_phi
;
Quantity
{
{
Name
b
;
{
Name
b
;
Value
{
Local
{
[
-
mu
[]
*
{
d
phi
}
]
;
In
Dom_Hgrad_phi
;
Jacobian
Vol
;
}
Local
{
[
-
mu
[]
*
hc
[]
]
;
In
Vol_Magnet
;
Jacobian
Vol
;
}
}
}
{
Name
h
;
{
Name
h
;
Value
{
Local
{
[
-
{
d
phi
}
]
;
In
Dom_Hgrad_phi
;
Jacobian
Vol
;
}
}
}
{
Name
hc
;
Value
{
Local
{
[
hc
[]
]
;
In
Vol_Magnet
;
Jacobian
Vol
;
}
}
}
{
Name
phi
;
Value
{
Local
{
[
{
phi
}
]
;
In
Dom_Hgrad_phi
;
Jacobian
Vol
;
}
}
}
...
...
@@ -380,8 +379,7 @@ PostOperation {
SendToServer
Sprintf
(
"Output/Magnet %g/Y force [N]"
,
i
),
Color
"Ivory"
];
Print
[
fz
~
{
i
}[
Vol_Air
],
OnGlobal
,
Format
Table
,
File
>
"Fz.dat"
,
SendToServer
Sprintf
(
"Output/Magnet %g/Z force [N]"
,
i
),
Color
"Ivory"
];
EndFor
EndFor
}
}
}
This diff is collapsed.
Click to expand it.
Magnetodynamics/transfo.pro
+
3
−
1
View file @
8366d870
...
...
@@ -95,6 +95,8 @@ Function {
// secondary.
Flag_CircuitCoupling
=
1
;
Flag_FrequencyDomain
=
0
;
// Note that the voltage will not be equally distributed in the PLUS and MINUS
// parts, which is the reason why we must apply the total voltage through a
// circuit -- and we cannot simply use a current source like in Tutorial 7a.
...
...
@@ -128,7 +130,7 @@ Function {
// High value for an open-circuit test; Low value for a short-circuit test;
// any value in-between for any charge
Resistance
[
R_out
]
=
1
e6
;
Resistance
[
R_out
]
=
1
0
;
// End-winding primary winding resistance for more realistic primary coil
// model
...
...
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