Class VoroBuild#

Voronoi helper used by mesher.unstructuredmesh.UnstMesh to build the Centroidal Voronoi Tessellation underlying the finite-volume discretisation. Most users do not interact with it directly — _meshStructure() drives it.

class mesher.meshfunc.VoroBuild[source]#

Class for handling triangular meshes.

Attributes:
angles
ce_ratios_per_interior_edge
cell_barycenters
cell_centroids

Computes the centroids (barycenters) of all triangles.

cell_circumcenters
cell_partitions
circumradius
control_volume_centroids
control_volumes
edge_gid_to_edge_list
edge_lengths
edges_cells
face_partitions
inradius
is_boundary_facet
is_boundary_node
is_interior_node
signed_cell_areas

Signed area of a triangle in 2D.

surface_areas
triangle_quality

Methods

compute_curl(vector_field)

Computes the curl of a vector field over the mesh.

create_edges()

Set up edge-node and edge-cell relations.

initVoronoi(nodes, cells[, sort_cells])

Initialization.

mark_boundary

Initialise

initVoronoi(nodes, cells[, sort_cells])

Initialization.

Public Methods

Private Methods

__del__()

_compute_edges_cells()

This creates interior edge->cells relations.

_compute_integral_x()

Computes the integral of x,

_compute_surface_areas(cell_ids)

For each edge, one half of the the edge goes to each of the end points.

Public functions#

VoroBuild.initVoronoi(nodes, cells, sort_cells=False)[source]#

Initialization.

VoroBuild.edge_lengths()#
VoroBuild.ce_ratios_per_interior_edge()#
VoroBuild.control_volumes()#
VoroBuild.surface_areas()#
VoroBuild.control_volume_centroids()#
VoroBuild.signed_cell_areas()#

Signed area of a triangle in 2D.

VoroBuild.mark_boundary()[source]#
VoroBuild.is_boundary_node()#
VoroBuild.is_interior_node()#
VoroBuild.is_boundary_facet()#
VoroBuild.create_edges()[source]#

Set up edge-node and edge-cell relations.

VoroBuild.edges_cells()#
VoroBuild.edge_gid_to_edge_list()#
VoroBuild.face_partitions()#
VoroBuild.cell_partitions()#
VoroBuild.cell_circumcenters()#
VoroBuild.cell_centroids()#

Computes the centroids (barycenters) of all triangles.

VoroBuild.cell_barycenters()#
VoroBuild.inradius()#
VoroBuild.circumradius()#
VoroBuild.triangle_quality()#
VoroBuild.angles()#
VoroBuild.compute_curl(vector_field)[source]#

Computes the curl of a vector field over the mesh. While the vector field is point-based, the curl will be cell-based. The approximation is based on

\[\begin{split}n\cdot curl(F) = \lim_{A\\to 0} |A|^{-1} <\int_{dGamma}, F> dr;\end{split}\]

see <https://en.wikipedia.org/wiki/Curl_(mathematics)>. Actually, to approximate the integral, one would only need the projection of the vector field onto the edges at the midpoint of the edges.

Private functions#

VoroBuild.__del__()[source]#
VoroBuild._compute_edges_cells()[source]#

This creates interior edge->cells relations. While it’s not necessary for many applications, it sometimes does come in handy.

VoroBuild._compute_integral_x()[source]#

Computes the integral of x,

int_V x,

over all atomic “triangles”, i.e., areas cornered by a node, an edge midpoint, and a circumcenter.

VoroBuild._compute_surface_areas(cell_ids)[source]#

For each edge, one half of the the edge goes to each of the end points. Used for Neumann boundary conditions if on the boundary of the mesh and transition conditions if in the interior.