carputils.mesh.Ring

class carputils.mesh.Ring(radius, thickness=None, height=None, div_transmural=1, div_circum=None, div_height=1, *args, **kwargs)

Generate a mesh of a ring/cylindrical shell.

This class describes a tissue ring, and generates the described mesh. For example, to define a ring with a 5mm internal radius:

>>> geom = Ring(5)

By default, the thickness of the ring is 1/5 of the radius, and the height is the same as the thickness. These can be controlled exactly with the corresponding paramters:

>>> geom = Ring(5, thickness=0.5, height=0.7)

Discretisation of the ring is done into hexahedra, with one hex across both the thickness and height. The circumferential discretisation is chosen to ensure as regular aspect hexahedra as possible. If a tetrahedral mesh is generated, these hexahedra are further subdivided into tets. Discretisation can be controlled with the division div_ parameters:

>>> geom = Ring(5, 2, 0.7, div_transmural=3)

The ring’s fibre directions are, by default, oriented in the circumferential direction. To control the fibre direction, pass a function as the fibre_rule argument that itself takes a normalised transmural distance and returns a helix angle in radians:

>>> rule = lambda t: (1 - t)/2
>>> geom = Ring(5, 2, 0.7, fibre_rule=rule)

carputils.mesh.ring.linear_fibre_rule() provides a convenient method to generate such rules. For example, to generate a +60/-60 degrees linear fibre rule:

>>> rule = linear_fibre_rule(60, -60)
>>> geom = Ring(5, 2, 7, fibre_rule=rule)

To generate the actual mesh, use the generate_carp() and generate_vtk() methods.

Args:
radius : float
Inner radius of the ring, in mm
thickness : float, optional
Radial thickness of the ring, in mm, defaults to 1/5 inner radius
height : float, optional
Height of the ring, in mm, by default set to a size to regularise aspect ratio
div_transmural : int, optional
Number of elements across the radial thickness, defaults to 1
div_circum : int, optional
Number of elements around the full circle of the ring, defaults to a number regularising the hexahedron aspects
div_height : int, optional
Number of elements across the height of the ring, defaults to 1
tetrahedrise : bool, optional
True to subdivide the mesh into tetrahedra
fibre_rule : callable, optional
Function describing the transmural variation of fibre angle, takes a single normalised transmural distance on [0,1] and returns a helix angle in radians, defaults to circumferentially oriented fibres
cavity_volume()

Calculate the volume of the cavity analytically.

The actual volume may be less due to discretisation effects.

Returns:
float
The cavity volume
classmethod with_resolution(radius, resolution, height=None, wallthickness=None, **kwargs)

Simplified interface to generate ring with target resolution.

Args:
radius : float
Inner radius of ellipsoid cavity
resolution : float
Target mesh edge length
height : float, optional
Vertical thickness of ring (default: radius/10)
wallthickness : float, optional
Thickness of ellipsoid wall (default: radius/5)