Select Git revision
electromagnet.pro
electromagnet.pro 2.64 KiB
/* -------------------------------------------------------------------
Tutorial 7a : magnetic fields of an electromagnet
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
To compute the static solution in a terminal:
getdp electromagnet -solve MagSta_a_2D -pos Map_a
To compute the time-harmonic dynamic solution in a terminal:
getdp electromagnet -solve MagDyn_a_2D -pos Map_a
To compute the solution interactively from the Gmsh GUI:
File > Open > electromagnet.pro
Run (button at the bottom of the left panel)
------------------------------------------------------------------- */
Include "electromagnet_common.pro";
Group {
// Physical regions
Air = Region[ 101 ]; Core = Region[ 102 ];
Ind = Region[ 103 ]; AirInf = Region[ 111 ];
Surface_ht0 = Region[ 1100 ];
Surface_bn0 = Region[ 1101 ];
Surface_Inf = Region[ 1102 ];
// Abstract regions used in the "Lib_MagStaDyn_av_2D_Cir.pro" template file
// that is included below:
VolCC_Mag = Region[{Air, AirInf}]; // Non-conducting regions
VolC_Mag = Region[{Core}]; // Massive conducting regions
VolS_Mag = Region[{Ind}]; // Stranded conductors, i.e., coils
VolInf_Mag = Region[{AirInf}]; // Annulus for infinite shell transformation
Val_Rint = rInt; Val_Rext = rExt; // Interior and exterior radii of annulus
}
Function {
DefineConstant[
murCore = {100, Name "Model parameters/Mur core"},
Current = {0.01, Name "Model parameters/Current"}
];
mu0 = 4.e-7 * Pi;
nu[ Region[{Air, Ind, AirInf}] ] = 1. / mu0;
nu[ Core ] = 1. / (murCore * mu0);
sigma[ Core ] = 1e6 / 10;
sigma[ Ind ] = 5e7;
Ns[ Ind ] = 1000 ; // number of turns in coil
Sc[ Ind ] = SurfaceArea[] ; // surface (cross section) of coil
// 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;
}
Constraint {
{ Name MagneticVectorPotential_2D;
Case {
{ Region Surface_bn0; Value 0; }
{ Region Surface_Inf; Value 0; }
}
}
{ Name Current_2D;
Case {
// represents the phasor amplitude for a dynamic analysis
{ Region Ind; Value Current; }
}
}
{ Name Voltage_2D;
Case {
{ Region Core; Value 0; }
}
}
}
Include "Lib_MagStaDyn_av_2D_Cir.pro";
PostOperation {
{ Name Map_a; NameOfPostProcessing MagDyn_a_2D;
Operation {
Print[ a, OnElementsOf Vol_Mag, File "a.pos" ];
Print[ b, OnElementsOf Vol_Mag, File "b.pos" ];
}
}
}