gprMax User Guide
Release 3.0.0b12(Bowmore)
Craig Warren and Antonis Giannopoulos
January 08, 2016
Contents
1 Getting Started
1.1 What is gprMax? .
1.2
1.3
1.4
1.5
.
.
.
.
Software structure .
.
Installation (End users) .
.
Installation (Developers) .
Run the code .
.
.
.
.
.
.
.
.
2 Software Features
2.1 What’s new/changed? .
2.2 Key features
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3 Guidance on GPR Modelling
.
.
.
.
3.1
3.2
3.3
3.4 Absorbing boundary conditions .
Basic concepts .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Coordinate system and conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Spatial discretisation .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
4 Input file commands
Essential commands .
.
.
.
4.1
.
4.2 General commands .
4.3 Media commands .
.
.
4.4 Object construction commands
4.5
.
.
4.6
Excitation commands
.
PML commands .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5 Geometry and Snapshot files
.
.
.
.
5.1 Geometry files .
5.2
.
Snapshot files .
.
.
.
.
6 Output file
File structure .
6.1
.
6.2 Viewing output .
.
.
.
.
7 Plotting
.
7.1 A-scans .
.
7.2
B-scans .
Built-in waveforms .
7.3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
8 File utilities
8.1
8.2
inputfile_old2new.py .
outputfiles_merge.py .
9 Parallelism - OpenMP/MPI
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1
1
2
3
5
7
7
9
13
13
15
16
17
19
20
21
24
27
32
36
39
39
41
43
43
44
47
47
47
47
55
55
55
57
i
57
57
59
59
63
65
65
65
67
71
71
75
77
79
9.1 OpenMP .
.
9.2 MPI .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
10 Introductory/basic 2D models
10.1 A-scan from a metal cylinder
10.2 B-scan from a metal cylinder .
11 Antenna models
.
.
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1 Wire dipole antenna model .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2 Bowtie antenna model
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3 B-scan with a bowtie antenna model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
12 Advanced modelling
12.1 Building a heterogeneous soil
.
.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13 FAQs
14 References
Bibliography
ii
CHAPTER 1
Getting Started
1.1 What is gprMax?
gprMax (http://www.gprmax.com) is free software that simulates electromagnetic wave propagation. It solves
Maxwell’s equations in 3D using the Finite-Difference Time-Domain (FDTD) method. gprMax was designed for
modelling Ground Penetrating Radar (GPR) but can also be used to model electromagnetic wave propagation for
many other applications.
gprMax is released under the GNU General Public License v3 or higher (http://www.gnu.org/copyleft/gpl.html).
gprMax is written in Python 3 (https://www.python.org) and includes performance-critical parts written in
Cython/OpenMP (http://cython.org).
1.1.1 Using gprMax? Cite us.
If you use gprMax and publish your work we would be grateful if you could cite gprMax using the following
references:
• Warren, C., Giannopoulos, A., & Giannakis I. (2015). An advanced GPR modelling framework –
8th Int. Workshop Advanced Ground Penetrating Radar
the next generation of gprMax, In Proc.
(http://dx.doi.org/10.1109/IWAGPR.2015.7292621)
• Giannopoulos, A. (2005). Modelling ground penetrating radar by GprMax, Construction and Building
Materials, 19(10), 755-762 (http://dx.doi.org/10.1016/j.conbuildmat.2005.06.007)
1.2 Software structure
gprMax/
docs/
gprMax/
LICENSE
README.rst
setup.py
tests/
tools/
user_libs/
user_models/
• docs contains source files for the User Guide. The User Guide is written using reStructuredText
(http://docutils.sourceforge.net/rst.html) markup, and is built using Sphinx (http://sphinx-doc.org) and Read
the Docs (https://readthedocs.org).
• gprMax is the main package. Within this package the main module is gprMax.py
1
gprMax User Guide, Release 3.0.0b12(Bowmore)
• LICENSE contains
information
(http://www.gnu.org/copyleft/gpl.html).
on
the GNU General
Public License
v3
or
higher
• README.rst contains getting started information on installation, usage, and new features/changes.
• setup.py is used to compile the Cython extension modules.
• tests is a sub-package which contains test modules and input files.
• tools is a sub-package which contains scripts to assist with viewing and post-processing output from
models.
• user_libs is a sub-package where useful modules contributed by users are stored.
• user_models is a sub-package where useful input files contributed by users are stored.
1.3 Installation (End users)
You should use the following guidance if you intend to use gprMax without developing the code. There are 2 main
steps to the installation:
1. Getting the code
2. Installing Python, packages, and C libraries
1.3.1 1. Get the code
• Download the code from https://github.com/gprMax/gprMax
– Click on Releases from the top header and choose the release you want (latest is at the top).
– Download zip files of the source code and binary extensions for your platform (windows for 32-bit
or 64-bit versions of Microsoft Windows or linux_macosx for 64-bit versions of Linux or Mac OS
X).
– Expand both zip files and copy the contents of the windows or linux_macosx directory into the
gprMax-v.X.Y.Z/gprMax directory.
1.3.2 2. Install Python, packages, and C libraries
Mac OS X and Linux
• Install Python 3 (https://www.python.org/downloads/)
– Mac OS X: It is recommended to install Python 3 via the Homebrew package manager (http://brew.sh)
rather than from the Python website.
• Install Python packages: cython, h5py, matplotlib, numpy, psutil, pyfiglet. Optionally mpi4py if you
want to use the Message Passing Interface (MPI) task farm functionality (requires an installation of Open-
MPI).
– Mac OS X: packages can be installed using the pip package manager which comes with Python, e.g.
pip install cython. To check what packages are installed use pip list.
– Linux: packages can be installed using the pip package manager which comes with Python, e.g. pip
install cython, or alternatively using the apt-get package manager, e.g. sudo apt-get
install python3-cython. To check what packages are installed use pip list.
• Install/Check C libraries:
– Mac OS X: gcc is easily installed using the Homebrew package manager (http://brew.sh). Installations
of Xcode on Mac OS X come with the LLVM (clang) compiler, but it does not currently support
OpenMP, so you must install gcc.
2
Chapter 1. Getting Started
gprMax User Guide, Release 3.0.0b12(Bowmore)
– Linux: gcc (https://gcc.gnu.org) should be already installed, so no action is required.
Microsoft Windows
• Install Python 3 (https://www.python.org/downloads/)
• Install Python packages:
– Use the pip package manager, which comes with Python, to install the cython, pyfiglet, pyparsing,
python-dateutil, and pytz packages, e.g. pip install cython. To check what packages are
installed use pip list.
– Download
binaries
from
http://www.lfd.uci.edu/~gohlke/pythonlibs/, and then install (in the aforementioned order) using
pip, e.g. pip install numpy-1.9.2+mkl-cp35-none-win_amd64.whl
packages
matplotlib
numpy,
psutil,
h5py,
of
• Install
the Microsoft Visual
Studio
2015 C++ Redistributable
(vc_redist.x86.exe
from https://www.microsoft.com/en-
32-bit
for
us/download/details.aspx?id=48145.
or
vc_redist.x64.exe
for
64-bit)
You are now ready to proceed to the section on running gprMax.
1.4 Installation (Developers)
You should use the following guidance if you intend to develop the gprMax code. There are 3 main steps to the
installation:
1. Getting the code
2. Installing Python, packages, and a C compiler
3. Compiling the Cython extensions
1.4.1 1. Get the code
• Use Git
(https://git-scm.com) and clone the master branch of
the repository:
git clone
https://github.com/gprMax/gprMax.git
• or download a zip archive of the code from https://github.com/gprMax/gprMax. Choose the Download
ZIP button from the top header.
1.4.2 2. Install Python, packages, and a C compiler
Mac OS X and Linux
• Install Python 3 (https://www.python.org/downloads/)
– Mac OS X: It is recommended to install Python 3 via the Homebrew package manager (http://brew.sh)
rather than from the Python website.
• Install Python packages: cython, h5py, matplotlib, numpy, psutil, pyfiglet. Optionally mpi4py if you
want to use the Message Passing Interface (MPI) task farm functionality (requires an installation of Open-
MPI).
– Mac OS X: packages can be installed using the pip package manager which comes with Python, e.g.
pip install cython. To check what packages are installed use pip list.
– Linux: packages can be installed using the pip package manager which comes with Python, e.g. pip
install cython, or alternatively using the apt-get package manager, e.g. sudo apt-get
install python3-cython. To check what packages are installed use pip list.
1.4.
Installation (Developers)
3
gprMax User Guide, Release 3.0.0b12(Bowmore)
• Install a C compiler which supports OpenMP:
– Mac OS X: gcc is easily installed using the Homebrew package manager (http://brew.sh). Installations
of Xcode on Mac OS X come with the LLVM (clang) compiler, but it does not currently support
OpenMP, so you must install gcc.
– Linux: gcc (https://gcc.gnu.org) should be already installed, so no action is required.
Microsoft Windows
• Install Python 3 (https://www.python.org/downloads/)
• Install a C compiler which supports OpenMP:
– Download
and
install
Community
(https://www.visualstudio.com/downloads/download-visual-studio-vs), which is free. Do a cus-
tom install and make sure under programming languages Visual C++ is selected, no other options are
required.
Microsoft
Studio
Visual
2015
– Create a new environment variable VS100COMNTOOLS which matches the value of the existing
VS140COMNTOOLS environment variable. To set an environment variable from the Start Menu,
right-click the Computer icon and select Properties. Click the Advanced System Settings link in the
left column. In the System Properties window, click on the Advanced tab, then click the Environment
Variables button near the bottom of that tab.
• Install Python packages:
– Use the pip package manager, which comes with Python, to install the cython, pyfiglet, pyparsing,
python-dateutil, and pytz packages, e.g. pip install cython. To check what packages are
installed use pip list.
– Download
binaries
from
http://www.lfd.uci.edu/~gohlke/pythonlibs/, and then install (in the aforementioned order) using
pip, e.g. pip install numpy-1.9.2+mkl-cp35-none-win_amd64.whl
packages
matplotlib
numpy,
psutil,
of
h5py,
If you use Anaconda, a popular Python distribution, please be aware that
is included with Anaconda (2.3.0).
there
It
If you
to use Anaconda you should upgrade the h5py package by downloading and installing the
pip install --upgrade
Warning:
is currently a bug with the HDF5 package (h5py)
effects 64-bit versions of Microsoft Windows
want
correct binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/,
h5py2.5.0cp34nonewin_amd64.whl
(https://github.com/h5py/h5py/issues/593).
that
e.g.
1.4.3 3. Compile Cython extensions
Once you have installed the aforementioned tools follow these steps to build the Cython extension modules for
gprMax:
1. Open a Terminal (Linux/Mac OS X) or Command Prompt (Windows) and navigate into the gprMax direc-
tory.
2. Compile the Cython extension modules using: python setup.py build_ext --inplace. You
should see a set of .c source files and a set of .so (Linux/Mac OS X) or .pyd (Windows) compiled
module files inside the gprMax directory.
Note: If you want to remove/clean Cython generated files, e.g. before rebuilding the Cython extensions, you can
use python setup.py cleanall.
You are now ready to proceed to the section on running gprMax.
4
Chapter 1. Getting Started