MixedInvasionPercolation

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

Bases: openpnm.algorithms.GenericAlgorithm.GenericAlgorithm

An implemetation of invasion percolation which can invade bonds, sites or a mixture of both. Inlets can be treated as individual injection points that share a common pressure or have their own and progess independently. Inlets can also be single pores or clusters.

Parameters

network (GenericNetwork) – The network upon which the invasion should occur.

Notes

n/a

apply_flow(flowrate)[source]

Convert the invaded sequence into an invaded time for a given flow rate considering the volume of invaded pores and throats.

Parameters

flowrate (float) – The flow rate of the injected fluid

Returns

  • Creates a throat array called ‘invasion_time’ in the Algorithm

  • dictionary

apply_trapping(partial=False)[source]

Apply trapping based on algorithm described by Y. Masson [1].

Parameters

partial (boolean) – Indicating whether partially filled network

Notes

It is applied as a post-process and runs the percolation algorithm in reverse assessing the occupancy of pore neighbors. 3 situations can happen on invasion without trapping:

  • The number of defending clusters stays the same and clusters can shrink

  • A cluster of size one is suppressed

  • A cluster is split into multiple clusters

In reverse the following situations can happen:

  • The number of defending clusters stays the same and clusters can grow

  • A cluster of size one is created

  • Mutliple clusters merge into one cluster

With trapping the reversed rules are adjusted so that:

  • Only clusters that do not connect to a sink can grow and merge.

  • At the point that a neighbor connected to a sink is touched, the trapped cluster stops growing as this is the point of trapping in forward invasion time.

Logger info displays the invasion Sequence and pore index and a message with condition number based on the modified trapping rules and the assignment of the pore to a given cluster.

Initially all invaded pores are given cluster label -1 Outlets / Sinks are given -2

New clusters that grow into fully trapped clusters are either identified at the point of breakthrough or grow from nothing if the full invasion sequence is run, they are assigned numbers from 0 up.

References

[1] Masson, Y., 2016. A fast two-step algorithm for invasion percolation with trapping. Computers & Geosciences, 90, pp.41-48

Returns

  • Creates a throat array called ‘pore.clusters’ in the Algorithm

  • dictionary. Any positive number is a trapped cluster. Also creates 2

  • boolean arrays Np and Nt long called ‘<element>.trapped’

get_intrusion_data(inv_points=None)[source]

Returns the intrusion data.

plot_intrusion_curve(ax=None, inv_points=None, num_markers=25)[source]

Plot a simple drainage curve.

reset()[source]

Resets the various data arrays on the object back to their original state. This is useful for repeating a simulation at different inlet conditions, or invasion points for instance.

results(Pc)[source]

Places the results of the IP simulation into the Phase object.

Parameters

Pc (float) – Capillary Pressure at which phase configuration was reached

run(max_pressure=None)[source]

Perform the algorithm

Parameters

max_pressure (float) – The maximum pressure applied to the invading cluster. Any pores and throats with entry pressure above this value will not be invaded.

set_inlets(pores=None, clusters=None)[source]
Parameters
  • pores (array_like) – The list of inlet pores from which the Phase can enter the Network

  • clusters (list of lists - can be just one list but each list defines) – a cluster of pores that share a common invasion pressure.

  • of (Like Basic Invasion Percolation a queue) –

set_outlets(pores=[], overwrite=False)[source]

Set the locations through which defender exits the network. This is only necessary if ‘trapping’ was set to True when setup was called.

Parameters
  • pores (array_like) – Locations where the defender can exit the network. Any defender that does not have access to these sites will be trapped.

  • overwrite (boolean) – If True then all existing outlet locations will be removed and then the supplied locations will be added. If False (default), then supplied locations are added to any already existing outlet locations.

set_residual(pores=[], overwrite=False)[source]

Method to start invasion in a network w. residual saturation. Called after inlets are set.

Parameters
  • pores (array_like) – The pores locations that are to be filled with invader at the beginning of the simulation.

  • overwrite (boolean) – If True then all existing inlet locations will be removed and then the supplied locations will be added. If False, then supplied locations are added to any already existing locations.

Notes

Currently works for pores only and treats inner throats, i.e. those that connect two pores in the cluster as invaded and outer ones as uninvaded. Uninvaded throats are added to a new residual cluster queue but do not start invading independently if not connected to an inlet.

Step 1. Identify clusters in the phase occupancy. Step 2. Look for clusters that are connected or contain an inlet Step 3. For those that are merge into inlet cluster. May be connected to more than one - run should sort this out Step 4. For those that are isolated set the queue to not invading. Step 5. (in run) When isolated cluster is met my invading cluster it merges in and starts invading

setup(phase=None, pore_entry_pressure='pore.entry_pressure', throat_entry_pressure='throat.entry_pressure', snap_off='', invade_isolated_Ts=False, late_pore_filling='', late_throat_filling='')[source]

Used to specify necessary arguments to the simulation. This method is useful for resetting the algorithm or applying more explicit control.

Parameters
  • phase (OpenPNM Phase object) – The Phase object containing the physical properties of the invading fluid.

  • pore_entry_pressure (string) – The dictionary key on the Phase object where the pore entry pressure values are stored. The default is ‘pore.entry_pressure’.

  • throat_entry_pressure (string) – The dictionary key on the Phase object where the throat entry pressure values are stored. The default is ‘throat.entry_pressure’.

  • snap_off (string) – The dictionary key on the Phase object where the throat snap-off pressure values are stored.

  • invade_isolated_Ts (boolean) – If True, isolated throats are invaded at the higher invasion pressure of their connected pores.

  • late_pore_filling (string) – The name of the model used to determine late pore filling as a function of applied pressure.

  • late_throat_filling (string) – The name of the model used to determine late throat filling as a function of applied pressure.