carputils
Doxygen code documentation for the python framework controlling openCARP
All Classes Namespaces Files Functions Variables Properties Pages
Public Member Functions | List of all members
carputils.mesh.grid.Grid Class Reference

Generate a two dimensional mesh of a regular grid. More...

Inheritance diagram for carputils.mesh.grid.Grid:
carputils.mesh.general.Mesh2D carputils.mesh.general.Mesh

Public Member Functions

def __init__ (self, lowerleft, upperright, resolution=0.1, fibres=(1.0, 0.0), triangulate=False)
 
- Public Member Functions inherited from carputils.mesh.general.Mesh2D
def __init__ (self, triangulate=False)
 
def elements (self)
 Generate and return array of element point indices. 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 two dimensional mesh of a regular grid.

The generated mesh is aligned along the x-y plane, with z set to 0. Nodes are arranged on a regularly spaced grid and connected by quad elements. The mesh is defined by the x,y coordinates of the lower left and upper right corners and the mesh resolution, in mm.

To generate a mesh from 0,0 to 10,10, with 0.1mm spacing:

>>> geom = Grid((0,0), (10,10), 0.1)
>>> geom.generate_carp('mesh/grid')

Constant fibre vectors are set by the fibres optional command line argument, which defaults to be aligned with the positive x direction. The mesh may also be triangulated by use of the triangulate argument.

For more information on defining mesh regions etc., please see the
:ref:`mesh_generation` section of the documentation.
Parameters
lowerleftarray-like The lower left (x,y) coordinate of the mesh, in mm
upperrightarray-like The upper right (x,y) coordinate of the mesh, in mm
resolutionfloat or array-like, optional The resolution of the mesh in mm, either as a scalar for the same in both directions or as a list or array when in 2 directions, defaults to
0.1
fibresarray-like, optional Specify a fibre vector, defaults to (1.0, 0.0)

Constructor & Destructor Documentation

◆ __init__()

def carputils.mesh.grid.Grid.__init__ (   self,
  lowerleft,
  upperright,
  resolution = 0.1,
  fibres = (1.0, 0.0),
  triangulate = False 
)

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