Tutorial 2: Single phase permeability in a 5‐phase image - dp-69/xpm GitHub Wiki

In this tutorial we will consider an image of carbonate rock that is segmented into five phases: pore, solid, and 3 phases of microporosity.

  1. Navigate to the xpm image directory /xpm/build/Release/bin/images on your system. Here we must first uncompress the image we will use in this tutorial tar -xf Est_5phase250cubed4micron.raw.tar.gz. We can also view the image characteristics with cat Est_5phase250cubed4micron.txt. It is very important to note that in this image the pores (voids) are labelled with the value 0. The image is also an 8-bit raw format. These are mandatory in all xpm runs and all images must conform to this standard. Furthermore, we note that there are only 5 unique values in the image corresponding to the values of pore, 3 phases of micropore, and solid. The image must not contain any other values.
Size: 250 250 250
res 4 mum
  1. Navigate to the xpm directory cd [YOUR RELATIVE PATH]/xpm/build/Release/bin/tutorials/tutorial2 on your system. Here you will see a file called config_tutorial2.json. This is the config file we will use for running this simulation.

  2. Open the config file in your favourite text editor. vi config_tutorial2.json. The first section "image" is information about the image including where the image is located, its size, resolution, and value of the pores (voids) and solid phases. The path to the image is relative to the xpm executable.

  "image": {
    "path" : "/images/Est_5phase250cubed4micron",
    "size" : [250, 250, 250],
    "resolution": 4e-6,
    "phase": {
      "void" : 0, /* void = 0 for pnextract */
      "solid" : 4
  1. The next section is where we define information about the microporous phase(s). In this case there are three microporous phases and their values are 1, 2, and 3. We assign porosity and permeability in mD for each phase. These values can either be assigned from prior knowledge or calculated from higher resolution images of the microporous phase. This workflow will be covered in detail in later tutorials. For now we will assume this data is known.
 "darcy": [
    { "value": 1, "poro": 0.419, "perm": 9.861493},
    { "value": 2, "poro": 0.319, "perm": 7.861493},
    { "value": 3, "poro": 0.219, "perm": 5.861493}
  1. The next section is where we define the solver settings. If we are running the simulation multiple times, we can choose to use the cached values and save the values to use in the future. We also set the decomposition across multiple CPUs. In this example we are using a machine that has 24 CPUs. Make sure that the product of the three numbers equals the number of CPUs on your machine! We also set a convergence tolerance and a maximum number of iterations.
"solver" : {
    "cache" : { "use" : true, "save" : true },
    "decomposition": [4, 3, 2], /* the product is a number of MPI processes */
    "tolerance" : 1e-9,
    "max_iterations" : 19,
  1. The last section is where we set the display settings, save settings, and invasion percolation settings. As we are calculating absolute permeability on an image with multiple phases of microporosity we want to display either pressure or phases and turn invasion percolation and occupancy images off. Capillary pressure and relative permeability sw step are not used in single phase calculations, but are mandatory in the input file and can be ignored in this case.
"report" : {
    "display" : "phases", /* saturation | pressure | permeability | velem | phases */
    "invasion_percolation" : false, /* true */
    "occupancy_images": false,
    "capillary_pressure_sw_step": 0.075, /* 0.05 */
    "relative_permeability_sw_step": 0.05 /* 0.075 */
  1. Save any changes you have made ESC :wq

  2. Navigate to the location of the xpm executable and run xpm as an administrator. ./xpm /tutorials/tutorial2/config_tutorial2.json. You will see that first it runs PNM extract, followed by the multi-scale permeability solver:

  nodes: 1,539
  throats: 1,250
  isolated 1366 nodes
  inlet perm: 0.217310 mD
  outlet perm: 0.217310 mD
  residual: 6.506e-10, iterations: 15

  total: 15,625,000
  void:  1,283,635
  solid: 4,498,372
  darcy: 9,842,993
  total porosity: 30.54%

connectivity (isolated components)... done
  eff. porosity: 30.44%
  macro: 1,536
  darcy: 9,824,793

3D faces... done 0s

You should see something like this for the visualisation:

As we are not running a multiphase simulation, the Pc and Kr curves will be blank.