Welcome to VoroPy’s documentation!

A package for handling simplex-meshes in two and three dimensions with support for Voronoi regions.

This is of specific interest to everyone who wants to use the finite volume method, but many of the provided methods can come in handy for finite element problems, too.

For example, this package is for you if you want to:

  • have an easy interface for I/O from/to VTK and Exodus files;
  • create relations between nodes, edges, faces, and cells of a mesh;
  • compute the control volumes of a given input mesh;
  • display meshes with corresponding Voronoi meshes in matplotlib.

Some of the methods in this packages are merely convenience wrappers around the VTK Python interface which needs to be installed in your system. Further dependencies include Numpy and SciPy.

Contents:

Classes and Methods

class voropy.mesh2d(nodes, cells)

Class for handling two-dimensional triangular meshes.

Inheritance diagram of mesh2d

compute_control_volumes()

Compute the control volumes of all nodes in the mesh.

compute_edge_normals()

Compute the edge normals, pointing either in the direction of the cell with larger GID (for interior edges), or towards the outside of the domain (for boundary edges).

Returns edge_normals:
 List of all edge normals.
create_adjacent_entities()

Setup edge-node and edge-cell relations.

create_cell_circumcenters()

Computes the center of the circumsphere of each cell.

create_cells_volume()

Computes the area of all triangles in the mesh.

refine()

Canonically refine a mesh by inserting nodes at all edge midpoints and make four triangular elements where there was one. This is a very crude refinement; don’t use for actual applications.

show(show_covolumes=True)

Show the mesh using matplotlib.

Parameters:show_covolumes (bool, optional) – If true, show all covolumes of the mesh, too.
show_node(node_id, show_covolume=True)

Plot the vicinity of a node and its covolume.

Parameters:
  • node_id (int) – Node ID of the node to be shown.
  • show_covolume (bool, optional) – If true, shows the covolume of the node, too.
class voropy.mesh3d(node_coords, cells)

Class for handling three-dimensional tetrahedral meshes.

Inheritance diagram of mesh3d

compute_control_volumes()

Computes the control volumes of all nodes in mesh.

compute_face_normals()

Compute the face normals, pointing either in the direction of the cell with larger GID (for interior faces), or towards the outside of the domain (for boundary faces).

Returns face_normals:
 List of all face normals.
create_adjacent_entities()

Setup edge-node, edge-cell, edge-face, face-node, and face-cell relations.

create_cell_circumcenters()

Computes the center of the circumsphere of each cell.

create_cells_volume()

Computes the volumes of the tetrahedra in the mesh.

show_edge(edge_id)

Displays edge with covolume.

Parameters:edge_id (int) – Edge ID for which to show the covolume.
voropy.read(filename, timestep=None)

Reads an unstructured mesh with added data.

Parameters:
  • filename (str) – The file to read from.
  • timestep (int, optional) – Time step to read from, in case of an Exodus input mesh.
Returns mesh{2,3}d:
 

The mesh data.

Returns point_data:
 

Point data read from file.

Returns field_data:
 

Field data read from file.

Indices and tables

Table Of Contents

This Page