Example: Regenerating Data from

R. Wu et al. / Elec Acta 54 25 (2010) 7394–7403

Import the modules


In [ ]:
import openpnm as op
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
import openpnm.models.geometry as gm
import openpnm.topotools as tt
%matplotlib inline
np.random.seed(10)

Set the workspace loglevel to not print anything


In [ ]:
ws = op.Workspace()
ws.settings["loglevel"] = 50

As the paper requires some lengthy calculation we have split it into parts and put the function in a separate notebook to be re-used in each part. The following code runs and loads the shared functions into this kernel


In [ ]:
%run shared_funcs.ipynb

The main function runs the simulation for a given network size 'n' and number of points for the relative diffusivity curve. Setting 'npts' to 1 will return the single phase diffusivity. the network size is doubled in the z direction for percolation but the diffusion calculation is effectively only calculated on the middle square section of length 'n'. This is achieved by copying the saturation distribution from the larger network to a smaller one.

We can inspect the source in this notebook by running a code cell with the following: simulation??

Run the simulation once for a network of size 8 x 8 x 8


In [ ]:
x_values, y_values = simulation(n=8)

In [ ]:
plt.figure()
plt.plot(x_values, y_values, 'ro')
plt.title('normalized diffusivity versus saturation')
plt.xlabel('saturation')
plt.ylabel('normalized diffusivity')
plt.show()