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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
documentation
tutorials
Commits
bc1013b0
There was a problem fetching the pipeline summary.
Commit
bc1013b0
authored
7 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
up
parent
d62b69d5
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Magnetodynamics/Lib_Magnetodynamics2D_av_Cir.pro
+40
-24
40 additions, 24 deletions
Magnetodynamics/Lib_Magnetodynamics2D_av_Cir.pro
Magnetodynamics/electromagnet.pro
+5
-5
5 additions, 5 deletions
Magnetodynamics/electromagnet.pro
Magnetodynamics/transfo.pro
+4
-4
4 additions, 4 deletions
Magnetodynamics/transfo.pro
with
49 additions
and
33 deletions
Magnetodynamics/Lib_Mag
Dyn_av_2D
_Cir.pro
→
Magnetodynamics/Lib_Mag
netodynamics2D_av
_Cir.pro
+
40
−
24
View file @
bc1013b0
// Lib_Mag
Dyn_av_2D
_Cir.pro
// Lib_Mag
netodynamics2D_av
_Cir.pro
//
// Template library for 2D magnetostatic and magnetodynamic problems in terms
// of the magnetic vector potential a (potentially coupled with the electric
...
...
@@ -8,6 +8,9 @@
// redefined from outside the template:
DefineConstant
[
modelPath
=
""
,
// default path of the model
resPath
=
StrCat
[
modelPath
,
"res/"
],
// path for post-operation files
Flag_Axi
=
0
,
// axisymmetric model?
Flag_FrequencyDomain
=
1
,
// frequency-domain or time-domain simulation
Flag_CircuitCoupling
=
0
,
// consider coupling with external electric circuit
Flag_NewtonRaphson
=
1
,
// Newton-Raphson or Picard method for nonlinear iterations
...
...
@@ -19,6 +22,9 @@ DefineConstant[
FE_Order
=
1
,
// finite element order
Val_Rint
=
0
,
// interior radius of annulus shell transformation region (Vol_Inf_Mag)
Val_Rext
=
0
// exterior radius of annulus shell transformation region (Vol_Inf_Mag)
Val_Cx
=
0
,
// x-coordinate of center of Vol_Inf_Mag
Val_Cy
=
0
,
// y-coordinate of center of Vol_Inf_Mag
Val_Cz
=
0
,
// z-coordinate of center of Vol_Inf_Mag
NL_tol_abs
=
1e-6
,
// absolute tolerance on residual for noninear iterations
NL_tol_rel
=
1e-6
,
// relative tolerance on residual for noninear iterations
NL_iter_max
=
20
// maximum number of noninear iterations
...
...
@@ -98,14 +104,24 @@ Group{
Jacobian
{
{
Name
Vol
;
Case
{
If
(
Flag_Axi
)
{
Region
Vol_Inf_Mag
;
Jacobian
VolSphShell
{
Val_Rint
,
Val_Rext
}
;
}
Jacobian
VolAxiSquSphShell
{
Val_Rint
,
Val_Rext
,
Val_Cx
,
Val_Cy
,
Val_Cz
};
}
{
Region
All
;
Jacobian
VolAxiSqu
;
}
Else
{
Region
Vol_Inf_Mag
;
Jacobian
VolSphShell
{
Val_Rint
,
Val_Rext
,
Val_Cx
,
Val_Cy
,
Val_Cz
};
}
{
Region
All
;
Jacobian
Vol
;
}
EndIf
}
}
{
Name
Sur
;
Case
{
If
(
Flag_Axi
)
{
Region
All
;
Jacobian
SurAxi
;
}
Else
{
Region
All
;
Jacobian
Sur
;
}
EndIf
}
}
}
...
...
@@ -232,7 +248,7 @@ EndIf
// Static Formulation
Formulation
{
{
Name
Mag
Sta_a_2D
;
Type
FemEquation
;
{
Name
Mag
netostatics2D_a
;
Type
FemEquation
;
Quantity
{
{
Name
a
;
Type
Local
;
NameOfSpace
Hcurl_a_2D
;
}
{
Name
ir
;
Type
Local
;
NameOfSpace
Hregion_i_2D
;
}
...
...
@@ -270,7 +286,7 @@ Formulation {
// Dynamic Formulation (eddy currents)
Formulation
{
{
Name
Mag
Dyn_a_2D
;
Type
FemEquation
;
{
Name
Mag
netodynamics2D_av
;
Type
FemEquation
;
Quantity
{
{
Name
a
;
Type
Local
;
NameOfSpace
Hcurl_a_2D
;
}
{
Name
A_floating
;
Type
Global
;
NameOfSpace
Hcurl_a_2D
[
A
];
}
...
...
@@ -383,9 +399,9 @@ Formulation {
}
Resolution
{
{
Name
Mag
Dyn_a_2D
;
{
Name
Mag
netodynamics2D_av
;
System
{
{
Name
Sys
;
NameOfFormulation
Mag
Dyn_a_2D
;
{
Name
A
;
NameOfFormulation
Mag
netodynamics2D_av
;
If
(
Flag_FrequencyDomain
)
Type
ComplexValue
;
Frequency
Freq
;
EndIf
...
...
@@ -393,51 +409,51 @@ Resolution {
}
Operation
{
If
(
Flag_FrequencyDomain
)
Generate
[
Sys
];
Solve
[
Sys
];
SaveSolution
[
Sys
];
Generate
[
A
];
Solve
[
A
];
SaveSolution
[
A
];
Else
InitSolution
[
Sys
];
// provide initial condition
InitSolution
[
A
];
// provide initial condition
TimeLoopTheta
[
TimeInit
,
TimeFinal
,
DeltaTime
,
1.
]{
// Euler implicit (1) -- Crank-Nicolson (0.5)
Generate
[
Sys
];
Solve
[
Sys
];
Generate
[
A
];
Solve
[
A
];
If
(
NbrRegions
[
Vol_NL_Mag
])
Generate
[
Sys
];
GetResidual
[
Sys
,
$
res0
];
Generate
[
A
];
GetResidual
[
A
,
$
res0
];
Evaluate
[
$
res
=
$
res0
,
$
iter
=
0
];
Print
[{
$
iter
,
$
res
,
$
res
/
$
res0
},
Format
"Residual %03g: abs %14.12e rel %14.12e"
];
While
[
$
res
>
NL_tol_abs
&&
$
res
/
$
res0
>
NL_tol_rel
&&
$
res
/
$
res0
<=
1
&&
$
iter
<
NL_iter_max
]{
Solve
[
Sys
];
Generate
[
Sys
];
GetResidual
[
Sys
,
$
res
];
Solve
[
A
];
Generate
[
A
];
GetResidual
[
A
,
$
res
];
Evaluate
[
$
iter
=
$
iter
+
1
];
Print
[{
$
iter
,
$
res
,
$
res
/
$
res0
},
Format
"Residual %03g: abs %14.12e rel %14.12e"
];
}
EndIf
SaveSolution
[
Sys
];
SaveSolution
[
A
];
}
EndIf
}
}
{
Name
Mag
Sta_a_2D
;
{
Name
Mag
netostatics2D_a
;
System
{
{
Name
Sys
;
NameOfFormulation
Mag
Sta_a_2D
;
}
{
Name
A
;
NameOfFormulation
Mag
netostatics2D_a
;
}
}
Operation
{
InitSolution
[
Sys
];
Generate
[
Sys
];
Solve
[
Sys
];
InitSolution
[
A
];
Generate
[
A
];
Solve
[
A
];
If
(
NbrRegions
[
Vol_NL_Mag
])
Generate
[
Sys
];
GetResidual
[
Sys
,
$
res0
];
Generate
[
A
];
GetResidual
[
A
,
$
res0
];
Evaluate
[
$
res
=
$
res0
,
$
iter
=
0
];
Print
[{
$
iter
,
$
res
,
$
res
/
$
res0
},
Format
"Residual %03g: abs %14.12e rel %14.12e"
];
While
[
$
res
>
NL_tol_abs
&&
$
res
/
$
res0
>
NL_tol_rel
&&
$
res
/
$
res0
<=
1
&&
$
iter
<
NL_iter_max
]{
Solve
[
Sys
];
Generate
[
Sys
];
GetResidual
[
Sys
,
$
res
];
Solve
[
A
];
Generate
[
A
];
GetResidual
[
A
,
$
res
];
Evaluate
[
$
iter
=
$
iter
+
1
];
Print
[{
$
iter
,
$
res
,
$
res
/
$
res0
},
Format
"Residual %03g: abs %14.12e rel %14.12e"
];
}
EndIf
SaveSolution
[
Sys
];
SaveSolution
[
A
];
}
}
}
...
...
@@ -445,7 +461,7 @@ Resolution {
// Same PostProcessing for both static and dynamic formulations (both refer to
// the same FunctionSpace from which the solution is obtained)
PostProcessing
{
{
Name
Mag
Dyn_a_2D
;
NameOfFormulation
Mag
Dyn_a_2D
;
{
Name
Mag
netodynamics2D_av
;
NameOfFormulation
Mag
netodynamics2D_av
;
PostQuantity
{
// In 2D, a is a vector with only a z-component: (0,0,az)
{
Name
a
;
Value
{
...
...
@@ -516,7 +532,7 @@ PostProcessing {
}
}
{
Name
Mag
Sta_a_2D
;
NameOfFormulation
Mag
Sta_a_2D
;
{
Name
Mag
netostatics2D_a
;
NameOfFormulation
Mag
netostatics2D_a
;
PostQuantity
{
{
Name
a
;
Value
{
Term
{
[
{
a
}
];
In
Vol_Mag
;
Jacobian
Vol
;
}
...
...
This diff is collapsed.
Click to expand it.
Magnetodynamics/electromagnet.pro
+
5
−
5
View file @
bc1013b0
...
...
@@ -7,10 +7,10 @@
- Frequency-domain solution (phasor) for a dynamic current source
To compute the static solution in a terminal:
getdp electromagnet -solve Mag
Sta_a_2D
-pos Map_a
getdp electromagnet -solve Mag
netostatics2D_a
-pos Map_a
To compute the time-harmonic dynamic solution in a terminal:
getdp electromagnet -solve Mag
Dyn_a_2D
-pos Map_a
getdp electromagnet -solve Mag
netodynamics2D_av
-pos Map_a
To compute the solution interactively from the Gmsh GUI:
File > Open > electromagnet.pro
...
...
@@ -27,7 +27,7 @@ Group {
Surface_bn0
=
Region
[
1101
];
Surface_Inf
=
Region
[
1102
];
// Abstract regions used in the "Lib_Mag
Dyn_av_2D
_Cir.pro" template file
// Abstract regions used in the "Lib_Mag
netodynamics2D_av
_Cir.pro" template file
// that is included below:
Vol_Mag
=
Region
[{
Air
,
Core
,
Ind
,
AirInf
}];
// full magnetic domain
Vol_C_Mag
=
Region
[
Core
];
// massive conductors
...
...
@@ -77,10 +77,10 @@ Constraint {
}
}
Include
"Lib_Mag
Dyn_av_2D
_Cir.pro"
;
Include
"Lib_Mag
netodynamics2D_av
_Cir.pro"
;
PostOperation
{
{
Name
Map_a
;
NameOfPostProcessing
Mag
Dyn_a_2D
;
{
Name
Map_a
;
NameOfPostProcessing
Mag
netodynamics2D_av
;
Operation
{
Print
[
a
,
OnElementsOf
Vol_Mag
,
File
"a.pos"
];
Print
[
b
,
OnElementsOf
Vol_Mag
,
File
"b.pos"
,
HarmonicToTime
20
];
...
...
This diff is collapsed.
Click to expand it.
Magnetodynamics/transfo.pro
+
4
−
4
View file @
bc1013b0
...
...
@@ -7,7 +7,7 @@
- Circuit coupling used as a black-box (see Tutorial 8 for details)
To compute the solution in a terminal:
getdp transfo -solve Mag
Dyn_a_2D
-pos Map_a
getdp transfo -solve Mag
netodynamics2D_av
-pos Map_a
To compute the solution interactively from the Gmsh GUI:
File > Open > transfo.pro
...
...
@@ -40,7 +40,7 @@ Group {
Coil_2
=
Region
[{
Coil_2_P
,
Coil_2_M
}];
Coils
=
Region
[{
Coil_1
,
Coil_2
}];
// Abstract regions that will be used in the "Lib_Mag
Dyn_av_2D
_Cir.pro"
// Abstract regions that will be used in the "Lib_Mag
netodynamics2D_av
_Cir.pro"
// template file included below;
Vol_Mag
=
Region
[{
Air
,
Core
,
Coils
}];
// full magnetic domain
If
(
type_Conds
==
1
)
...
...
@@ -198,10 +198,10 @@ Constraint {
}
}
Include
"Lib_Mag
Dyn_av_2D
_Cir.pro"
;
Include
"Lib_Mag
netodynamics2D_av
_Cir.pro"
;
PostOperation
{
{
Name
Map_a
;
NameOfPostProcessing
Mag
Dyn_a_2D
;
{
Name
Map_a
;
NameOfPostProcessing
Mag
netodynamics2D_av
;
Operation
{
Print
[
j
,
OnElementsOf
Region
[{
Vol_C_Mag
,
Vol_S_Mag
}],
Format
Gmsh
,
File
"j.pos"
];
Print
[
b
,
OnElementsOf
Vol_Mag
,
Format
Gmsh
,
File
"b.pos"
];
...
...
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