The electric and magnetic macros can be grouped into four categories:
The RACE, PERBC2D, and EMTGEN macros are available as modeling aids.
RACE generates a racetrack shaped current source from bar and arc primitives (SOURC36 elements). To invoke this macro, use one of the following:
The RACE macro requires parameters as noted in Figure 10.1: Racetrack Current Source. The racetrack is located by two parameters XC and YC;
these are the distances to the midpoints of the coil thickness along the X and Y
axes of the working plane, respectively. As input to the RACE
macro, you can assign a component name, Cname, to the
group of SOURC36 elements. Cname
must be enclosed in single quotes in the RACE command
line.
PERBC2D generates periodic boundary conditions by writing constraint equations or assigning node coupling necessary for two periodic symmetry planes. Use this method only for harmonic or transient magnetic analyses. For static analyses, use MAPDL cyclic symmetry capability. Invoke the macro as follows:
The diagrams below illustrate the form for three options:
The odd symmetry option represents a half-period symmetry condition for a device. The even symmetry condition represents a full period condition (repeating structure).
EMTGEN generates a distributed set of TRANS126 elements between the surface of a moving structure and a plane (i.e. ground plane). This arrangement allows for fully coupled electrostatic-structural simulations for cases where the gap is small compared to the overall area of the structure. Invoke the macro as follows:
The MAGSOLV and CMATRIX macros are available as solution aids.
10.1.2.1. MAGSOLV
MAGSOLV allows you to specify solution options quickly and initiate the solution for most magnetostatic analyses. It applies to 2D and 3D models, scalar, vector, and edge formulations, and linear and nonlinear analyses. The macro eliminates the need to use the MAGOPT command and step through a two-step or three-step solution sequence required for certain situations. It also allows you to specify convergence criteria for nonlinear analyses, and gives you an option to force recalculation of the Biot-Savart integration from current sources.
To invoke the MAGSOLV macro, use one of the following:
10.1.2.2. CMATRIX
CMATRIX allows you to calculate "ground" and "lumped" capacitance matrices. The "ground" capacitance values relate the charge of one conductor with the conductor's voltage drop (to ground). The "lumped" capacitance values relate the capacitance's between conductors. For more details and an example problem, see Extracting Capacitance from Multi-conductor Systems and Example: Capacitance Calculation of this manual, respectively. See the Mechanical APDL Theory Reference for more details.
To invoke the CMATRIX macro, use one of the following:
MMF calculates the magnetomotive force, the line integral of magnetic field, H, along a predefined path (defined with the PATH and PPATH command). A counterclockwise ordering of nodes will give the correct sign on the MMF. The MMF macro sets the "ACCURATE" mapping method and "MAT" discontinuity option of the PMAP command. The program retains these settings for PMAP after issuing the macro. If the path spans multiple materials, include at least 1 path point in each material (See Figure 10.5: MMF Paths (b)).
To invoke the MMF macro, use either of the following:
EMF calculates the electromotive force (emf), the line integral of electric field, E, or voltage drop along a path (defined using the PATH command or its GUI counterpart). It can operate in both 2D and 3D electric and electrostatic field analysis. The parameter EMF stores the calculated emf value.
Before invoking EMF, you must first define a path. The macro uses calculated values of the electric field (EF), and uses path operations to perform the calculations. All path items are cleared when the macro completes.
The EMF macro sets the "ACCURATE" mapping method and "MAT" discontinuity option of the PMAP command. The program retains these settings for PMAP after issuing the macro.
To invoke the EMF macro, use either of the following:
POWERH calculates the time-averaged power loss in a conducting body from a harmonic analysis. You must select the elements of the conducting region before invoking the macro. POWERH is most accurate when fine meshes are available in the conducting regions. To invoke the macro, use one of the following:
FLUXV calculates the flux passing through a predefined line contour. In a 2D analysis, at least two nodes must define the path. In a 3D MVP analysis, the path must be a closed contour; that is, the first and last nodes must be the same. A counterclockwise ordering of nodes on the path will yield the correct sign on flux. Figure 10.6: Flux Calculations illustrates the path selection, when invoking FLUXV for both 2D and 3D analysis. The macro is valid only with the magnetic vector potential formulation.
To invoke the FLUXV macro, use one of the following:
| (a) 2D path definition:
|
| (b) 3D contour definitions:
|
PLF2D generates a display of equipotential lines with the degree of freedom AZ. In an axisymmetric analysis, the display consists of constant values of radius * AZ. Use this macro for 2D analysis only. These equipotential lines are parallel to flux lines and provide a good representation of magnetic flux patterns.
To invoke PLF2D, use one of the following:
SENERGY calculates the stored magnetic energy or co-energy in the model. The energy calculation is summarized in a table by material number, and the energy density is stored in the element table for displaying and listing.
Figure 10.7: Energy and Co-energy for Nonpermanent Magnets illustrates how the magnetic energy and co-energy are determined for nonpermanent magnets. The energy at a point on the curve is the area above the curve bounded by the value of B at that point, and the co-energy is the area under the curve at that point.
For a permanent magnet, energy and co-energy for a point on the curve are calculated as follows:
The energy is the area to the right of the curve in the positive B region (see graph (a) in Figure 10.8: Energy and Co-energy for Permanent Magnets). Note that the energy is negative for the shown case.
The co-energy is the area under the curve (see graph (b) in Figure 10.8: Energy and Co-energy for Permanent Magnets).
The energy and co-energy of a linear permanent magnet are show in graph (c) in Figure 10.8: Energy and Co-energy for Permanent Magnets.
SENERGY determines the energy and co-energy using the following B-H relationships:
where B1-H1 is a soft magnetic characteristic of the material and Hc is the coercive force.
For a linear soft magnetic material, the B1-H1 relationship is given by:
where µo is the free-space permeability and µr is the relative permeability specified by the MP command and the MURX, MURY, and MURZ labels.
For a nonlinear soft magnetic material, you input a B1-H1 curve using the TB command with the BH label. You then enter the data points using the TBPT or TBDATA command. The curve must start at the origin and increase monotonically. For the energy calculations, the curve is approximated with a spline fit up to the last data point. Beyond the last data point, it is extrapolated as a straight line with a slope equal to the free-space permeability.
To invoke SENERGY, use one of the following:
EMAGERR calculates the relative error in the computed field quantities (B, H) for each element in a model. The error represents the average difference in the element computed field value and a continuous field value. The continuous field is represented by the average nodal field values. Optionally, you can normalize the error value with respect to the highest computed nodal-averaged field value per material. The error measure considers material discontinuities when calculating the average nodal continuous field values.
To invoke EMAGERR, use either of the following:
CURR2D calculates the total current flowing in a conducting body for 2D models. The current may be from an applied source current, or induced eddy current. This macro is useful for checking total current flow.
To invoke CURR2D, use either of the following:
EMFT summarizes in tabular form the resulting electromagnetic forces and torques on a set of selected nodes. This command is applicable only to PLANE121, SOLID122, and SOLID123 elements.
To invoke EMFT, use either of the following:
PMGTRAN calculates and summarizes electromagnetic field data on element components for a transient analysis. Calculations may include magnetic forces, power loss, stored energy, or total current. The SENERGY macro calculates stored energy, and the CURR2D macro calculates total current.
To invoke PMGTRAN, use either of the following:
The data is summarized in a report as well as written to a file.




