magnet.pro (getdp-3.4.0-source.tgz) | : | magnet.pro (getdp-3.5.0-source.tgz) | ||
---|---|---|---|---|
/* | /* | |||
To solve the problem | To solve the problem, either | |||
with scalar potential, type 'getdp test -solve Magnetostatics_phi -pos phi' | ||||
with vector potential, type 'getdp test -solve Magnetostatics_a -pos a' | * open "magnet.pro" with Gmsh and click on "Run"; | |||
* or type "getdp test -solve Magnetostatics_phi -pos phi" on the command line | ||||
to solve the problem using a scalar magnetic potential formulation; | ||||
* or type "getdp test -solve Magnetostatics_a -pos a" to solve the problem | ||||
using a vector potential formulation | ||||
See https://gitlab.onelab.info/doc/tutorials/wikis/home for a step-by-step | ||||
GetDP/Gmsh tutorial. | ||||
*/ | */ | |||
Include "magnet_data.pro"; | Include "magnet_data.pro"; | |||
Include "../templates/Lib_Materials.pro"; | Include "../templates/Lib_Materials.pro"; | |||
Group { | Group { | |||
// AIR, AIR_INF, etc. are variables defined in core.txt, and correspond to the | // AIR, AIR_INF, etc. are variables defined in magnet_data.pro, and correspond | |||
// tags of physical regions in the mesh | // to the tags of physical regions in the mesh | |||
Air = Region[ AIR ]; | Air = Region[ AIR ]; | |||
AirInf = Region[ AIR_INF ]; | AirInf = Region[ AIR_INF ]; | |||
Core = Region[ CORE ]; | Core = Region[ CORE ]; | |||
AirGap = Region[ AIR_GAP ]; | AirGap = Region[ AIR_GAP ]; | |||
Magnet = Region[ MAGNET ]; | Magnet = Region[ MAGNET ]; | |||
Dirichlet_a_0 = Region[ LINE_INF ] ; | Dirichlet_a_0 = Region[ LINE_INF ] ; | |||
Dirichlet_phi_0 = Region[ {LINE_X, LINE_INF} ] ; | Dirichlet_phi_0 = Region[ {LINE_X, LINE_INF} ] ; | |||
// This defines a constant ('Flag_NL') with a default value (0), and a way to | // This defines a constant ('Flag_NL') with a default value (0), and a way to | |||
// change it from outside getdp with ONELAB, using the given parameter name | // change it from outside getdp with ONELAB, using the given parameter name | |||
skipping to change at line 63 | skipping to change at line 72 | |||
mu [ Core ] = SteelGeneric_mu[$1] ; | mu [ Core ] = SteelGeneric_mu[$1] ; | |||
dbdh [ Core ] = SteelGeneric_dbdh[$1]; | dbdh [ Core ] = SteelGeneric_dbdh[$1]; | |||
EndIf | EndIf | |||
DefineConstant[ Hc = {920000, | DefineConstant[ Hc = {920000, | |||
Name "Parameters/Materials/hc", Label "Magnet coercive field (A/m)"} ]; | Name "Parameters/Materials/hc", Label "Magnet coercive field (A/m)"} ]; | |||
hc [ Magnet ] = Rotate[ Vector[Hc, 0, 0.], 0, 0, Pi/2] ; | hc [ Magnet ] = Rotate[ Vector[Hc, 0, 0.], 0, 0, Pi/2] ; | |||
} | } | |||
// These are the Dirichlet boundary conditions on either the magnetic vector | ||||
// potential (a) or magnetic scalar potential (phi) | ||||
Constraint { | Constraint { | |||
{ Name a ; | { Name a ; | |||
Case { | Case { | |||
{ Region Dirichlet_a_0 ; Value 0. ; } | { Region Dirichlet_a_0 ; Value 0. ; } | |||
} | } | |||
} | } | |||
{ Name phi ; | { Name phi ; | |||
Case { | Case { | |||
{ Region Dirichlet_phi_0 ; Value 0. ; } | { Region Dirichlet_phi_0 ; Value 0. ; } | |||
} | } | |||
} | } | |||
} | } | |||
// We include magnetostatic formulation from this template: | ||||
modelPath = CurrentDirectory; | modelPath = CurrentDirectory; | |||
Include "../templates/Lib_Magnetostatics_a_phi.pro" | Include "../templates/Lib_Magnetostatics_a_phi.pro" | |||
// And finally add some post-processing operations: | ||||
eps = 1.e-5; | eps = 1.e-5; | |||
PostOperation { | PostOperation { | |||
{ Name phi ; NameOfPostProcessing Magnetostatics_phi; | { Name phi ; NameOfPostProcessing Magnetostatics_phi; | |||
Operation { | Operation { | |||
Print[ phi, OnElementsOf Vol_Mag, File "phi.pos" ] ; | Print[ phi, OnElementsOf Vol_Mag, File "phi.pos" ] ; | |||
Print[ hc, OnElementsOf Vol_Mag, File "hc.pos" ] ; | Print[ hc, OnElementsOf Vol_Mag, File "hc.pos" ] ; | |||
Print[ b, OnElementsOf Vol_Mag, File "b_phi.pos" ] ; | Print[ b, OnElementsOf Vol_Mag, File "b_phi.pos" ] ; | |||
Print[ b, OnLine {{-0.07,eps,0}{0.09,eps,0}} {500}, File "b_phi.txt", Form at Table ] ; | Print[ b, OnLine {{-0.07,eps,0}{0.09,eps,0}} {500}, File "b_phi.txt", Form at Table ] ; | |||
} | } | |||
} | } | |||
{ Name a ; NameOfPostProcessing Magnetostatics_a; | { Name a ; NameOfPostProcessing Magnetostatics_a; | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 18 lines changed or added |