Apply trapping based on algorithm described by Y. Masson .
partial (bool) – Indicating whether partially filled network
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.
 Masson, Y., 2016. A fast two-step algorithm for invasion percolation with trapping. Computers & Geosciences, 90, pp.41-48
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’