Install openEMS On Ubuntu 20.04

It is perhaps too much to expect a man to be both the prince of experimentalists and a competent mathematician.

Oliver Heaviside in Electromagnetic Theory Vol. 1

What is openEMS?

The quote above is by this website’s namesake, and it is describing the English scientist Michael Faraday. While we think this is perhaps too harsh of Faraday, we do see this as a fair critique of most engineers (ourselves included)! This is why simulation tools are so important today: it allows engineers to predict the performance of their designs without a large knowledge of the related theory. While knowing the theory is certainly helpful, simulation tools remove the large burden associated with predicting electrical performance.

While LTspice and Qucs provide very good and free alternatives for circuit simulations, there have not been as many options for electromagnetic (EM) simulations. The biggest players in industry (namely Ansys and ADS) charge prices for their base level of software that puts it out of the grasp of many hobbyists and small companies. The cheapest option is likely Simberian’s software suite, but that is still at a level of affordability outside most hobbyists’ budgets.

Horn antenna field pattern, as simulated in openEMS. Image pulled from

That is why we were excited to stumble across openEMS. It is an FDTD (finite difference, time domain) solver and is capable to solve any arbitrary problem. This is in contrast to solvers that rely upon other numerical techniques to solve EM simulations, such as method of moments. While a powerful tool, method of moments requires certain assumptions to be true in order to solve the problem. For a solver such as NEC, it is limited to wire antennas. For Keysight’s ADS, it requires printed circuit board (PCB) geometries with infinite (in the x and y directions) dielectric layers. For VIAs in the PCB, it makes assumptions about current flow (only in the z direction) which may not always be true.

In this blog post, we will detail how to install openEMS on Ubuntu 20.04.

How to Install openEMS on Ubuntu 20.04

We opted to install openEMS on Ubuntu 20.04 vs. trying to install it on Windows. We initially attempted to install it on Windows through the pre-built binaries as well as building from the source but ran into issues. Also, trying to install openEMS with Windows 10 WSL is not apparently possible as the rendering tool used by openEMS (CSXCAD) is not supported by WSL (or WSL2 for that matter).

The steps below outline how to install openEMS on Ubuntu 20.04. In addition, we also offer optional steps on how to build and install the unsupported Python interface for openEMS. As it is unsupported, there are some issues with it, however, future blog posts will detail how to use Python to quickly build and run simulations.

Step 1 – Update Ubuntu

The first step is to update your distribution of Ubuntu.

sudo apt update
sudo apt upgrade

Step 2 – Install Needed Packages

The next step is to install the needed dependencies.

sudo apt install build-essential git cmake libhdf5-dev libvtk6-dev libboost-all-dev libcgal-dev libtinyxml-dev libvtk6-qt-dev

If you run into issues with libqt4-dev (as it is not included in the Ubuntu 20.04 repos) then follow the instructions here.

Another option instead of fighting with libqt4-dev is to install the following.

sudo apt install libtinyxml-dev libhdf5-serial-dev libcgal-dev vtk6 libvtk6-qt-dev

Step 3 – Clone openEMS from Github

Now, clone the openEMS repo from github.

git clone --recursive

Step 4 – Build openEMS

First, you need to navigate into your newly cloned repo.

cd openEMS-Project

Now, it’s time to run the setup script. This step will take a bit of time to complete.

./ ~/opt/openEMS

Now, add the required paths for openEMS. Note that “<user>” should be the user account where the openEMS script was run in the step above.


Step 5 – Install Paraview

Paraview is a program which is used by openEMS to display field animations. It is installed by running the following.

sudo apt install paraview

Step 6 – Testing the Installation

First navigate to the directory where the openEMS executable is stored. Again, note that “<user>” should be the user account where the openEMS script was run in step 4.

cd /home/<user>/opt/openEMS/bin

Then execute openEMS.


The output if everything was installed correctly should be as shown below.

 | openEMS 64bit -- version v0.0.35-63-gba793ac
 | (C) 2010-2018 Thorsten Liebig <>  GPL license

If you received the output shown below, congratulations! You successfully completed the process to install openEMS on Ubuntu 20.04.

Optional – Installing Python Tools

The next steps are optional and are only needed if you want to install the unsupported Python tool-set for openEMS. At this point, you have completed the process to install openEMS on Ubuntu 20.04. In a later post, we will detail one of those tool-sets and some of the features available in it.

Step 7 – Install Python Libraries

First, create a variable for where your openEMS directory is located. The command below assumes you cloned the github repo (Step 3) into your home directory.

export OPENEMS=~/opt/openems

If you have not installed pip (a package manager) for Python 3, do so using the following step.

sudo apt-get install python3-pip

Next, using pip, ensure that it is up-to-date.

sudo python3 -m pip install --upgrade pip

Next, you will need to install dependencies that are needed.

sudo python3 -m pip install vtk scipy matplotlib h5py

Next navigate into the python directory within CSXCAD. This step assume you cloned the github repo into your home directory.

cd ~/openEMS-project/CSXCAD/python

Now, you will run multiple commands in one line to first build the needed packages, and then to install them. You will then navigate out of the python directory and end up in your openEMS project directory. This step is needed to build the appropriate Python functions for the CAD environment used by openEMS to function appropriately.

python3 build_ext -I$OPENEMS/include -L$OPENEMS/lib -R$OPENEMS/lib; sudo python3 install; cd ../..

We did have some issues with the previous step. We did need to open “CSPrimitives.cpp” and modify some of the headers to point to the “../../src” directory. . We feel like this should not be necessary, but we wanted to note it in case somebody else ran into issues.

The next step is to build and install the python packages necessary for openEMS itself. First, navigate into the python directory within openEMS.

cd openEMS/python

Now we will again run multiple commands in one line to build and install the needed packages.

python3 build_ext -I$OPENEMS/include -L$OPENEMS/lib -R$OPENEMS/lib; sudo python3 install; cd ../..

Wrapping Up

Congratulations! You did it! You have learned how to install openEMS on Ubuntu 20.04! This procedure likely works for other distributions but as with most things Linux, there will be small deviations.

In future blog posts we will be detailing ways to use Python to simplify building simulations and looking at the results generated.

Leave a Reply

Your email address will not be published. Required fields are marked *