From 71b88eacb9f9140a3ef0aa7b035c680f5716b909 Mon Sep 17 00:00:00 2001 From: Ruth Sabariego <ruth.sabariego@kuleuven.be> Date: Mon, 25 Jun 2018 16:21:26 +0200 Subject: [PATCH] Update magnets.pro --- MagneticForces/magnets.pro | 71 ++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/MagneticForces/magnets.pro b/MagneticForces/magnets.pro index 7e73f2d..b1703c2 100644 --- a/MagneticForces/magnets.pro +++ b/MagneticForces/magnets.pro @@ -8,35 +8,39 @@ - Maxwell stress tensor and rigid-body magnetic forces To compute the solution in a terminal: - getdp magnets.pro + First generate the (3D) mesh and then run getdp with the chosen resolution + gmsh magnets.geo -3 + getdp magnets.pro -solve MagSta_a + OR + getdp magnets.pro -solve MagSta_phi To compute the solution interactively from the Gmsh GUI: File > Open > magnets.pro + Resolution can be chosen from the menu on the left: + MagSta_a (default) or MagSta_phi Run (button at the bottom of the left panel) ------------------------------------------------------------------- */ /* - This rather didactic tutorial solves the electromagnetic field + This tutorial solves the electromagnetic field and the rigid-body forces acting on a set of magnetic pieces - of parallelepipedic or cylindrical shape. + of either parallelepipedic or cylindrical shape. Besides position and dimension, each piece is attributed - a (constant) magnetic permability and/or a remanence field. - The pieces are all (a bit abusively) generically called "Magnet" - in the problem decription below, irresective of whether they are - truly permanent magnets or ferromagnetic barrels. - - The tutorial model proposes both dual 3D magnetostatic formulations: - the magnetic vector potential formulation with spanning-tree gauging, - and the scalar magnetic potential formulation. - The later is rather simple in this case since, as there are no conductors, - the known coercive field hc[] is the only source field "hs" one needs - to represent the magnetic field: - + a (constant) magnetic permeability and/or a remanence field. + Hereafter, the pieces are all, simply though imprecisely, referred to as "Magnet", + irresective of whether they are truly permanent magnets or ferromagnetic barrels. + + The tutorial model proposes two dual 3D magnetostatic formulations: + - the magnetic vector potential formulation with spanning-tree gauging; + - the scalar magnetic potential formulation. + As there are no conductors, the later is rather simple. The source field "hs" is + directly the the known coercive field hc[]: + h = hs - grad phi , hs = -hc. - As in tutorial 2 (magnetostatic field of an electromagnet), a shell - of so-called infinite elements is used here to impose the exact - zero-field boundary condition at infinity. + If the "Add infinite box" box is ticked, a transformation to infinity shell is + used to impose the exact zero-field boundary condition at infinity. + See also Tutorial 2: magnetostatic field of an electromagnet. The shell is generated automatically by including "InfiniteBox.geo" at the end of the geometrical description of the model. It can be placed rather close of the magnets without loss of accuracy. @@ -44,24 +48,23 @@ The preferred way to compute electromagnetic forces in GetDP is as an explicit by-product of the Maxwell stress tensor "TM[{b}]", which is a material dependent function of the magnetic induction "b" field. - Exactly like we computed the heat flux "q(S)" through a surface "S" - using a special auxiliary function "g(S)" associated with that surface - in "Tutorial 5 : thermal problem with contact resistances", - the magnetic force acting on a rigid body in empty space can be evaluated - as the flux of the Maxwell stress tensor through that surface. - There is one auxiliary function "g(SkinMagnet~{i}) = un~{i}" - for each magnet, and the resultant magnetic force acting on "Magnet~{i}" - is given by the integral: + The magnetic force acting on a rigid body in empty space can be evaluated + as the flux of the Maxwell stress tensor through a surface "S" (surrounding the body). + A special auxiliary function "g(S)" linked "S" is defined for each magnet, i.e. + "g(SkinMagnet~{i}) = un~{i}". + The resultant magnetic force acting on "Magnet~{i}" is given by the integral: f~{i} = Integral [ TM[{b}] * {-grad un~{i}} ] ; - - It should be insisted on the fact that the Maxwell stress tensor - is always discontinuous on material discontinuities, + + This approach is analogous to the computation of heat flux "q(S)" through a + surface "S" described in "Tutorial 5: thermal problem with contact resistances". + + Note that the Maxwell stress tensor is always discontinuous on material discontinuities, and that magnetic forces acting on rigid bodies - only depend on the Maxwell stress tensor of empty space, + depend only on the Maxwell stress tensor in empty space, and on the "b" and "h" field distribution, on the external side of "SkinMagnet~{i}" - (the side of the surface in contact with air). + (side of the surface in contact with air). "{-grad un~{i}}" in the above formula can be regarded as the normal vector to "SkinMagnet~{i}" @@ -79,7 +82,7 @@ Include "magnets_common.pro" DefineConstant[ - // preset all getdp options and make them invisible + // preset all getdp options and make them (in)visible R_ = {"MagSta_a", Name "GetDP/1ResolutionChoices", Visible 1, Choices {"MagSta_a", "MagSta_phi"}}, C_ = {"-solve -v 5 -v2 -bin", Name "GetDP/9ComputeCommand", Visible 0} @@ -198,7 +201,7 @@ Constraint { } FunctionSpace { - { Name Hgrad_phi ; Type Form0 ; // scalar magnetic potential + { Name Hgrad_phi ; Type Form0 ; // magnetic scalar potential BasisFunction { { Name sn ; NameOfCoef phin ; Function BF_Node ; Support Dom_Hgrad_phi ; Entity NodesOf[ All ] ; } @@ -207,7 +210,7 @@ FunctionSpace { { NameOfCoef phin ; EntityType NodesOf ; NameOfConstraint phi ; } } } - { Name Hcurl_a; Type Form1; // vector magnetic potential + { Name Hcurl_a; Type Form1; // magnetic vector potential BasisFunction { { Name se; NameOfCoef ae; Function BF_Edge; Support Dom_Hcurl_a ;Entity EdgesOf[ All ]; } -- GitLab