carputils
Doxygen code documentation for the python framework controlling openCARP
|
Generate a pipe mesh or a pipe-segment mesh. More...
Public Member Functions | |
def | __init__ (self, radius, thickness=None, length=None, div_wall=1, div_circum=None, div_length=100, angle=None, args, kwargs) |
def | with_resolution (cls, radius, resolution, length=None, thickness=None, angle=None, kwargs) |
Simplified interface to generate pipe with target resolution. More... | |
def | is_segment (self) |
def | cavity_volume (self) |
Calculate the volume of the cavity analytically. More... | |
![]() | |
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... | |
![]() | |
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... | |
Generate a pipe mesh or a pipe-segment mesh.
This class describes a pipe, and generates the described mesh. For example, to define a pipe with a 5mm internal radius and 5mm rim:
By default, the thickness of the pipe is 1/10 of the radius, and the rim length is the same as the thickness and the pipe length is 100 times the thickmess. These can be controlled exactly with the corresponding paramters:
Discretisation of the pipe is done into hexahedra, with one hex across both the thickness and length. 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:
The pipe'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:
:func:carputils.mesh.pipe.linear_fibre_rule
provides a convenient method to generate such rules. For example, to generate a +60/-60 degrees linear fibre rule:
To generate the actual mesh, use the :meth:generate_carp
and :meth:generate_vtk
methods.
radius | float Inner radius of the pipe, in mm |
thickness | float, optional Radial thickness of the pipe, in mm, defaults to 1/10 inner radius |
length | float, optional Length of the pipe, in mm, by default 100 times the thickness |
div_wall | 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 pipe, defaults to a number regularising the hexahedron aspects |
div_legnth | int, optional Number of elements across the length of the pipe, defaults to 100 |
angle | float, optional Central angle of the segment in (0, 2*PI) |
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 |
def carputils.mesh.pipe.Pipe.__init__ | ( | self, | |
radius, | |||
thickness = None , |
|||
length = None , |
|||
div_wall = 1 , |
|||
div_circum = None , |
|||
div_length = 100 , |
|||
angle = None , |
|||
args, | |||
kwargs | |||
) |
def carputils.mesh.pipe.Pipe.cavity_volume | ( | self | ) |
Calculate the volume of the cavity analytically.
The actual volume may be less due to discretisation effects.
def carputils.mesh.pipe.Pipe.is_segment | ( | self | ) |
def carputils.mesh.pipe.Pipe.with_resolution | ( | cls, | |
radius, | |||
resolution, | |||
length = None , |
|||
thickness = None , |
|||
angle = None , |
|||
kwargs | |||
) |
Simplified interface to generate pipe with target resolution.
radius | float Inner radius of ellipsoid cavity |
resolution | float Target mesh edge length |
length | float, optional Length of the pipe (default: 100 radius/10) |
thickness | float, optional Thickness of pipe wall (default: radius/5) |
angle | float, optional Central angle of the segment (default: None) |