class RelativePermeability(*args, **kwargs)[source]

Bases: openpnm.algorithms.GenericAlgorithm.GenericAlgorithm

A subclass of Generic Algorithm to calculate relative permeabilities of fluids in a drainage process.

The main roles of this subclass are to get invasion sequence and implement a method for calculating the relative permeabilities of the fluids flowing in three directions.


  1. The results can be plotted using plot_Kr_curves, and numerical data can be obtained with get_Kr_data.

  2. Properties related to the invading phase have subscript ‘nwp’, while those related to the defending phase (if there is any) are named by subscript ‘wp’.

  3. As the relative permeability definition is the ratio of effective to absolute permeability, domain length and area calculation will appear in both nominator and denominator. Ignoring those variables, we only use the flow rate of the phase of interest in single and multiphase permeability calculation.


Returns data points of the relative permeability of the phase(s) in flow direction(s) and Saturation points.


Plots the relative permeability curve of the phase(s) in flow direction(s) as Kr vs Saturation points.


Calculates the saturation of each phase using the invasion sequence.


Snwp_num (int, optional) – Number of saturation point to calculate the relative permseability values. If not given, default value is 100. Saturation points will be Snwp_num (or 100 by default) equidistant points in range [0,1].


  1. For three directions of flow the absolute permeability values will be calculated using _abs_perm_calc.

  2. For each saturation point, the saturation values are calculated by _sat_occ_update. This function also updates occupancies of each phase in pores/throats. Effective permeabilities of each phase is then calculated. Relative permeability is defined by devision of K_eff and K_abs.

setup(invading_phase=None, defending_phase=None, invasion_sequence=None, flow_inlets=None, flow_outlets=None, Snwp_num=100)[source]

Assigns values to the algorithm settings.

This part is revised so that it can be applied on either 2D or 3D networks. The dimension is found by the number of boundary faces existed in the network asumming all boundary faces are labeled.

  • invading_phase (str) – The invading or non-wetting phase.

  • defending_phase (str, optional) – If defending phase is specified, then it’s permeability will also be calculated, otherwise only the invading phase is considered.

  • invasion_sequence (str (default is 'invasion_sequence')) – The dictionary key on the invading phase object where the invasion sequence is stored. The default from both the IP and OP algorithms is ‘invasion_sequence’, so this is the default here.

  • flow_inlets (dict, optional) – A dictionary containing the direction of the flow and the label of the pores as the inlet pores of that direction.

  • flow_outlets (dict, optional) – A dictionary containing the direction of the flow and the label of the pores as the outlet pores of that direction.

  • swnp_num (int) – The number of saturation points (equidistant points), at which the Kr values will be calculated.