carputils
Doxygen code documentation for the python framework controlling openCARP
Classes | Functions
carputils.mesh.block Namespace Reference

Classes

class  Block
 Generate a block mesh with the mesher command line utility. More...
 

Functions

def block_boundary_condition (block, entity, index, coord, lower=True, bath=False, verbose=False)
 Generate a boundary condition definition for a :class:Block. More...
 
def block_bc_opencarp (block, entity, index, coord, lower=True, bath=False, verbose=False)
 Does the same thing as block_boundary_condition, but for the new stim struct introduced in openCARP. More...
 
def block_region (block, entity, index, low, up, bath=False, verbose=False)
 Generate a boundary condition definition for a :class:Block. More...
 

Function Documentation

◆ block_bc_opencarp()

def carputils.mesh.block.block_bc_opencarp (   block,
  entity,
  index,
  coord,
  lower = True,
  bath = False,
  verbose = False 
)

Does the same thing as block_boundary_condition, but for the new stim struct introduced in openCARP.

Given a :class:Block, generate a set of openCARP options defining a boundary condition on one of the faces of the mesh. The face at the lower or upper bound of the specified coordinate is 'encased' in a box surrounding the selected surface at half its resolution.

Parameters
blockBlock The geometry to generate boundary conditions for
entitystr The openCARP boundary condition type to use (e.g. 'stimulus')
indexint The boundary condition index
coordstr The direction perpendicular to which the BC is generated. One of ('x', 'y', 'z').
lowerbool, optional True if to generate BC at lower bound of coord (default), False for upper bound
bathbool, optional Generate BC at bounds of tissue+bath if True, tissue only otherwise
(default)
verbose : bool, optional True to print summary of generated parameters to stdout
Returns
list openCARP command line options to set up boundary condition.

◆ block_boundary_condition()

def carputils.mesh.block.block_boundary_condition (   block,
  entity,
  index,
  coord,
  lower = True,
  bath = False,
  verbose = False 
)

Generate a boundary condition definition for a :class:Block.

Given a :class:Block, generate a set of openCARP options defining a boundary condition on one of the faces of the mesh. The face at the lower or upper bound of the specified coordinate is 'encased' in a box surrounding the selected surface at half its resolution.

For example, for the default origin-centred box of size (1,1,1) and resolution 0.1:

>>> geom = Block()

calling :func:block_boundary_condition with coord='x' and lower=False:

>>> block_boundary_condition(geom, 'stimulus', 0, 'x', False)

will generate a BC for 0.45<=x<=0.55, -0.55<=y<=0.55 and -0.55<=z<=0.55.

Parameters
blockBlock The geometry to generate boundary conditions for
entitystr The openCARP boundary condition type to use (e.g. 'stimulus')
indexint The boundary condition index
coordstr The direction perpendicular to which the BC is generated. One of ('x', 'y', 'z').
lowerbool, optional True if to generate BC at lower bound of coord (default), False for upper bound
bathbool, optional Generate BC at bounds of tissue+bath if True, tissue only otherwise
(default)
verbose : bool, optional True to print summary of generated parameters to stdout
Returns
list openCARP command line options to set up boundary condition.

◆ block_region()

def carputils.mesh.block.block_region (   block,
  entity,
  index,
  low,
  up,
  bath = False,
  verbose = False 
)

Generate a boundary condition definition for a :class:Block.

Given a :class:Block, generate a set of openCARP options defining a block-shaped region on a given domain low and up specify lower and upper coordinates of the block region.

For example, for the default origin-centred box of size (1,1,1) and resolution 0.1:

>>> geom = Block()

calling :func:block_region with low ='[-0.5, -0.5 -0.5]' and up='[0.0, 0.0, 0.0]':

>>> block_region(geom, 'stimulus', 0, low, up, False)

will generate a stimulus block definition for -0.5<=x<=0., -0.5<=y<=0. and -0.5<=z<=0.0.

Parameters
blockBlock The geometry to generate boundary conditions for
entitystr The openCARP boundary condition type to use (e.g. 'stimulus')
indexint The boundary condition index
lowarray x, y and z coordinate of lower left corner of block region
uparray x, y and z coordinate of upper right corner of block region
bathbool, optional Generate BC at bounds of tissue+bath if True, tissue only otherwise
(default)
verbose : bool, optional True to print summary of generated parameters to stdout
Returns
list openCARP command line options to set up boundary condition.