  # Computational Electromagnetics Modeling, Which Module to Use?

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}:

\begin{array}{cc}
\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:

\nabla \cdot (-\sigma \nabla V) = 0

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:

\nabla \cdot (-\epsilon \nabla V) = 0

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:

\nabla \cdot \left[-\left(\sigma + \epsilon \partial_t\right)\nabla V\right] = 0

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:

\nabla \cdot \left[-\left(\sigma + j \omega \epsilon \right)\nabla V\right] = 0

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 Frequency Domain forms of the 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:

\nabla \cdot (-\mu \nabla V_m) = 0

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}:

\nabla \times( \mu^{-1}\nabla \times \mathbf{A}) = \mathbf{J}_s

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:

\nabla \times \mu^{-1}(\nabla \times \mathbf{A}) + (j \omega \sigma-\omega^2 \epsilon) \mathbf{A}=\mathbf{J}_s

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:

\nabla \times \mu_r^{-1}(\nabla \times \mathbf{E})-\omega^2 \epsilon_0 \mu_0 (\epsilon_r-j \sigma / \omega \epsilon_0) \mathbf{E}=\mathbf{0}

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:

(\nabla -i \mathbf{k}) \times \mu_r^{-1}((\nabla-i \mathbf{k}) \times \mathbf{E})-\omega^2 \epsilon_0 \mu_0 (\epsilon_r-j \sigma / \omega \epsilon_0) \mathbf{E}= \mathbf{0}

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:

#### Categories ##### Krupali Donda
February 1, 2015 ##### Deyler Castilla
October 15, 2015

Hi,
Could you please suggest me which module I need to use in order to solve the radiative transfer equation in a medium which contains UV absorbing particles? I need to calculate the total particles ‘ UV photon absorption and the UV scattering in the medium.

I would appreciate your help a lot,

Regards,
Deyler Castilla ##### Walter Frei
October 19, 2015

Hello Deyler,
This is a fairly deep question. The radiative transfer equation for absorbing and scattering media does fall a bit outside of the scope of this blog. We would suggest that you contact your COMSOL Support Team for individualized guidance about the type of modeling that you want to do here.
Best Regards, ##### Deyler Castilla
October 19, 2015

Thank you Walter. I will do it.

Kind regards,
Deyler ##### Walter Frei
January 25, 2017

https://www.comsol.com/blogs/introducing-ray-optics-module/ ##### Mohammed Mohammed
April 5, 2018

Dear Mr Frei
I am a PhD student and I want to know about the meaning of a computational model, What it is? How could it be obtained by COMSOL? Can you help me to understand the computational model very well?Please.
Best regards ##### Manoj Dhiman
April 20, 2018

Thanks Walter!
The computational domain of my problem is just above the one hundredth of wavelength and it involves multiple layers of different materials, which should cause reflection and transmission of waves from and through the interfaces. Now if I go for RF module I don’t find any such option and if AC/DC module is used how does COMSOL takes this effect into account? ##### Caty Fairclough
April 26, 2018

Hi Manoj,

For your question, I would suggest contacting our Support team.

Online Support Center: https://www.comsol.com/support
Email: support@comsol.com ##### ch santosh subudhi
June 29, 2018

What modules should I use for a time domain simulation of HF pulse (5-10ns rise time) injected into a RF transformer made of 31 material ferrite core? ##### Michael Kotelyanskii
November 11, 2019

DO I understand it correctly that the only difference between RF Module and Wave Optics Module is the Beam Envelope Interface.
On the frequency-wavelength-model dimensions chart above – can the area covered by RF Module be also served with the WaveOptics Module, or is there cases where RF would apply but WaveOptics would not?
Is the Wave Optics Model essentially RF Module + Beam Envelope Interface?
In other words if I am getting Wave Optics Module there is no need for me to also buy RF Module?
Thanks,
-Michael ##### Walter Frei
November 11, 2019 COMSOL Employee

Hello Michael,
You are close to correct. Both the RF Module and the Wave Optics Module can solve wave electromagnetic problems, and the Wave Optics Module also has the Beam Envelopes method. There are some features that the RF Module has that the Wave Optics Module does not, however. The RF Module includes a transmission line interface. (See, for example: https://www.comsol.com/model/transmission-line-low-pass-filter-41681 & https://www.comsol.com/model/transmission-line-wilkinson-power-divider-42061)
The RF Module also has a set of boundary conditions (the lumped port boundary conditions) that are not in the Wave Optics Module. These conditions are meant for exciting microwave circuits, coaxial cables, and other microwave regime transmission lines.

The two products are geared towards different audiences, and we do have different plans for the future functionality of these products. ##### Ho Yin Wong
May 4, 2020

Hi,
I am trying to model a magnet rotor with surface charge density, and wanting to study the field.
Should I use the electrostatic study or mfnc/mf study?
Electrostatic study allows me to input the surface charge density boundary, however, both mfnc and mf do not allow that.
Is there any suggestion? Thank you.
Best,
D.W.

EXPLORE COMSOL BLOG