# set_binary_partition_coef¶

MultiPhase.set_binary_partition_coef(phases, model, **kwargs)[source]

Sets binary partition coefficient as defined by the interface concentration ratio of phase 1 to phase 2.

Parameters
• phases (List[GenericPhase]) – List of the two phases for which the binary partition coefficient model is being added.

• model (OpenPNM model) – Model for calculating the binary partition coefficient.

• kwargs (dict) – Keyword arguments to be passed to the `model`.

Examples

```>>> import openpnm as op
>>> from openpnm.phases import Air, Water, MultiPhase
>>> from openpnm.models.misc import constant
```
```>>> net = op.network.Cubic(shape=[5, 5, 5])
>>> air = Air(network=net, name='air')  # Create two pure phases
>>> water = Water(network=net, name='water')
>>> mphase = MultiPhase(network=net, phases=[air, water], name='multi')
```

Now, assign some pores to air and the rest to water

```>>> Ps = net['pore.coords'][:, 0] < 3  # Pick some pores to be air filled
>>> Ts = net.find_neighbor_throats(pores=Ps)  # Find neighboring throats
>>> mphase.set_occupancy(phase=air, Pvals=Ps, Tvals=Ts)  # Assign occupancies
>>> mphase.set_occupancy(phase=water, Pvals=~Ps, Tvals=~Ts)
```

Now, add an interface model for binary partition coefficient

```>>> mphase.set_binary_partition_coef(phases=[air, water],
...                                  model=constant,
...                                  value=0.5)
```

Now, verify that K12 for interface throats is 0.5

```>>> Ts_interface = net.find_neighbor_throats(Ps, mode="xor")
>>> K12_interface = mphase["throat.partition_coef.all"][Ts_interface]
>>> assert K12_interface.mean() == 0.5
```

Finally, verify that K12 for non-interface throats is 1.

```>>> Ts_rest = ~ np.isin(net.Ts, Ts_interface)
>>> K12_rest = mphase["throat.partition_coef.all"][Ts_rest]
>>> assert K12_rest.mean() == 1.
```