Skip to content
Snippets Groups Projects
Commit 24e6b390 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

explain both frequency- and time-domain simulation

parent 04b9e902
No related branches found
No related tags found
No related merge requests found
......@@ -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" ];
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment