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
1c80eb9c
There was a problem fetching the pipeline summary.
Commit
1c80eb9c
authored
7 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
up
parent
94cbc397
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Magnetostatics/electromagnet.pro
+50
-42
50 additions, 42 deletions
Magnetostatics/electromagnet.pro
README.md
+3
-2
3 additions, 2 deletions
README.md
with
53 additions
and
44 deletions
Magnetostatics/electromagnet.pro
+
50
−
42
View file @
1c80eb9c
...
...
@@ -6,7 +6,7 @@
- Parameters shared by Gmsh and GetDp, and Onelab parameters
- FunctionSpaces for the 2D vector potential formulation
To compute the solution in a terminal:
To compute the solution in a terminal:
getdp electromagnet -solve MagSta_a
getdp electromagnet -pos Map
...
...
@@ -15,29 +15,29 @@
Run (button at the bottom of the left panel)
------------------------------------------------------------------- */
/* Electromagnetic fields expand to infinity.
/* Electromagnetic fields expand to infinity.
The corresponding boundary condition can be imposed rigorously
by means of a gometrical transformation that maps a ring (or shell) of finite elements
to the complementary of its interior.
to the complementary of its interior.
As this is a mere geometric transformation,
it is enough in the model description to attribute a special jacobian
to the ring region ("AirInf"). See Jacobian{} section below.
With this information, GetDP is able to deal with the correct transformation
of all quantities involved in the model.
With this information, GetDP is able to deal with the correct transformation
of all quantities involved in the model.
The special jacobian "VolSphShell" has parameters.
The special jacobian "VolSphShell" has parameters.
There are 2 parameters in this case, "Val_Rint" and "Val_Rext",
which represent the inner and outer radii of the transformed ring region
and whose value must match those used
and whose value must match those used
in the geometrical description of the model (.geo file).
This is a typical case where Gmsh and GetDP must consistently share parameter values.
This is a typical case where Gmsh and GetDP must consistently share parameter values.
To ensure consistency in all cases, common parameters are defined
is a specific file "electromagnet_common.pro",
which is included in both the .geo and .pro file of the model.
is a specific file "electromagnet_common.pro",
which is included in both the .geo and .pro file of the model.
Besides sharing parameters between Gmsh and GetDP,
it is also useful to share some parameters (not all) with the user of the model,
i.e., to make them editable in the GUI before running the model.
i.e., to make them editable in the GUI before running the model.
Such variables are called Onelab variables (because the sharing mechanism
between the model and the GUI uses the Onelab interface).
Onelab parameters are defined with a "DefineNumber" statement,
...
...
@@ -50,12 +50,12 @@ Group {
Air
=
Region
[
101
];
Core
=
Region
[
102
];
Ind
=
Region
[
103
];
AirInf
=
Region
[
111
];
Surface_ht0
=
Region
[
1100
];
Surface_ht0
=
Region
[
1100
];
Surface_bn0
=
Region
[
1101
];
Surface_Inf
=
Region
[
1102
];
/* Abstract regions :
/* Abstract regions :
The purpose of abstract regions is to allow a generic definition of
the FunctionSpace, Formulation and PostProcessing fields
with no reference to model-specific Physical regions.
...
...
@@ -80,51 +80,51 @@ Group {
Function
{
mu0
=
4.e-7
*
Pi
;
murCore
=
DefineNumber
[
100
,
Name
"Model parameters/Mur core"
,
Help
"Magnetic relative permeability of Core"
];
Help
"Magnetic relative permeability of Core"
];
nu
[
Region
[{
Air
,
Ind
,
AirInf
}]
]
=
1.
/
mu0
;
nu
[
Core
]
=
1.
/
(
murCore
*
mu0
);
NbTurns
=
1000
;
Current
=
DefineNumber
[
0.01
,
Name
"Model parameters/Current"
,
Help
"Current injected in coil [A]"
];
Help
"Current injected in coil [A]"
];
Js_fct
[
Ind
]
=
-
NbTurns
*
Current
/
SurfaceArea
[];
/* The minus sign is to have the current in -e_z direction,
so that the magnetic induction field is in +e_y direction */
/* The minus sign is to have the current in -e_z direction,
so that the magnetic induction field is in +e_y direction */
}
/* In the 2D approximation, the magnetic vector potential A and the current density Js
are not scalars, but vectors with a z-component only:
are not scalars, but vectors with a z-component only:
A = Vector [ 0, 0, az(x,y,t) ]
Js = Vector [ 0, 0, jsz(x,y,t) ]
In order to compute derivatives and apply geometric transformations adequately,
In order to compute derivatives and apply geometric transformations adequately,
GetDP needs this information.
Regarding discretization, now, A is node-based, whereas Js is region-wise constant.
Considering all this, one ends then up with the FunctionSpaces
"Hcurl_a_Mag_2D" and "Hregion_j_Mag_2D" as they are defined below.
Regarding discretization, now, A is node-based, whereas Js is region-wise constant.
Considering all this, one ends then up with the FunctionSpaces
"Hcurl_a_Mag_2D" and "Hregion_j_Mag_2D" as they are defined below.
The function space "Hregion_j_Mag_2D" provides one basis function,
and hence one degree of freedom, per physical region in the abstract region "Vol_Js_Mag".
The constraint "SourceCurrentDensityZ" fixes all these dofs,
The constraint "SourceCurrentDensityZ" fixes all these dofs,
so the FunctionSpace "Hregion_j_Mag_2D" is fully fixed and has no FE unknowns.
One could thus have replaced it by a simple function
One could thus have replaced it by a simple function
and the Galerkin term would have been
Galerkin { [ Vector[ 0,0,-Js_fct[] ] , {a} ]; In Vol_Js_Mag;
Jacobian Vol; Integration Int; }
instead of
instead of
Galerkin { [ - Dof{js} , {a} ]; In Vol_Js_Mag;
Jacobian Vol; Integration Int; }
Thechosen implementation below is however more effeicient
Thechosen implementation below is however more effeicient
as it avoids evaluating repeatedly the function Js_fct[] during assembly.
*/
Constraint
{
{
Name
Dirichlet_a_Mag
;
{
Name
Dirichlet_a_Mag
;
Case
{
{
Region
Sur_Dir_Mag
;
Value
0.
;
}
}
...
...
@@ -164,7 +164,7 @@ FunctionSpace {
}
Include
"electromagnet_common.pro"
;
Include
"electromagnet_common.pro"
;
Val_Rint
=
rInt
;
Val_Rext
=
rExt
;
Jacobian
{
{
Name
Vol
;
...
...
@@ -179,11 +179,11 @@ Integration {
{
Name
Int
;
Case
{
{
Type
Gauss
;
Case
{
{
GeoElement
Triangle
;
NumberOfPoints
4
;
}
{
GeoElement
Quadrangle
;
NumberOfPoints
4
;
}
{
GeoElement
Quadrangle
;
NumberOfPoints
4
;
}
}
}
}
}
}
}
Formulation
{
...
...
@@ -215,26 +215,31 @@ Resolution {
PostProcessing
{
{
Name
MagSta_a_2D
;
NameOfFormulation
Magnetostatics_a_2D
;
Quantity
{
{
Name
a
;
Value
{
Local
{
[
{
a
}
];
In
Dom_Hcurl_a_Mag_2D
;
Jacobian
Vol
;
}
{
Name
a
;
Value
{
Local
{
[
{
a
}
];
In
Dom_Hcurl_a_Mag_2D
;
Jacobian
Vol
;
}
}
}
{
Name
az
;
Value
{
{
Name
az
;
Value
{
Local
{
[
CompZ
[{
a
}]
];
In
Dom_Hcurl_a_Mag_2D
;
Jacobian
Vol
;
}
}
}
{
Name
b
;
Value
{
{
Name
b
;
Value
{
Local
{
[
{
d
a
}
];
In
Dom_Hcurl_a_Mag_2D
;
Jacobian
Vol
;
}
}
}
{
Name
h
;
Value
{
{
Name
h
;
Value
{
Local
{
[
nu
[]
*
{
d
a
}
];
In
Dom_Hcurl_a_Mag_2D
;
Jacobian
Vol
;
}
}
}
{
Name
js
;
Value
{
Local
{
[
{
js
}
];
In
Dom_Hcurl_a_Mag_2D
;
Jacobian
Vol
;
}
}
}
}
}
}
...
...
@@ -242,7 +247,7 @@ PostProcessing {
e
=
1.e-5
;
h
=
0.02
;
p1
=
{
e
,
h
,
0
};
p2
=
{
0.25
-
e
,
h
,
0
};
// horizontal cut through model, just above x-axis.
p2
=
{
0.25
-
e
,
h
,
0
};
// horizontal cut through model, just above x-axis.
PostOperation
{
...
...
@@ -252,7 +257,10 @@ PostOperation {
"View[l].IntervalsType = 1;"
,
"View[l].NbIso = 40;"
],
File
"tmp.geo"
,
LastTimeStepOnly
]
;
Print
[
a
,
OnElementsOf
Dom_Hcurl_a_Mag_2D
,
File
"a.pos"
];
Print
[
js
,
OnElementsOf
Dom_Hcurl_a_Mag_2D
,
File
"js.pos"
];
Print
[
az
,
OnElementsOf
Dom_Hcurl_a_Mag_2D
,
File
"az.pos"
];
Print
[
b
,
OnElementsOf
Dom_Hcurl_a_Mag_2D
,
File
"b.pos"
];
Print
[
b
,
OnLine
{{
List
[
p1
]}{
List
[
p2
]}}
{
50
},
File
"by.pos"
];
}
}
...
...
This diff is collapsed.
Click to expand it.
README.md
+
3
−
2
View file @
1c80eb9c
This directory contains ONELAB tutorials.
See the corresponding wiki
(
http://gitlab.onelab.info/doc/tutorials/wikis/home
)
See the corresponding wiki
at
http://gitlab.onelab.info/doc/tutorials/wikis/home
as well as comments in the .pro and .geo files for more information.
Additional models can be found on http://gitlab.onelab.info/doc/models.
Additional examples highlighting various physical models and numerical
techniques can be found on http://gitlab.onelab.info/doc/models/wikis/home.
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