- class openpnm.phases.MultiPhase(*args, **kwargs)¶
Creates Phase object that represents a multiphase system consisting of a given list of GenericPhases.
phases (list of OpenPNM Phase objects) – A list containing the phase objects which comprise the multiphase mixture
network (OpenPNM network object) – The network to which this object is associated
settings (dataclass-like or dict, optional) – User defined settings for the object to override defaults. Can be a dataclass-type object with settings stored as attributes or a python dicionary of key-value pairs. Settings are stored in the
settingsattribute of the object.
name (string, optional) – A unique name to assign to the object for easier identification. If not given one will be generated.
>>> import scipy as sp >>> import openpnm as op >>> from openpnm.phases import Air, Water, MultiPhase
>>> 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') >>> Ps = net['pore.coords'][:, 0] < 3 # Pick some pores to be air filled >>> Ts = net.find_neighbor_throats(pores=Ps) # Find neighboring throats >>> Ts = net.to_mask(throats=Ts) # Convert throat indices to mask >>> mphase.set_occupancy(phase=air, Pvals=Ps, Tvals=Ts) # Assign occupancies >>> mphase.set_occupancy(phase=water, Pvals=~Ps, Tvals=~Ts)
Air and water have uniform viscosity values throughout, so the peak-to-peak distance is 0, while the mixture phase has the viscosity of air in some locations and water in others, hence a heterogenous viscosity array:
>>> np.ptp(water['pore.viscosity']) == 0. True >>> np.ptp(air['pore.viscosity']) == 0. True >>> np.ptp(mphase['pore.viscosity']) == 0. False
A shortcut to query the total number of pores on the object
A shortcut to query the total number of throats on the object
A shortcut to get a list of all pores on the object
A shortcut to get a list of all throats on the object
List of available models on the objects
String representing the name of the object
A shortcut to get a handle to the associated network.
A shortcut to get a handle to the associated phase (itself).
A shortcut to query the associated physics(es).
A shortcut to get a handle to the associated project.
Dictionary containing object settings.
add_model(propname, model[, regen_mode])
Adds a new model to the models dictionary.
Adds supplied phases to the MultiPhase object and initializes occupancy to 0.
filter_by_label([pores, throats, labels, mode])
Returns which of the supplied pores (or throats) has the specified label(s)
get_conduit_data(poreprop[, throatprop, mode])
Combines requested data into a single 3-column array.
Gathers property values from component phases to build a single array.
Determines a pore (or throat) property as the average of it's neighboring throats (or pores)
labels([pores, throats, element, mode])
Returns a list of labels present on the object
Returns the number of pores of the specified labels
Return the number of throats of the specified labels
Return parameter names and values in a dictionary
pores([labels, mode, asmask, to_global])
Returns pore indicies where given labels exist, according to the logic specified by the
props([element, mode, deep])
Returns a list containing the names of all defined pore or throat properties.
regenerate_models([propnames, exclude, deep])
Regenerate models associated with the Multiphase object
Removes model and data from object.
set_binary_partition_coef(phases, model, ...)
Sets binary partition coefficient as defined by the interface concentration ratio of phase 1 to phase 2.
set_label(label[, pores, throats, mode])
Creates or updates a label array
set_occupancy(phase[, Pvals, Tvals, pores, ...])
Specifies occupancy of a phase in each pore and/or throat.
show_hist([props, bins, fontsize])
Shows a quick plot of key property distributions.
throats([labels, mode, asmask, to_global])
Returns throat locations where given labels exist, according to the logic specified by the
Converts a boolean mask to a list of pore or throat indices.
Convert a list of pore or throat indices into a boolean mask of the correct length.