class openpnm.io.VTK[source]

Bases: openpnm.io.GenericIO.GenericIO

The Visualization Toolkit (VTK) format defined by Kitware and used by Paraview.


Because OpenPNM data is unstructured, the actual output format is VTP, not VTK.

classmethod export_data(network, phases=[], filename='', delim=' | ', fill_nans=None, fill_infs=None)[source]

Save network and phase data to a single vtp file for visualizing in Paraview.

  • network (OpenPNM Network Object) – The Network containing the data to be written

  • phases (list, optional) – A list containing OpenPNM Phase object(s) containing data to be written

  • filename (string, optional) – Filename to write data. If no name is given the file is named after the network

  • delim (string) – Specify which character is used to delimit the data names. The default is ‘ | ‘ which creates a nice clean output in the Paraview pipeline viewer (e.g. net | property | pore | diameter)

  • fill_nans (scalar) – The value to use to replace NaNs with. The VTK file format does not work with NaNs, so they must be dealt with. The default is None which means property arrays with NaNs are not written to the file. Other useful options might be 0 or -1, but the user must be aware that these are not real values, only place holders.

  • fill_infs (scalar) – The value to use to replace infs with. The default is None which means that property arrays containing None will not be written to the file, and a warning will be issued. A useful value is

classmethod import_data(filename, project=None, delim=' | ')[source]

Read in pore and throat data from a saved VTK file.

  • filename (string (optional)) – The name of the file containing the data to import. The formatting of this file is outlined below.

  • project (OpenPNM Project object) – A GenericNetwork is created and added to the specified Project. If no Project is supplied then one will be created and returned.

classmethod load(*args, **kwargs)[source]

This method is being deprecated. Use import_data instead.

classmethod save(*args, **kwargs)[source]

This method is being deprecated. Use export_data instead.