## Computational Electromagnetics Modeling, Which Module to Use?

##### Walter Frei | September 10, 2013

A question we get asked all of the time is: “Which of the COMSOL products should be used for modeling a particular electromagnetic device or application?” There are currently six modules labeled as “Electrical” in the product suite; the AC/DC Module, RF Module, Wave Optics Module, MEMS Module, Plasma Module, and Semiconductor Module. The first four address applications purely governed by various forms of Maxwell’s equations, while the Plasma Module addresses the coupling of electromagnetic fields to plasma transport and chemistry, and the Semiconductor Module solves the drift-diffusion equations for electrons and holes. If you are interested in solving Maxwell’s equations alone, then any one (or several) of the first four modules, or even the core package alone, will be of use to you. Here, I will help you choose which module to use for your particular computational electromagnetics modeling projects, and point out some example models along the way.

### Computational Electromagnetics: Maxwell’s Equations

Maxwell’s equations relate the electric charge density, \rho; electric field, \mathbf{E}; electric displacement field, \mathbf{D}; and current, \mathbf{J}; as well as the magnetic field intensity, \mathbf{H}, and the magnetic flux density, \mathbf{B}:

\nabla \cdot \mathbf{D} = \rho %26 \nabla \times \mathbf{E} =-\partial_t \mathbf{B} \\

\mathbf{\nabla \cdot B} = 0 %26 \nabla \times \mathbf{H} = \mathbf{J} + \partial_t \mathbf{D} \end{array}

To solve these equations we need a set of boundary conditions, as well as material constitutive relations that relate the \mathbf{E} to the \mathbf{D} field, the \mathbf{J} to the \mathbf{E} field, and the \mathbf{B} to the \mathbf{H} field. Under varying assumptions, these equations are solved in the different modules within the COMSOL product suite. *(Note: Most of the equations presented here are shown in an abbreviated form to convey the key concepts. To see the full form of all governing equations, and to see all of the various constitutive relationships available, please consult the Product Documentation.)*

### Steady-State Electric Field Modeling with the COMSOL Multiphysics Core Package

The core package, COMSOL Multiphysics, will solve Maxwell’s equations under the assumption of steady-state conditions in either conductive or insulative media. It will solve for either the flow of current, or the electrostatic fields. The form of Maxwell’s equations that is solved under the assumption that we are only interested in the steady-state electric currents is:

This equation is solved for the voltage field, V, which is used to compute the electric field, \mathbf{E} =- \nabla V, and the current, \mathbf{J} = \sigma \mathbf{E}, where \sigma is the material conductivity. This *Stationary Electric Currents* interface, available in COMSOL Multiphysics, is appropriate for computing the steady-state current flow through conductive devices, as shown in the Pacemaker Electrode model.

Under the assumption that we are interested in the electric fields in perfectly insulating media with material permittivity \epsilon, Maxwell’s equations can be re-written as:

This *Electrostatic* interface is also available in COMSOL Multiphysics, and it’s appropriate for computing the electrostatic fields around devices, such as capacitors.

### Time and Frequency Domain Electric Field Modeling with the AC/DC or MEMS Modules

As soon as you want to model time-varying electric fields, you will want to look beyond the core package.

If you can assume that the magnetic fields and magnetically-induced currents are negligible, you can use the transient electric currents form:

This transient equation solves for both conduction currents, \mathbf{J}_c = \sigma \mathbf{E}, and displacement currents, \mathbf{J}_d = \epsilon \partial_t \mathbf{E}. This is appropriate to use when the source signals are non-harmonic and you wish to monitor system response over time. You can see an example of this in the Transient Modeling of a Capacitor in a Circuit model.

On the other hand, if you are working with sources that vary sinusoidally with frequency \omega, as demonstrated in the Frequency Domain Modeling of a Capacitor model, the above equation can be re-written as:

This stationary equation solves for the voltage field in the frequency domain, and the displacement currents become: \mathbf{J}_d = j \omega \epsilon \mathbf{E}.

The above two equations are the ** Time Dependent** and

**forms of the**

*Frequency Domain**Electric Currents*interface, and are available in both the AC/DC and MEMS modules. These add-on products also offer additional boundary conditions for modeling sources, periodicity, and surfaces of constant potential, as well as modeling thin layers of material that are highly conductive, highly resistive, strong dielectrics, or relatively weak dielectrics that can also be used for stationary models. The MEMS Module also offers interfaces for electrostatic actuation and piezoelectric material modeling.

### Steady-State Magnetic and Electric Field Modeling with the AC/DC Module

If you wish to model steady-state magnetic fields, you will want to use the AC/DC Module.

For models that have no current flowing anywhere, the *Magnetic Fields, No Currents* interface solves for a magnetic scalar potential, V_m:

Where \mu is the material permeability and \mathbf{B} =-\mu \nabla V_m. This form is appropriate if you are computing magnetic fields and flux lines around magnets and magnetically permeable materials. An example of this is seen in the Magnetic Field from a Permanent Magnet model.

On the other hand, if you wish to compute magnetic fields due to current flow, then the *Magnetic Fields* or *Magnetic and Electric Fields* interface is appropriate. These interfaces solve for the magnetic vector potential, \bf{A}:

The magnetic vector potential can be used to compute \mathbf{B}=\nabla \times \mathbf{A}. The source current, \mathbf{J}_s, can either be imposed or computed by simultaneously solving the electric currents equation described earlier.

### Frequency Domain Electromagnetic Field Modeling with the AC/DC, RF, or Wave Optics Modules

If you are modeling at a known frequency, where both the electric fields and the magnetic fields are significant, or induced currents are present, you will need to consider either the AC/DC Module, RF Module, or Wave Optics Module. The AC/DC Module offers a ** Frequency Domain** form of the

*Magnetic Fields*interface:

This solves for the magnetic fields, the electric fields \mathbf{E} = j \omega \mathbf{A}, as well as the induced currents, \mathbf{J}_i = \sigma \mathbf{E}.

The above equation is quite similar to the *Electromagnetic Waves, Frequency Domain* interface offered in both the RF and the Wave Optics modules, shown below:

There are, however, some significant practical differences between these two.

The ** Electromagnetic Waves, Frequency Domain** form assumes that the resultant fields will be “wave-like” — that the power transfer will occur primarily via radiation. This allows us to implement features such as the Scattering Boundary Condition and Perfectly Matched Layers, which are used to model boundaries to free space. This formulation can capture both near-field and far-field effects around antennas, resonant coils, waveguides, and scatterers. Additional boundary conditions such as Rectangular, Coaxial, and Circular Ports can model a junction to a microwave waveguide structure, and Numeric Ports can be used for modeling dielectric waveguides. The solvers are also tuned to deal with equations that are of this form. The RF Module and Wave Optics Module can also reformulate this equation as an

*Eigenfrequency*problem, if you are interested in finding the resonant frequencies of a device.

The frequency domain ** Magnetic Fields** form and its set of boundary and domain conditions on the other hand, is more adopted to when the fields are “quasi-static” — that is, when the solution will look similar to the static solution, but have some contribution due to the time-varying fields. This formulation can capture near-field effects, such as induced currents in metal objects near current-carrying coils or mutual inductance between coils. The electric and magnetic fields around the object being modeled are assumed to fall off exponentially with distance. This admits features such as Infinite Elements, which are useful for truncating modeling domains. The boundary conditions such as voltage and current excitations are more characteristic of low-frequency applications. The solvers in the AC/DC Module are also tuned for such equations.

#### AC/DC, RF, or Wave Optics?

There are a couple of helpful concepts here that will help you decide which module to use. First, find the *electrical size* of the object you are modeling. Consider the maximum dimension of the object you are analyzing, L_c, and compare it to the free space wavelength at the operating frequency you are simulating: \lambda = c_0/f. The electrical size is the ratio of these two. If the object size is much smaller than wavelength, L_c < \sim\lambda/100, then it is likely that it is in the quasi-static regime, and the AC/DC Module is more appropriate. On the other hand, if the object size is comparable to the wavelength, then it is likely that the object will act as an antenna, as a transmission line or waveguide, or as a resonator. If you are trying to solve any kind of antenna, wave scattering, or resonant cavity problem, then the RF or Wave Optics modules should be used. (Note that this is really independent of the operating frequency; it is only the ratio of object size to wavelength that matters.) There is some region of overlap between the AC/DC and the RF Modules, where either formulation could be used, and if you are right at the boundary between the regions of applicability, you may want to use both, depending on how wide of a frequency band you are simulating.

As the object size, L_c, gets larger that the wavelength, L_c > \sim10 \lambda, the models you build will become increasingly more computationally demanding (not a big problem in 2D, but definitely for 3D modeling). In fact, for 3D models, the ** Electromagnetic Waves, Frequency Domain** form can only practically be used up to an object size of about 10\lambda \times10\lambda \times10\lambda. A model of that size would already take a 64GB RAM computer to solve, and memory requirements will grow as O(L_c^3).

For objects much larger than the wavelength, the Wave Optics Module can be appropriate. The Wave Optics Module solves the same electromagnetic wave equation as the RF Module, but in addition it also offers a *Beam Envelope* interface, which solves a slightly different equation:

This equation takes as input a wave vector, \mathbf{k}, which defines the average local wave vector within the modeling space. That is, you must know ahead of time the average direction of the wave. This is often the case for photonic devices such as waveguides, couplers, and interferometers. The huge advantage of this formulation is that you can use a very coarse mesh in the regions where the beam envelope is varying slowly. For example, to model the fields propagating down a uniform fiber optic cable, the cross-section of the fiber would need to be meshed finely enough to resolve the mode shape, but the length of the fiber could be modeled with only a single element, regardless of length! Of course, in regions where the wave rapidly changes directions, or scatters in multiple directions, a finer mesh is needed, and the computational requirements will approach that of the Electromagnetic Wave formulation. In practice, the *Beam Envelope* interface is useful when the average local direction of propagation is known, and the field intensity varies slowly. Under those conditions, you can model domains of length L \sim10^6 \lambda such as a directional coupler, for example.

This figure illustrates the range of applicability of the AC/DC, RF, and Wave Optics Modules, based on the operating frequency. Keep in mind that all of these boundaries between modules are a bit “fuzzy”. Although the chart is truncated at 1 km, you can certainly analyze larger systems, if you wish.

### Time Domain Electromagnetic Field Modeling with the AC/DC, RF, or Wave Optics Modules

Both the Magnetic Fields and the Electromagnetic Waves formulations described above can be re-written and solved in the time domain if you wish to study the transient response of your system, or seek to model material nonlinear phenomena, such as solving for a transformer with a nonlinear B-H material, or light passing through a material with an optical nonlinearity. When solving in the time domain, just find the characteristic maximum frequency associated with your input signal, and consult the figure presented above to decide which module to use.

Time domain modeling does lead to relatively longer solution times than frequency domain modeling (memory requirements will be roughly equivalent) so it is advisable to use it sparingly. Keep in mind that you may not need to include all of the frequencies associated with your input signal. For example, if you have a square wave excitation, you can use Fourier Expansion to determine that such a signal has infinite frequency content, but you will also see that the higher harmonics have a relatively small contribution. You can therefore apply a smoothing to your source to remove some of this high-frequency content from the excitation.

There are also additional physics interfaces for time domain modeling included in these modules that I have not introduced here. You can find that information in the Specification Chart as well as the Product Documentation.

### Summary of the Computational Electromagnetics Product Options

This blog post should help guide you toward the module you will want to use for your electromagnetic field modeling, based on the physics you want to solve, the operating frequency, and the characteristic size of the objects you want to analyze. If you have questions that aren’t addressed here, please do not hesitate to contact us.

Check out the products mentioned here:

- Certified Consultants 29
- Chemical 46
- COMSOL Now 132
- Conference 100
- Core Functionality 58
- Electrical 115
- AC/DC 42
- MEMS 14
- Plasma 4
- RF 30
- Semiconductor 2
- Wave Optics 6

- Fluid 86
- CFD 40
- Microfluidics 8
- Mixer 3
- Molecular Flow 8
- Pipe Flow 6
- Subsurface Flow 10

- Interfacing 36
- Mechanical 141
- Multipurpose 14
- Tips & Tricks 32
- Trending Topics 43
- User Perspectives 81
- Video 63