GenericPhysics

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

Bases: openpnm.core.Subdomain.Subdomain, openpnm.core.ModelsMixin.ModelsMixin

This generic class is meant as a starter for custom Physics objects

It produces a blank object with no pore-scale models attached. Users can add models from the models module (or create their own).

Parameters
  • network (OpenPNM Network object) – The network to which this Physics should be attached

  • phase (OpenPNM Phase object) – The Phase object to which this Physics applies

  • geometry (OpenPNM Geometry object) – The Geometry object that defines the pores/throats where this Physics should be applied.

  • name (str, optional) – A unique string name to identify the Physics object, typically same as instance name but can be anything. If left blank, and name will be generated that includes the class name and an integer index.

set_geometry(geometry=None, mode='add')[source]

Sets the association between this physics and a geometry (i.e. a set of pores and throats that define a subdomain)

Parameters
  • geometry (OpenPNM Geometry object) – The geometry defining the pores and throats to which this physics should be attached

  • mode (str) –

    Options are:

    ’swap’ - Associations will be made with the new geometry, and the pore and throat locations from the current geometry will be transferred to the new one.

    ’drop’ - Associations with the current geometry will be removed.

    ’add’ - If the physics does not presently have an associated geometry, this will create associations.

set_phase(phase=None, mode='swap')[source]

Sets the association between this physics and a phase.

Parameters
  • phase (OpenPNM Phase object) – If mode is ‘add’ or ‘swap’, this must be specified so that associations can be recorded in the phase dictionary. If the mode is ‘drop’, this is not needed since the existing association can be used to find it.

  • mode (str) –

    Options are:

    ’swap’ - Associations will be made with the new phase, and the pore and throat locations from the current phase will be transferred to the new one.

    ’drop’ - Associations with the existing phase will be removed.

    ’add’ - If the physics does not presently have an associated phase, this will create associations, but no pore or throat locations will assigned. This must be done using the set_geometry method.

Notes

In all cases the property data will be deleted since it will not be relevant to the new phase, so the regenerate_models method must be run.