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

Generate a boundary condition definition for a Block.

Given a 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 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.

block : Block
The geometry to generate boundary conditions for
entity : str
The openCARP boundary condition type to use (e.g. ‘stimulus’)
index : int
The boundary condition index
coord : str
The direction perpendicular to which the BC is generated. One of (‘x’, ‘y’, ‘z’).
lower : bool, optional
True if to generate BC at lower bound of coord (default), False for upper bound
bath : bool, 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
openCARP command line options to set up boundary condition.