# Advanced features

This section provides example models of some of the more advanced features of gprMax. Each example comes with an input file which you can download and run.

## Building a heterogeneous soil

This example demonstrates how to build a more realistic soil model using a stochastic distribution of dielectric properties. A mixing model for soils proposed by Peplinski (http://dx.doi.org/10.1109/36.387598) is used to define a series of dispersive material properties for the soil.

```
1#title: Heterogeneous soil using a stochastic distribution of dielectric properties given by a mixing model from Peplinski
2#domain: 0.15 0.15 0.1
3#dx_dy_dz: 0.001 0.001 0.001
4#time_window: 6e-9
5
6#waveform: ricker 1 1.5e9 my_ricker
7#hertzian_dipole: y 0.045 0.075 0.085 my_ricker
8#rx: 0.105 0.075 0.085
9
10#soil_peplinski: 0.5 0.5 2.0 2.66 0.001 0.25 my_soil
11#fractal_box: 0 0 0 0.15 0.15 0.070 1.5 1 1 1 50 my_soil my_soil_box
12#add_surface_roughness: 0 0 0.070 0.15 0.15 0.070 1.5 1 1 0.065 0.080 my_soil_box
13
14#geometry_view: 0 0 0 0.15 0.15 0.1 0.001 0.001 0.001 heterogeneous_soil n
```

Line 10 defines a series of dispersive materials to represent a soil with sand fraction 0.5, clay fraction 0.5, bulk density \(2~g/cm^3\), sand particle density of \(2.66~g/cm^3\), and a volumetric water fraction range of 0.001 - 0.25. The volumetric water fraction is given as a range which is what defines a series of dispersive materials.

These materials can then be distributed stochastically over a volume using the `#fractal_box`

command. Line 11 defines a volume, a fractal dimension, a number of materials, and a mixing model to use. The fractal dimension, 1.5, controls how the materials are stochastically distributed. The fractal weightings, 1, 1, 1, weight the fractal in the x, y, and z directions. The number of materials, 50, specifies how many dispersive materials to create using the mixing model (`my_soil`

).

### Adding rough surfaces

A rough surface can be added to any side of `#fractal_box`

using,

```
#add_surface_roughness: 0 0 0.070 0.15 0.15 0.070 1.5 1 1 0.065 0.080 my_soil_box
```

which defines one of the surfaces of the `#fractal_box`

, a fractal dimension, and minimum and maximum values for the height of the roughness (relative to the original `#fractal_box`

volume). In this example the roughness will be stochastically distributed with troughs up to 5mm deep, and peaks up to 10mm high.

More information, including adding surface water and vegetation, can be found in the section on using the fractal box command.