GenericPhysics

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

Bases: openpnm.core.Base.ParamMixin, 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

This association is done by setting the pores and throats that define the Subdomain to match.

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

  • mode (str) –

    Controls how the assignment is done. Options are:

    • ’add’ (default)

      If the physics does not presently have an associated geometry, this will create associations, otherwise an Exception is raised

    • ’drop’

      Associations with the current geometry will be removed

    • ’move’

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

See also

set_locations

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

Sets the association between this physics and a phase.

Parameters
  • phase (OpenPNM Phase object) – If mode is ‘add’ or ‘move’, 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:

    • ’add’ (default)

      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.

    • ’drop’

      Associations with the existing phase will be removed.

    • ’move’

      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.

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.