GprMax is open-source software that simulates electromagnetic wave propagation. It solves Maxwell’s equations in 3D using the Finite-Difference Time-Domain (FDTD) method. Although it was designed initially for modeling Ground Penetrating Radar (GPR), it can also be used to model electromagnetic wave propagation for many other applications. GprMax-UI enhances this functionality by providing a high-level API for executing GprMax models, along with tools for visualization, analysis, and result interpretation.
This tutorial will guide you through the basic steps of using GPRMaxUI to run a simulation and view the results.
We can then proceed to create our GprMaxModel using the following code snippet:
1234567
model=GprMaxModel(title="B scan from a single target buried in a dielectric half-space",output_folder=Path("output"),domain_size=DomainSize(x=0.2,y=0.2,z=0.002),domain_resolution=DomainResolution(dx=0.002,dy=0.002,dz=0.002),time_window=TimeWindow(twt=3e-9),)
Material properties are defined using the Material class. The following code snippet shows how to define a material with a relative permittivity of 6, conductivity of 0 and relative permeability of 1.
We continue defining our model by adding the model geometries. For this example, we will add a box to the model domain using the DomainBox class and a sphere using the DomainSphere class. We use meters for defining the geometries dimensions.
1 2 3 4 5 6 7 8 91011121314151617
# add model geometriesbox=DomainBox(x_min=0.0,y_min=0.0,z_min=0.0,x_max=0.2,y_max=0.145,z_max=0.002,material="half_space",)model.add_geometry(box)cx=box.center().xcy=box.center().ycz=box.center().zsphere=DomainSphere(cx=cx,cy=cy,cz=cz,radius=0.005,material="pec")model.add_geometry(sphere)
Finally, we run the simulation using the model.run() method.
1
model.run(n="auto",geometry=True,snapshots=True)
To access the simulation data, you can use the model.data() function, which returns a dictionary containing the data for each receiver component. For more information about the data format, please refer to the GprMax documentation.
You can also check the geometry of your model before running the simulation using the model.plot_geometry() function.
output
Visualizing the results
GprMaxUI provides a set of functions to visualize the simulation data and interpret the results.
Plot data
1
model.plot_data()
Plot Snapshots
Snapshots can also be visualized using the model.plot_snapshot(trace_idx=35, iteration_idx=350) function. It will be useful to visualize how is the propagation of the wavefront through the model domain at a given time step defined by the iteration_idx and the trace index defined by the trace_idx.