# CST Microwave Studio

## Contents

## Introduction

One of the difficulties of working with electromagnetic fields is that they are not readily visible inside a cavity. Using simulation software is one way to visualize the formation of EM waves and their modes. CST Microwave Studio along with HFSS and Sonnet are probably some of the better known simulation suites.

For this work, CST's Microwave Studio was chosen.

### Acronyms

There are a few acronyms which are useful to know ahead of time:

- CST - "Computer Simulation Technology" - the German company who sells the MWS
- MWS - "Microwave Studio" - a collection of solvers for simulation EM waves
- TE - "Transverse Electric" mode - a type of resonance along with TM and TEM modes
- Tetrahedrals - one of the types of mesh cells used by MWS
- PEC - "Perfect Electrical Conductor" - a theoretically perfect conductor, typically used for background materials, probably closely analogous to superconductors.
- FD - "Frequency Domain" solver - one of many available in MWS
- TD - "Time Domain" solver - Another solver in MWS, not frequently used because it can have long convergence times with resonant structures
- EM - Either "Electromagnetic" spectrum or "Eigenmode Solver" - Another solver in MWS, used to find resonant frequencies of resonanting structures.

## Types of Precision

There are two types of precision in EM simulations, the first is the number tetrahedrons or mesh cells and the second is the number of samples.

When MWS builds a model, the first type of precision is how many tetrahedral are necessary to accurately simulate the model at a single given frequency. The larger the space or the higher the frequency, requires more tetrahedrals. The primary method used to control the number of tetrahedrals is by specifying the number of steps per wavelength, currently seven (default is 4). I also increase the “curvature refinement ratio” to 0.25 (from 0.5) and the “Max number of steps from curvature ref:” to 150 (from 100) because our cavity is entirely made out of round parts. The end result is that for the cavity which is 280mm in diameter and 390mm long simulated at 2.45Ghz, CST requires about 400K of tetrahedrals to meet an accuracy of 1% (it usually stops mesh refinement at 0.5%). The trick is to get as much accuracy as possible without running out of memory or making the simulations take days. That many tetradedrals uses about 4GB of RAM when simulating.

The second type of precision is that, depending on the width of the frequency range, CST runs the simulation at as many separate frequencies as necessary to make the interpolation of points on the S-parameter graph smooth. In the S-Parameter plots below, the frequency width is only 15Mhz and CST sampled 15 different frequencies, each running with about 440K tetrahedrals. In the previous S-parameter graph (showing 4dB insertion loss), the frequency range was 300Mhz and I stopped the number of samples at 60.

In short, to get an accurate S-parameter graph, it is necessary to both maximize the number of tetrahedrals and the number of samples in a tight a frequency range as possible.

## Parametrization

One of the neat features of CST’s microwave studio is the ability to insert variable names instead of numbers, for example, the diameter of a probe can be “diameter_of_probe” which you (or an optimization routine) can then change. In practice however, changing a variable by a large a mount usually breaks the model, for example, using a large diameter probe loop means it is too close to the probe mount. Thus when changing a variable, a few other variables have to be adjusted too.

Some features, such as lofts used to connect the probe loop to the probe had numerous “degenerate tetrahedrals” which are really thin tetrahedrals. Degenerate cells mean convergence of the adaptive meshing takes a long time, up to 8 or more samples. Each sample also uses a large number of mesh cells, for example, tetrahedral counts as high as 750K. Without degenerate mesh cells, the model uses ~450K cells, and takes 4 samples to converge mesh adaptation.

The number of samples to simulate depend on the frequency range, for example, a range of 25Mhz takes nine samples, a 100Mhz range can take 16 samples.

## Work Flow

There are numerous types of solvers available and only two were ever used in this research, the Frequency Domain Solver and the Eigenmode solver. The Eigenmode solver is useful for ignoring inputs (ports) and finding out at what frequencies a given cavity shape will resonate at. The Frequency Domain Solver is more sophisticated and requires that energy be injected via ports. A simple way of thinking about the difference is that the Eiegenmode solver finds the resonant frequencies (and their modes) and the Frequency Domain solver makes sure the method of injecting the energy will actually generate that resonance.

The work flow for simulation can be summarized as:

- Build the cavity with probes but without ports
- Simulate with the Eigenmode solver to find what the resonate frequencies are
- Find the TE modes and their frequencies

- Then add ports
- With a narrow frequency band centred on the TE mode, simulate with the Frequency Domain solver.

By using a narrow frequency band, the Frequency domain solver takes much less time and it reduces the guess work, as there can be up to ten or more resonances in a single gigahertz spread.

## Setting Up A Simulation

Setting up a simulation from scratch usually follows these steps:

- Set the Units (mm and Ghz)
- Set the background material, usually left as PEC
- Frequency range - this doesn't matter to start, because the Eignenmode solver will ignore this, but is required when using the FD solver.
- Draw the structure - After some experience, the best method is to design the shapes from the ground up to be parametrized. For example, when drawing a cylindrical cavity, enter "rod_diameter/2" into the radius box, the length as "cavity_length". MWS will then ask for their values when the object is first previewed or applied and those variables can be changed later. Drawing the objects with a mouse is too slow.
- Make sure that if the background material is PEC, that an "air" solid is added inside the cavity
- Make sure to draw the probes (if any) in order to see if they affect the resonance.

- Simulate with the Eigenmode solver to find out if the structure resonates at the required frequency.
- It may be necessary to increase the number modes to search for from ten, or use the "Frequencies Above" setting.
- It is also important to flip on the "Adaptive Mesh refinement", although for large and/or complicated structures, this may mean an unworkable number of mesh cells.

- If the resonant mode is being generated, then make sure you have two ports added and run the FD solver.
- Again, make sure to run enough mesh cells, but not too many that it takes a day to run the solver. Simulations should have 100K or more for quick test simulations and probably 300K or more for models that may result in real test cavities. Note the section above which talks about precision.
- Set the frequency range only around the frequency where the Eigenmode solver said that mode should appear.

### Troubleshooting

MWS is a complicated beast and can create results that do not match real results, especially if the mesh cell count is too low. Here are a few problems that have been encountered and solved or worked around:

- When using distributed computing, it complains about "Special characters" in the project name
- A complete solution was never found, but make sure the directory holding the project doesn't have spaces in the name and is short, i.e. F:\myprojects\.

- If the model doesn't have enough mesh cells, the "Local Mesh Properties" of important parts, like probes, can be increased.