Tetrahedralize

Description

Subdivide 3D mesh cells into tetrahedra, or 2D mesh cells into triangles.

When the base contains polygons or polyhedra, VTK must be installed.

Construction

import antares
myt = antares.Treatment('tetrahedralize')

Parameters

  • base: Base

    The input base to be tetrahedralized.

  • coordinates: list(str)

    The variable names that define the set of coordinates. If no value is given, the default coordinate system of the base is used. Only useful if the base contains polyhedra or polygons.

Preconditions

The input base may be structured or unstructured. It remains unchanged during treatment. If it is structured, then it is first deepcopied, and the copy is made unstructured. So, the memory footprint will be roughly three times the initial one.

When the base contains polyhedra, the cells must be convex and the faces planar. Generally, these conditions are not fulfilled because of numerical issues, but it is often not a problem.

Postconditions

A new unstructured base is returned.

Warning

The extensive variables that are in the input base are interpolated to order 0. It is likely that they are not coherent with the mesh of the output base. (e.g. volume, surface, and normal vector)

Example

import antares
myt = antares.Treatment('tetrahedralize')
myt['base'] = base
tetra_base = myt.execute()
TETRA

How to subdivide pyramids, prisms and hexaedra into tetrahedra, J. Dompierre, P. Labbe, M-G. Vallet, R. Camarero, Rapport CERCA R99-78, 24 august 1999 Conference paper from the 8th International Meshing Roundtable, Lake Tahoe, Cal., 10-13/10/1999

Main functions

class antares.treatment.TreatmentTetrahedralize.TreatmentTetrahedralize

Treatment used to build a tetrahedralization of a mesh.

Principle: a quadrilateral face is subdivided into two triangular faces by the diagonal issued from the from the smallest vertices of the face.

execute()

Build the tetrahedralization of a mesh.

Returns

a base with tetrahedral elements.

Return type

antares.Base

Example

"""
This example shows how to transform all elements of a base in tetrahedra.
"""
import os

from antares import Reader, Treatment, Writer

# ------------------
# Reading the files
# ------------------
r = Reader('hdf_avbp')
r['filename'] = os.path.join('..', 'data', 'SECTOR', 'hybrid_sector.mesh.h5')
r['shared'] = True
base = r.read()
r = Reader('hdf_avbp')
r['base'] = base
r['filename'] = os.path.join('..', 'data', 'SECTOR', 'hybrid_sector.sol.h5')
r.read()

treatment = Treatment('tetrahedralize')
treatment['base'] = base
result = treatment.execute()

result.show()
# ------------------
# Reading the files
# ------------------
reader = Reader('bin_tp')
reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_ite<instant>.dat')
base = reader.read()

treatment = Treatment('tetrahedralize')
treatment['base'] = base
result = treatment.execute()

result.show()

r = Reader('bin_tp')
r['filename'] = os.path.join('..', 'data', 'ROTOR37', 'ELSA_CASE', 'MESH', 'mesh_<zone>.dat')
r['zone_prefix'] = 'Block'
r['topology_file'] = os.path.join('..', 'data', 'ROTOR37', 'ELSA_CASE', 'script_topo.py')
r['shared'] = True
base = r.read()

r = Reader('bin_tp')
r['base'] = base
r['filename'] = os.path.join('..', 'data', 'ROTOR37', 'ELSA_CASE', 'FLOW', 'flow_<zone>.dat')
r['zone_prefix'] = 'Block'
r['location'] = 'cell'
base = r.read()

treatment = Treatment('tetrahedralize')
treatment['base'] = base
result = treatment.execute()

result.show()

Utilitary class and methods

class antares.treatment.TreatmentTetrahedralize.Tetrahedralizer(dim, connectivity)

Build the tetrahedralisation of a mesh.

interpolate(value, location)
Returns

interpolated value for the tetrahedral mesh.

interpolate_cell(value)
Returns

interpolated cells values (order 0)

interpolate_node(value)
Returns

node values

property connectivity
Returns

tetrahedral connectivity.

Return type

CustomDict

property src_cell
Returns

mapping between new cells and parent cells.

antares.utils.geomcut.tetrahedralizer.tri2tri(tri_conn)

Return a dummy subdivision for triangles.

antares.utils.geomcut.tetrahedralizer.qua2tri(qua_conn)

Subdivide quadrilateral cells into triangles.

Parameters

qua_conn – a quadrilateral cell-based connectivity

Returns

out_conn, src_cell

  • out_conn: the resulting triangular connectivity.

  • src_cell: the cell from which the new cell was generated.

antares.utils.geomcut.tetrahedralizer.tet2tet(tet_conn)

Return a dummy subdivision for tetrahedra.

antares.utils.geomcut.tetrahedralizer.pyr2tet(pyr_conn)

Subdivide pyramidal cells into tetrahedra.

Parameters

pyr_conn – a pyramidal cell-based connectivity.

Returns

out_conn, src_cell

  • out_conn: the resulting tetrahedral connectivity.

  • src_cell: the cell from which the new cell was generated.

antares.utils.geomcut.tetrahedralizer.pri2tet(pri_conn)

Subdivide prismatic cells into tetrahedra.

Parameters

pri_conn – a prismatic cell-based connectivity.

Returns

out_conn, src_cell

  • out_conn: the resulting tetrahedral connectivity.

  • src_cell: the cell from which the new cell was generated.

antares.utils.geomcut.tetrahedralizer.hex2tet(hex_conn)

Subdivide hexahedral cells into tetrahedra.

Parameters

hex_conn – a hexahedral cell-based connectivity.

Returns

out_conn, src_cell

  • out_conn: the resulting tetrahedral connectivity.

  • src_cell: the cell from which the new cell was generated.