From 8366d870b8399caf7dce098d800047c02ff06256 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@uliege.be> Date: Tue, 5 May 2020 08:58:06 +0200 Subject: [PATCH] pp --- MagneticForces/magnets.pro | 122 ++++++++++++++++++------------------ Magnetodynamics/transfo.pro | 4 +- 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/MagneticForces/magnets.pro b/MagneticForces/magnets.pro index b1703c2..1ce7561 100644 --- a/MagneticForces/magnets.pro +++ b/MagneticForces/magnets.pro @@ -2,13 +2,13 @@ Tutorial 9 : 3D magnetostatic dual formulations and magnetic forces Features: - - 3D Magnetostatics + - 3D Magnetostatics - Dual vector and scalar magnetic potentials formulations - Boundary condition at infinity with infinite elements - Maxwell stress tensor and rigid-body magnetic forces To compute the solution in a terminal: - First generate the (3D) mesh and then run getdp with the chosen resolution + First generate the (3D) mesh and then run getdp with the chosen resolution gmsh magnets.geo -3 getdp magnets.pro -solve MagSta_a OR @@ -16,67 +16,66 @@ To compute the solution interactively from the Gmsh GUI: File > Open > magnets.pro - Resolution can be chosen from the menu on the left: + 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 tutorial solves the electromagnetic field - and the rigid-body forces acting on a set of magnetic pieces - of either parallelepipedic or cylindrical shape. - Besides position and dimension, each piece is attributed - 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. + This tutorial solves the electromagnetic field and the rigid-body forces acting + on a set of magnetic pieces of either parallelepipedic or cylindrical shape. + Besides position and dimension, each piece is attributed 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[]: - + + 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. - 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. - - 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. - 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: + 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. + + 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. 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}} ] ; - - 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 - 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}" - (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}" - in the one element thick layer "layer~{i}" of finite elements - around "Magnet~{i}", and "f~{i}", is thus indeed the flux of "TM[]" - through the surface of "Magnet~{i}". - - The support of "{-grad un~{i}}" is limited to "layer~{i}", - which is much smaller than "AirBox". - To speed up the computation of forces, a special domain "Vol_Force" - for force integrations is defined, which contains only - the layers "layer~{i}" of all magnets. + + 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 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}" (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}" in the one element thick layer "layer~{i}" of finite elements + around "Magnet~{i}", and "f~{i}", is thus indeed the flux of "TM[]" through the + surface of "Magnet~{i}". + + The support of "{-grad un~{i}}" is limited to "layer~{i}", which is much + smaller than "AirBox". To speed up the computation of forces, a special domain + "Vol_Force" for force integrations is defined, which contains only the layers + "layer~{i}" of all magnets. */ Include "magnets_common.pro" @@ -98,20 +97,20 @@ Group{ Outer = Region[5]; For i In {1:NumMagnets} - Magnet~{i} = Region[ {(10*i)}]; + Magnet~{i} = Region[ {(10*i)}]; SkinMagnet~{i} = Region[ {(10*i+1)} ]; Layer~{i} = Region[AirBox, OnOneSideOf SkinMagnet~{i}] ; EndFor // Abstract Groups (group geometrical regions into formulation relevant groups) - Vol_Inf = Region[ {domInfX, domInfY, domInfZ} ]; + Vol_Inf = Region[ {domInfX, domInfY, domInfZ} ]; Vol_Air = Region[ {AirBox, Vol_Inf} ]; Vol_Magnet = Region[{}]; Sur_Magnet = Region[{}]; Vol_Force = Region[{}]; For i In {1:NumMagnets} - Sur_Magnet += Region[SkinMagnet~{i}]; + Sur_Magnet += Region[SkinMagnet~{i}]; Vol_Magnet += Region[Magnet~{i}]; Vol_Layer += Region[Layer~{i}]; EndFor @@ -152,7 +151,7 @@ Jacobian { { Name Vol ; Case { { Region All ; Jacobian Vol ; } - {Region domInfX; Jacobian VolRectShell {xInt,xExt,1,xCnt,yCnt,zCnt};} + {Region domInfX; Jacobian VolRectShell {xInt,xExt,1,xCnt,yCnt,zCnt};} {Region domInfY; Jacobian VolRectShell {yInt,yExt,2,xCnt,yCnt,zCnt};} {Region domInfZ; Jacobian VolRectShell {zInt,zExt,3,xCnt,yCnt,zCnt};} } @@ -160,7 +159,7 @@ Jacobian { } Integration { - { Name Int ; + { Name Int ; Case { { Type Gauss ; Case { @@ -168,7 +167,7 @@ Integration { { GeoElement Quadrangle ; NumberOfPoints 4 ; } { GeoElement Tetrahedron ; NumberOfPoints 4 ; } { GeoElement Hexahedron ; NumberOfPoints 6 ; } - { GeoElement Prism ; NumberOfPoints 6 ; } + { GeoElement Prism ; NumberOfPoints 6 ; } } } } @@ -212,7 +211,7 @@ FunctionSpace { } { Name Hcurl_a; Type Form1; // magnetic vector potential BasisFunction { - { Name se; NameOfCoef ae; Function BF_Edge; + { Name se; NameOfCoef ae; Function BF_Edge; Support Dom_Hcurl_a ;Entity EdgesOf[ All ]; } } Constraint { @@ -268,7 +267,7 @@ Formulation { In Vol_mu ; Jacobian Vol ; Integration Int ; } Galerkin { [ nu[] * br[] , {d a} ] ; In Vol_Magnet ; Jacobian Vol ; Integration Int ; } - For i In {1:NumMagnets} + For i In {1:NumMagnets} // dummy term to define dofs for fully fixed space Galerkin { [ 0 * Dof{un~{i}} , {un~{i}} ] ; In Vol_Air ; Jacobian Vol ; Integration Int ; } @@ -301,10 +300,10 @@ Resolution { PostProcessing { { Name MagSta_phi ; NameOfFormulation MagSta_phi ; Quantity { - { Name b ; + { Name b ; Value { Local { [ - mu[] * {d phi} ] ; In Dom_Hgrad_phi ; Jacobian Vol ; } Local { [ - mu[] * hc[] ] ; In Vol_Magnet ; Jacobian Vol ; } } } - { Name h ; + { Name h ; Value { Local { [ - {d phi} ] ; In Dom_Hgrad_phi ; Jacobian Vol ; } } } { Name hc ; Value { Local { [ hc[] ] ; In Vol_Magnet ; Jacobian Vol ; } } } { Name phi ; Value { Local { [ {phi} ] ; In Dom_Hgrad_phi ; Jacobian Vol ; } } } @@ -380,8 +379,7 @@ PostOperation { SendToServer Sprintf("Output/Magnet %g/Y force [N]", i), Color "Ivory" ]; Print[ fz~{i}[Vol_Air], OnGlobal, Format Table, File > "Fz.dat", SendToServer Sprintf("Output/Magnet %g/Z force [N]", i), Color "Ivory" ]; - EndFor + EndFor } } } - diff --git a/Magnetodynamics/transfo.pro b/Magnetodynamics/transfo.pro index 4e162b0..86192e6 100644 --- a/Magnetodynamics/transfo.pro +++ b/Magnetodynamics/transfo.pro @@ -95,6 +95,8 @@ Function { // secondary. Flag_CircuitCoupling = 1; +Flag_FrequencyDomain = 0; + // Note that the voltage will not be equally distributed in the PLUS and MINUS // parts, which is the reason why we must apply the total voltage through a // circuit -- and we cannot simply use a current source like in Tutorial 7a. @@ -128,7 +130,7 @@ Function { // High value for an open-circuit test; Low value for a short-circuit test; // any value in-between for any charge - Resistance[R_out] = 1e6; + Resistance[R_out] = 10; // End-winding primary winding resistance for more realistic primary coil // model -- GitLab