Using FEMM software tool

Electric Drive Laboratory May 10, 2006

Introduction
Rules for the use of FEMM (Finite Element Method Magnetics) in the analysis of the electrical machines. The elements of the problem can be divided in: Drawing points segments arcs Mark labels groups Properties materials boundary conditions circuits Operations pre–processing mesh solution post–processing

1

due to the magnetic pressure on its surface. 1. 2 . as shown in Fig.Nicola Bianchi Using FEMM Part I Simple examples 1 A first example: the electromagnetic actuator Let us consider the electromagnetic actuator of Fig. 2. Units: the unity is millimeter. When the coil carries current.2 Drawing At first all the points of the structure are drawn. Neglecting the end effects. 1.1 Problem setting The first step is to define the problem: Type: the symmetry is planar. Lstk =1 m. that is. Then an unitary length is assumed. This is that all the magnetic fields are repeated equal for each section of the electromagnetic actuator. and an iron plate. It includes a fixed iron yoke around which a coil is wound. Frequency: since this is a magneto–static problem. The points can be chosen by using the mouse (in this case it is suggested to use the snap to the grid) or by using the keyboard (press TAB and insert the point coordinates). the iron yoke attracts the iron plate. the frequency is set to be zero. Figure 1: Sketch of the electromagnetic actuator 1. the simulation is carried out by assuming a planar symmetry. Depth: a unity length is selected (this corresponds to 1000 mm).

so that they are connected together. 1.3 Boundary conditions In a field problem. These conditions are called boundary conditions. they have to be connected by segments. 2.Nicola Bianchi Using FEMM Figure 2: Points of the drawing After drawing the points. 3 shows the segments that connect the points of Fig. Figure 3: Segments of the drawing At this point the drawing of the structure is completed. they are imposed along the segments of the border. In a two–dimensional problem. Fig. the the magnetic fields are required to satisfy suitable conditions on the boundary of the domain. There are four main boundary conditions: Dirichlet: this condition prescribes a given value of the magnetic vector potential Az 3 . Select two points at a time by the left bottom of the mouse.

the segments of the box are selected. i. This means that it is automatically satisfied. Anti–periodic: this condition is assigned to two segments and imposes that the magnetic vector potential behavior is the one opposite to the other along the two segments. suitably defined for this analysis. reducing the domain as minimum as possible. Az. if other conditions are not assigned. Thus. 4 shows the label of the electromagnetic actuator. A label is defined for each object.e. using the right bottom of the mouse. It is better to refine the parts of the problem. Iron and Copper.e. Each object will be subdivided in small elements (the finite element). This condition is used to confine the field lines into the domain. Periodic: this condition is assigned to two segments and imposes that the magnetic vector potential behavior is the same along the two segments. in which the higher field gradients are expected. which are triangles in FEMM. This process is commonly called ”to create the mesh”. 1. that is. They can be new materials.4 Materials The material of the objects that form the structure have to be defined. or they can be selected from a given Material Library. Az. the appropriate material is assigned to the object: Iron is assigned to the two magnetic pieces. This includes the commonly used materials. The choice of the mesh size depends on the problem to be analyzed. 5 shows the final mesh of the electromagnetic actuator. A boundary condition Az = 0 is defined in the problem. Copper is assigned to the two coil sides. 2.segment1 = Az. Then. 4 . it will be assigned that no flux lines can cross this boundary: 1.Nicola Bianchi Using FEMM along a segment. the flux lines results tangential to this segment. The external lines. The boundary condition is assigned. It is worth noticing that the boundary conditions are defined to confine the field analysis to a given region. It is possible to force the maximum mesh size in each object. Fig. The mesh size refers to the area of the triangle used for this subdivision.segment2 . Neumann: this condition imposed the flux density lines to be normal to the selected segment. In the example. Fig. the materials that are used are Air.segment1 = −Az. In this specific problem. This condition is a natural condition.segment2 .5 Mesh The subdivision of the structure in finite elements is automatic. and Air is assigned to the remanent space. i. 3. 1.

6. or circuits. whose value has to be –100 A. for instance equal to 100 A. 5 . they are assigned to the two coils of the structure. as shown in Fig. we define two circuits: CurrentPos: the positive current. After their definition. In our example. CurrentNeg: the negative current.6 Current sources The current is imposed in the coil sides by defining two current sources.Nicola Bianchi Using FEMM Figure 4: Labels of the drawing Figure 5: Mesh of the structure 1.

In this example. e.7 Groups A group of objects can be defined to belong to the same group. This gives an indication of the range of flux density values reached in the structure.Nicola Bianchi Using FEMM Figure 6: External circuits connected to the coil sides 1. A series of instructions can be written in a unique file (the LUA file) and they are executed consecutively when the file is read within a FEMM editor or viewer. The group definition is useful when the automatic analysis is adopted. 1. defined by an identification number. The problem is analyzed. Some examples are given in the following. the working frequency. in which one or two parameters are changed.g. A further visual analysis refers to the flux density map. 7. Further informations and documen- 6 . This plot give us a rapid idea if the problem has been correctly set. This kind of programming is useful when several simulations have to be carried out searching the dependence of the machine performance on one parameter. 2 Use of the LUA script The purpose of the LUA file is to automatize a series of computations using the FEMM code. 8. or the geometrical position. Then the results can be At first the flux lines are plotted as shown in Fig. we define the upper coil side as group 1001. as will be shown when the script files are dealt with. shown in Fig. the lower coil side as group 1002 and the moving keeper as group 10.8 Plot Once all the steps above have been completed. the problem is ready to be solved. The group can also contain one object only. Often a FOR loop is implemented. the operating currents.

(mm2) -.1 Scripts for the Pre–processing An example is given to modify the current of the circuits. At first we could need to compute the maximum current from the geometrical data S_coil k_fill J_max I_max = = = = 600 0. 2.Nicola Bianchi Using FEMM Figure 7: Flux lines of the solved structure Figure 8: Flux density map of the solved structure tation can be found in the chapter ”LUA Scripting Documentation” of the ”FEMM User’s Manual” (Press key Help topics in the menu Help of the application.4 6 S_coil * J_max -.(A/mm2) 7 .

and 4. This allows the original project to remain unchanged. 1. the correspond circuits have to be modified. 1. The instructions that have to be used are modifycircprop("CurrentPos". the original file is not modified. with the modifications implemented.Nicola Bianchi Using FEMM \begin{verbatim} % where the text following \verb"--" is a comment.fem” to save in the temporary file ”tempfile. In this way. The LUA code becomes openfemmfile("electromagnet. which becomes a copy of the original project but with the modifications.fem") modifycircprop("CurrentPos".fem ") analyse() A copy of the original project ”electromagnet. Then a series of analysis at various currents can be implemented as follows. 2. to modify as required. to analyze the temporary FEMM file. 1.fem”. to open an original FEMM file. I_coil) modifycircprop("CurrentPos".1) / N_sim Once the value of the current is computed. I_coil) modifycircprop("CurrentPos". 1 do I_coil = I_max * (n . 3. The command analyse() start the finite element computation. 1. -I_coil) It is also convenient to operate as follows: 1. -I_coil) savefemmfile("tempfile. Ten simulations are considered with linear variation of the current: \begin{verbatim} N_sim = 10 for n = 1. 8 . (N_sim + 1). to save in a temporary FEMM file.

-I_coil) savefemmfile("tempfile.(mm2) k_fill = 0. Then the complete ”preprocess.3 Post–processing The post–processing file contains the instructions that have to executed after the field problem has been solved. At first. closefile(handle).lua") end 2. the value of the current of the coil) in the ”temp. 1. closefile(handle). This procedure will be described in the following subsection.lua” becomes S_coil = 600 -.1) / N_sim openfemmfile("electromagnet.fem") modifycircprop("CurrentPos". "w").lua” will be executed.(A/mm2) I_max = S_coil * J_max N_sim = 10 for n = 1. e.txt".txt” file is handle = openfile("temp. the z–axis length and the number of turns of the coil: 9 .4 J_max = 6 -. 1. Then the last command within the FOR loop of the pre–processing file is the call to the post–process LUA file. 1 do I_coil = I_max * (n . This can be accomplished by write the information in a text file that will be read when the post–processing will run. An example of writing (e.fem ") analyse() handle = openfile("temp. "w"). runpost("postprocess. "\n"). "\n"). I_coil.2 From Pre– to Post–processing Sometimes there is the needs to transfer one or more data from the pre–processing to the post–processing. I_coil. it is necessary that the solved problem is processed. It is called as follows runpost("postprocess. the value of some parameters are assigned. (N_sim + 1). I_coil) modifycircprop("CurrentPos".lua") All the command that have written in the file ”postprocess.g. Finally. once the problem is analyzed.Nicola Bianchi Using FEMM 2. for instance when it is included within an analysis loop.g.txt". This file can be called separately or can be launched by the pre–processing. write (handle. write (handle.

100 -. group) or a set of elements is selected. "r"). an operation is executed referring to this element or this set of elements. the line on the top of the moving keeper is selected by means of the two extremes of the line. the flux linkage with the coil is computed. Each operation is divided in two steps: 1. closefile(handle). at first. and the force components are achieved from the Maxwell stress tensor: groupselectblock(10) F_cx = blockintegral(18) F_cy = blockintegral(19) F_px = blockintegral(20) F_py = blockintegral(21) In the following example. Some examples are reported hereafter. Then. while Fpx and Fpy are the pulsating force components along the x and y directions respectively. and the flux linkage is computed from their difference. The two coils can be selected by means their group number (1001 and 1002 for the upper and the lower coil side respectively). Fcx and Fcy are the constant component of the force along the x and y directions respectively. The same conventions used in the pre– processing have to be of course used. the moving iron keeper could be selected by means of its group number 10. -10) selectpoint( 60. "*n"). 10 .length (m) L_z = 0. an element (line.Nicola Bianchi Using FEMM -. The coil side surface is firstly computed. Then the magnetic potential is integrated over the two surfaces. seteditmode(contour) selectpoint(-60. In the following example. handle = openfile("temp. object. F_cy.number of turns N_t = 80 The first operation of the post–process is to read the data written in the temporary file during the pre–processing. The latter components are equal to zero in magneto–static problems. 2.txt". some operations are executed. I_coil = read (handle. F_px. F_py = lineintegral(3) Alternatively. -10) F_cx. Then the computation of the force along the line is required.

" ". " ". I_coil. the results have to be stored into a file. Energy. intg_Aim_2 = blockintegral(1) clearblock() -. " ". Then. "a") write(handle.txt". 11 . flux_im_1. flux_im_2. AJ_intgr. " ". magnetic energy density. intg_Aim_1 = blockintegral(1) clearblock() groupselectblock(1002) intg_Are_2.surface groupselectblock(1001) Sup = blockintegral(5) clearblock() -. spaced by some blank spaces.txt” is open to append (note the command ”a”) the results of the computation. handle = openfile("results. " ". flux_re_2.integral of Az groupselectblock(1001) intg_Are_1. followed by a line end command (”\n”). No number is specified in the command groupselectblock() so as all blocks are selected. In the example hereafter the values are written on the same row.flux linkage flux_re_1 = (intg_Are_1 / Sup) * L_z * N_t flux_im_1 = (intg_Aim_1 / Sup) * L_z * N_t flux_re_2 = (intg_Are_2 / Sup) * L_z * N_t flux_im_2 = (intg_Aim_2 / Sup) * L_z * N_t In order to compute the magnetic energy all the elements of the domain are selected. " ". " ". F_cx. magnetic coenergy density and the product A · J are integrated. F_cy. Coenergy.Nicola Bianchi Using FEMM -. " ". groupselectblock() Energy = blockintegral(2) Coenergy = blockintegral(17) AJ_intgr = blockintegral(0) Once the computation is finished. flux_re_1. " ". The file ”results.

"a"). write(handle.txt". (a) Pre–processor (b) Post–processor Figure 9: Actuator The pre–processing is PRE_ATT. 3.Nicola Bianchi Using FEMM "\n") closefile(handle) At last. jm. the pre– and post–processing files are reported in the following. 12 . " ").LUA -.Current density is defined jm=3 handle = openfile("result. the view editor is closed: exitpost() 3 A second example: a cylindrical actuator According to the cylindrical actuator shown in Fig.

"a").unselection clearcontour() -.post-processing end exitpost() 13 .-0. dz.5) selectpoint(3.fem") -.The changed structure is save in a temporary file save_femm_file("temp. write(handle.LUA -.Nicola Bianchi Using FEMM closefile(handle) -. B_avg = lineintegral(1) -.dz is the variation with respect to the initial position for dz = 0. " ".6. "a"). dz) -.The actuator structure is loaded open_femm_file("actuator. 4. write(handle. " ").(1) hide window -.Post-processing runpost("post_att.lua". "\n") closefile(handle) -.5) Flux.-0.(0) show window -.fem") -.Its value is stored in the result file handle = openfile("result.10. closefile(handle) -.Loop of simulations varying the air--gap thickness -.Solving the problem analyse(1) -.Data storage handle = openfile("result.2 do -.Mover (group=1) is selected and moved selectgroup(1) move_translate(0.txt".selection of the line to integrate the flux density seteditmode(contour) selectpoint(0. "-windowhide") end The post–processing is POST_ATT. B_avg.The current density is assigned to the coil modifymaterial("Copper".txt".10. jm) -. Flux.

π/2]. 1] Inverse cosine of x [0. These names can be obtained by link the common root CoilSide2 with an index that assumes the numerical value 1 and 2.. index 14 . y) sqrt(x) ceil(x) f loor(x) abs(x) 4. with x¿0 Common (base 10) logarithm of x.Nicola Bianchi Using FEMM 4 4. x [−1. The link is achieved as "CoilSide" . For instance. number3} The values of the vector are gained by using the squared brackets: number1 = Vector[1] number2 = Vector[2] number3 = Vector[3] 4. y) sinh(x) cosh(x) tanh(x) esp(x) log(x) log10 (x) pow(x. number2. For example. x [−1.1 Mathematic functions sin(x) cos(x) tan(x) asin(x) acos(x) atan(x) atan2(x. with x¿0 Power xy √ Square root x Round towards plus infinity of x Round towards minus infinity of x Absolute value of x When a vector of numbers has to be defined.3 Indexed variables Sometimes it is needed to adopt some variables whose name has a common root followed by a varying number. π]. π] Hyperbolic sine of x Hyperbolic cosine of x Hyperbolic tangent of x Exponential ex Natural logarithm of x. π/2] Inverse tangent of x/y [−π. a vector of three number is Vector = {number1. CoilSide1 and CoilSide2 that are used in the first example. 1] Inverse tangent of x [−π/2. we can use the curly brackets.2 Vectors Useful functions Sine of x Cosine of x Tangent of x Inverse sine of x [−π/2.

15 . Nicola Bianchi. the big work of PhD. Fax: +39 049 827 7599. Diego Bon and Eng. Fabio Luise. Via Gradenigo 6 A Padova. Phone: +39 049 827 7500. email: [bianchi] [bolognani] @die. Eng.it. Contacts Prof. University of Padova. Electric Drive Laboratory. University of Padova. Giorgio Grezzani. Eng. Silverio Bolognani.Nicola Bianchi Using FEMM Acknowledgment This report has been possible thanks to contribution of many students and PhD students of the Electric Drive Laboratory of the Department of Electrical Engineering. PhD. In particular. Eng.unipd. Prof. Italy. Italy. Department of Electrical Engineering. Michele Dai Pr` is acknowle edged.

Sign up to vote on this title
UsefulNot useful