Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

gprMax workshop: model files

Model files and the participant handout for the modelling sessions of the GPR and gprMax workshop: three sessions that go from a single A-scan to a realistic soil and a shielded antenna.

This is workshop material, not the official gprMax examples. For those, and for the software itself, see gprMax and its documentation.

Folder Contents
docs/ The participant handout (PDF): setup, the exercises, a command summary
session1/ Anatomy of a model: hash-command input files
session2/ Basic GPR models with the Python API, beside the matching .in files
session3/ A realistic soil and a shielded antenna built in five stages
tools/ Two small plotting scripts used in the exercises
precomputed/ Two antenna B-scans that take too long to run in class

Getting started

You need Python 3.11 to 3.13, gprMax 4.0.2 or newer, and ParaView 5.12 or newer. No compiler and no GPU are needed.

python -m pip install gprMax

Download this repository (Code, then Download ZIP, or the zip attached to a release), unpack it into your working folder, and start with the handout in docs/.

Every file here was run with gprMax 4.0.2 (Python 3.13, CPU solver). Run times are for a 2-core machine without a GPU, so a typical laptop should be at least as fast.

Run everything from inside the session folder, for example:

cd session1
python -m gprMax s1_cylinder_Ascan_2D.in
python -m gprMax.toolboxes.Plotting.plot_Ascan s1_cylinder_Ascan_2D.h5

From Session 2 onwards, every .in file has a .py file of the same name that builds the same model with the Python API, line for line and with the same numbers; each object is followed by the hash command it replaces. The API version writes its output as <name>_api.h5, and for every pair the two outputs are identical. (The API twin of s1_cylinder_Ascan_2D.in is s2_cylinder_Ascan_2D.py.)

gprMax's own plot_Ascan plots one output file at a time. To overlay traces from several files, the pack includes tools/compare_ascans.py. It needs nothing beyond what gprMax itself installs (h5py, matplotlib, numpy):

python ../tools/compare_ascans.py a.h5 b.h5 [--component Ey] [--normalise] [--save fig.png]

Session 1: anatomy of a model (hash commands)

File What it shows Run time
s1_cylinder_Ascan_2D.in The running example: metal cylinder in a half-space, 2D TM, with a geometry view 1 s
s1_cylinder_snapshots.in The same model with 30 snapshots (0.1 ns apart) for a ParaView animation 1 s
s1_dispersion_2mm.in, _5mm.in, _8mm.in One pulse travelling 0.40 m on three grids: 14.4, 5.8 and 3.6 cells per wavelength 1 s each
s1_break_short_window.in Time window halved: the reflection is never recorded 1 s
s1_break_object_order.in Cylinder painted before the half-space: the target vanishes 1 s
s1_break_near_pml.in Target and receiver inside the PML 1 s
s1_break_polarisation.in x-polarised source in a TMz model: gprMax stops with "polarisation must be z in 2D TMz mode" stops

A grid coarser than 3 cells per wavelength (e.g. 10 mm here) is refused by gprMax unless --allow-underresolved is given.

Session 2: basic models with the Python API

File What it shows Run time
s2_cylinder_Ascan_2D.py The running example with the API, each object annotated with its hash command. Output identical to Session 1 1 s
s2_cylinder_Bscan_2D.in B-scan with #src_steps / #rx_steps, run with -n 60 15 s
s2_cylinder_Bscan_2D.py The same B-scan with the API, line for line (SrcSteps, RxSteps, n=60). Output identical 15 s
s2_target_comparison.py A scene-building function called in a loop: PEC, air void, wet clay 4 s
s2_permittivity_sweep.py Sweep of the half-space permittivity (4, 9, 16, 25) 5 s
s2_rebar_slab_Bscan.py Layered model with rebar generated in a loop, 90-trace B-scan 60 s
s2_cylinder_Ascan_3D.in, .py The running example in 3D (1.26 million cells) 20 s

Merge and plot a B-scan:

python -m gprMax.toolboxes.Utilities.outputfiles_merge s2_cylinder_Bscan_2D --remove-files
python -m gprMax.toolboxes.Plotting.plot_Bscan s2_cylinder_Bscan_2D_merged.h5 Ez

Session 3: soil and antenna

File What it shows Run time
s3_debye_halfspace.in, .py Running example with a one-pole Debye half-space 1 s
s3_soil_Ascan_2D.in, .py Peplinski soil in a fractal box 2 s
s3_soil_rough_Ascan_2D.in The same with a rough surface 2 s
s3_soil_rough_Ascan_2D.py The same model with the API, line for line; output identical 2 s
s3_soil_Bscan_2D.in, .py 60-trace B-scan over the soil; run with -n 60 --geometry-fixed so the soil is built once 27 s
s3_soil_rough_Bscan_2D.in, .py The same with the rough surface 27 s
s3_soil_models.py Instructor's tool, not used in the exercises: one script with options (--seed, --water, --rough, --homogeneous, --bscan, --geometry) for producing many soil variants quickly 1 s (A-scan), 20 s (60-trace B-scan)
s3_live_stage1.in to s3_live_stage5.in The live antenna build: each file is the previous one with a block of lines added at the end 27 s each
s3_live_stage1.py to s3_live_stage5.py The same five stages with the API, line for line. Output identical 27 s each
workshop_antenna.py The same antenna again, this time as a reusable function with parameters; reproduces the five stage files exactly (module)
s3_antenna_stages.py API version of the five stages, with options to vary them 27 s per run
s3_gssi1500_freespace.py The GSSI 1.5 GHz-like library antenna on the same 2 mm grid 34 s
s3_antenna_over_ground.py Transmitter and receiver over a metal cylinder 100 mm deep in a half-space of permittivity 9 (3.3 million cells): --antenna good, bad or hertzian, --no-target, --bscan N, --restart I, and --er, --depth, --xsize, --time to change the model 90 s per trace

The live antenna build (free space, 50 Ohm feed, 1.43 million cells). "Late energy" is the share of the pulse energy at the probe below the antenna that arrives after 2.5 ns:

Stage Lines added to the file Peak below Late energy
1 dipole three #edge: 0.95 V/m 7.7%
2 bow-tie two #triangle: 1.46 V/m 4.3%
3 shield five #plate: 1.44 V/m 12.2%
4 absorber #material:, #box: 1.41 V/m 2.0%
5 resistors #material:, four #edge: 1.17 V/m 0.3%
python -m gprMax s3_live_stage1.in
python -m gprMax s3_live_stage2.in
python ../tools/compare_ascans.py s3_live_stage1.h5 s3_live_stage2.h5 --component Ey
python -m gprMax s3_live_stage3.in --geometry-only      # look at it in ParaView
python -m gprMax.toolboxes.Plotting.plot_port s3_live_stage1.h5 --fmin 0.2e9 --fmax 3e9

The same stages, and variations of them, with the API:

python s3_antenna_stages.py --stage 1 --arm 0.070 --tag arm70       # longer arms: slower ringing
python s3_antenna_stages.py --stage 2 --flare 90 --tag flare90      # wider bow-tie
python s3_antenna_stages.py --stage 2 --resistance 200 --tag R200   # feed matched to the bow-tie
python s3_antenna_stages.py --stage 4 --sigma 0.4 --tag sigma0.4    # stronger absorber
python s3_antenna_stages.py --stage 5 --termination 0 --tag short   # arms joined to the shield with metal

In the over-ground model the good antenna is stage 5 and the bad one stage 3.

Write-it-yourself task for Session 3: start from s3_live_stage4.in and type the stage 5 resistor lines yourself, working out the conductivity from 1 / (R x cell size). s3_live_stage5.in is the answer for 100 Ohm (5 S/m); with 50 Ohm (10 S/m) the peak is 1.09 V/m and the late energy 0.3%.

Antenna B-scan (every trace rebuilds the geometry, so about 90 s per trace):

python s3_antenna_over_ground.py --bscan 17
python -m gprMax.toolboxes.Utilities.outputfiles_merge s3_ground_good_Bscan --remove-files
python ../tools/plot_antenna_bscan.py s3_ground_good_Bscan_merged.h5

The permittivity (9) and depth (100 mm) are chosen so that the reflection from the cylinder arrives after the direct signal between the antennas has died away. The hyperbola is then visible in the raw B-scan, with no processing and no gain. With the good antenna 1.0% of the direct signal's energy arrives after 2.75 ns, when the reflection begins; with the bad antenna 48% does, and its ringing runs across the hyperbola.

precomputed/ holds the merged 17-trace B-scans (15 mm spacing) for the good and the bad antenna, about 25 minutes each on 2 cores.

Notes

  • Run one model at a time. Two gprMax jobs sharing the same cores slow each other down far more than twofold (a 15 s B-scan did not finish in 10 minutes here while a 3D job was running).

  • 2D models use #domain_mode: TM and inf on the invariant (z) axis.

  • Scripts pass an output name without the .py suffix to gprMax.run(). Passing the script path itself gives output called name.py.h5 in 4.0.2.

  • Geometry views and snapshots are VTKHDF files and need ParaView 5.12 or newer.

  • Apart from the two B-scans in precomputed/, output files are not included; run the models to create them.

  • Answers to the write-it-yourself tasks of Sessions 1 and 2 are added to the repository after each session.

Licence

The model files and the handout are licensed under CC BY 4.0; see LICENSE. gprMax itself is released under the GNU GPL v3 or later.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages