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
24e6b390
Commit
24e6b390
authored
5 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
explain both frequency- and time-domain simulation
parent
04b9e902
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Magnetodynamics/electromagnet.pro
+39
-10
39 additions, 10 deletions
Magnetodynamics/electromagnet.pro
with
39 additions
and
10 deletions
Magnetodynamics/electromagnet.pro
+
39
−
10
View file @
24e6b390
...
...
@@ -4,14 +4,18 @@
Features:
- Use of a template formulation library
- Identical to Tutorial 2 for a static current source
- Frequency-domain solution (phasor) for a dynamic current source
- Frequency-domain or time-domain solution for a time-dependent
current source
To compute the static solution in a terminal:
getdp electromagnet -solve Magnetostatics2D_a -pos Map_a
To compute the
time-harmonic dynamic
solution in a terminal:
To compute the
frequency-domain
solution in a terminal:
getdp electromagnet -solve Magnetodynamics2D_av -pos Map_a
To compute the time-dependent dynamic solution in a terminal:
getdp electromagnet -setnumber TimeDomain 1 -solve Magnetodynamics2D_av -pos Map_a
To compute the solution interactively from the Gmsh GUI:
File > Open > electromagnet.pro
You may choose the Resolution in the left panel:
...
...
@@ -42,10 +46,27 @@ Function {
DefineConstant
[
murCore
=
{
100
,
Name
"Model parameters/Mur core"
},
Current
=
{
0.01
,
Name
"Model parameters/Current"
},
frequency
=
{
1
,
Name
"Model parameters/Frequency"
}
TimeDomain
=
{
0
,
Choices
{
0
=
"Frequency-domain"
,
1
=
"Time-domain"
},
Name
"Model parameters/03Analysis type"
}
frequency
=
{
50
,
Visible
!
TimeDomain
,
Name
"Model parameters/Frequency"
}
];
Freq
=
frequency
;
If
(
TimeDomain
)
// Fix parameters from the "Lib_Magnetodynamics2D_av_Cir.pro" template:
Flag_FrequencyDomain
=
0
;
TimeInit
=
0
;
// start simulation at time = 0s
TimeFinal
=
20e-3
;
// stop simulation at time = 20 ms
DeltaTime
=
1e-3
;
// use time steps equal to 1 ms
// Define the time modulation of the current source, i.e. a linear ramp from
// 0 to 1 until 10 ms, then a constant value of 1:
myModulation
[]
=
(
$
Time
<
TimeFinal
/
2
)
?
(
2
/
TimeFinal
*
$
Time
)
:
1
;
Else
// Fix parameters from the "Lib_Magnetodynamics2D_av_Cir.pro" template:
Flag_FrequencyDomain
=
1
;
Freq
=
frequency
;
EndIf
mu0
=
4.e-7
*
Pi
;
nu
[
Region
[{
Air
,
Ind
,
AirInf
}]
]
=
1.
/
mu0
;
nu
[
Core
]
=
1.
/
(
murCore
*
mu0
);
...
...
@@ -55,10 +76,13 @@ Function {
Ns
[
Ind
]
=
1000
;
// number of turns in coil
Sc
[
Ind
]
=
SurfaceArea
[]
;
// area of coil cross section
// Current density in each coil portion for a unit current (will be multiplied
// by the actual total current in the coil)
js0
[
Ind
]
=
Ns
[]
/
Sc
[]
*
Vector
[
0
,
0
,
-
1
];
CoefGeos
[]
=
1
;
js0
[
Ind
]
=
Ns
[]
/
Sc
[]
*
Vector
[
0
,
0
,
-
1
];
// For a correct definition of the voltage:
CoefGeos
[]
=
1
;
// planar model, 1 meter thick
}
Constraint
{
...
...
@@ -70,8 +94,13 @@ Constraint {
}
{
Name
Current_2D
;
Case
{
// represents the phasor amplitude (peak to peak value) for a dynamic analysis
{
Region
Ind
;
Value
Current
;
}
If
(
Flag_FrequencyDomain
)
// Amplitude of the phasor is set to "Current"
{
Region
Ind
;
Value
Current
;
}
Else
// Time-dependent value is set to "Current * myModulation[]"
{
Region
Ind
;
Value
Current
;
TimeFunction
myModulation
[];
}
EndIf
}
}
{
Name
Voltage_2D
;
...
...
@@ -87,8 +116,8 @@ PostOperation {
{
Name
Map_a
;
NameOfPostProcessing
Magnetodynamics2D_av
;
Operation
{
Print
[
a
,
OnElementsOf
Vol_Mag
,
File
"a.pos"
];
Print
[
b
,
OnElementsOf
Vol_Mag
,
File
"b.pos"
,
HarmonicToTime
20
];
Print
[
j
,
OnElementsOf
Vol_Mag
,
File
"j.pos"
,
HarmonicToTime
20
];
Print
[
b
,
OnElementsOf
Vol_Mag
,
File
"b.pos"
];
Print
[
j
,
OnElementsOf
Vol_Mag
,
File
"j.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