carputils
Doxygen code documentation for the python framework controlling openCARP
Public Member Functions | List of all members
carputils.mesh.ring.Ring Class Reference

Generate a mesh of a ring/cylindrical shell. More...

Inheritance diagram for carputils.mesh.ring.Ring:
carputils.mesh.general.Mesh3D carputils.mesh.general.Mesh

Public Member Functions

def __init__ (self, radius, thickness=None, height=None, div_transmural=1, div_circum=None, div_height=1, args, kwargs)
 
def with_resolution (cls, radius, resolution, height=None, wallthickness=None, kwargs)
 Simplified interface to generate ring with target resolution. More...
 
def cavity_volume (self)
 Calculate the volume of the cavity analytically. More...
 
- Public Member Functions inherited from carputils.mesh.general.Mesh3D
def __init__ (self, fibre_rule=lambda t:0.0, fibre_rule_2=None, tetrahedrise=True)
 
def elements (self)
 Generate and return array of element point indices. More...
 
def faces (self, selection, return_elem=False)
 Generate an array of faces on the specified surface. More...
 
def n_face (self, surface)
 Return the number of faces in a given surface. More...
 
def face_centres (self, selection)
 Calculate the centroids of faces on the specified surface. More...
 
def face_normals (self, selection, unit=True)
 Calculate the normals to faces on the specified surface. More...
 
def face_areas (self, selection)
 Calculate the areas of faces on the specified surface. More...
 
def generate_cyl_coords (self, filename)
 Generate cylindrical coordinate field for the mesh. More...
 
def generate_carp (self, meshname, faces=[])
 Generate the mesh and store it to disk in openCARP format. More...
 
def generate_carp_rigid_dbc (self, basename)
 Generate files for DBC definiton preventing free motion. More...
 
def generate_vtk_face (self, filename, selection)
 Generate VTK file of selected face. More...
 
- Public Member Functions inherited from carputils.mesh.general.Mesh
def __init__ (self)
 
def add_region (self, tag, func)
 Add a new tag region. More...
 
def points (self)
 Generate and return numpy array of point coordinates. More...
 
def n_pts (self)
 Return the number of points/nodes in the mesh. More...
 
def elements (self)
 Generate and return list of numpy arrays of element node indices. More...
 
def n_elem (self)
 Count and return the total number of elements in the mesh. More...
 
def element_centres (self)
 Calculate the centroids of the mesh elements. More...
 
def element_tags (self)
 Determine element tags based on rules passed to :meth:add_region. More...
 
def fibres (self)
 Generate numpy array of fibre vectors and return. More...
 
def generate_carp (self, meshname)
 Generate the mesh and store it to disk in openCARP format. More...
 
def generate_vtk (self, filename)
 Generate VTK file of mesh. More...
 

Detailed Description

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)

:func: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 :meth:generate_carp and :meth:generate_vtk methods.

Parameters
radiusfloat Inner radius of the ring, in mm
thicknessfloat, optional Radial thickness of the ring, in mm, defaults to 1/5 inner radius
heightfloat, optional Height of the ring, in mm, by default set to a size to regularise aspect ratio
div_transmuralint, optional Number of elements across the radial thickness, defaults to 1
div_circumint, optional Number of elements around the full circle of the ring, defaults to a number regularising the hexahedron aspects
div_heightint, optional Number of elements across the height of the ring, defaults to 1
tetrahedrisebool, optional True to subdivide the mesh into tetrahedra
fibre_rulecallable, 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

Constructor & Destructor Documentation

◆ __init__()

def carputils.mesh.ring.Ring.__init__ (   self,
  radius,
  thickness = None,
  height = None,
  div_transmural = 1,
  div_circum = None,
  div_height = 1,
  args,
  kwargs 
)

Member Function Documentation

◆ cavity_volume()

def carputils.mesh.ring.Ring.cavity_volume (   self)

Calculate the volume of the cavity analytically.

The actual volume may be less due to discretisation effects.

Returns
float The cavity volume

◆ with_resolution()

def carputils.mesh.ring.Ring.with_resolution (   cls,
  radius,
  resolution,
  height = None,
  wallthickness = None,
  kwargs 
)

Simplified interface to generate ring with target resolution.

Parameters
radiusfloat Inner radius of ellipsoid cavity
resolutionfloat Target mesh edge length
heightfloat, optional Vertical thickness of ring (default: radius/10)
wallthicknessfloat, optional Thickness of ellipsoid wall (default: radius/5)

The documentation for this class was generated from the following file: