sfepy.mesh.mesh_generators module

sfepy.mesh.mesh_generators.gen_block_mesh(dims, shape, centre, mat_id=0, name=’block’, coors=None, verbose=True)[source]

Generate a 2D or 3D block mesh. The dimension is determined by the lenght of the shape argument.

Parameters:
dims : array of 2 or 3 floats

Dimensions of the block.

shape : array of 2 or 3 ints

Shape (counts of nodes in x, y, z) of the block mesh.

centre : array of 2 or 3 floats

Centre of the block.

mat_id : int, optional

The material id of all elements.

name : string

Mesh name.

verbose : bool

If True, show progress of the mesh generation.

Returns:
mesh : Mesh instance
sfepy.mesh.mesh_generators.gen_cylinder_mesh(dims, shape, centre, axis=’x’, force_hollow=False, is_open=False, open_angle=0.0, non_uniform=False, name=’cylinder’, verbose=True)[source]

Generate a cylindrical mesh along an axis. Its cross-section can be ellipsoidal.

Parameters:
dims : array of 5 floats

Dimensions of the cylinder: inner surface semi-axes a1, b1, outer surface semi-axes a2, b2, length.

shape : array of 3 ints

Shape (counts of nodes in radial, circumferential and longitudinal directions) of the cylinder mesh.

centre : array of 3 floats

Centre of the cylinder.

axis: one of ‘x’, ‘y’, ‘z’

The axis of the cylinder.

force_hollow : boolean

Force hollow mesh even if inner radii a1 = b1 = 0.

is_open : boolean

Generate an open cylinder segment.

open_angle : float

Opening angle in radians.

non_uniform : boolean

If True, space the mesh nodes in radial direction so that the element volumes are (approximately) the same, making thus the elements towards the outer surface thinner.

name : string

Mesh name.

verbose : bool

If True, show progress of the mesh generation.

Returns:
mesh : Mesh instance
sfepy.mesh.mesh_generators.gen_extended_block_mesh(b_dims, b_shape, e_dims, e_shape, centre, grading_fun=None, name=None)[source]

Generate a 3D mesh with a central block and (coarse) extending side meshes.

The resulting mesh is again a block. Each of the components has a different material id.

Parameters:
b_dims : array of 3 floats

The dimensions of the central block.

b_shape : array of 3 ints

The shape (counts of nodes in x, y, z) of the central block mesh.

e_dims : array of 3 floats

The dimensions of the complete block (central block + extensions).

e_shape : int

The count of nodes of extending blocks in the direction from the central block.

centre : array of 3 floats

The centre of the mesh.

grading_fun : callable, optional

A function of x \in [0, 1] that can be used to shift nodes in the extension axis directions to allow smooth grading of element sizes from the centre. The default function is x**p with p determined so that the element sizes next to the central block have the size of the shortest edge of the central block.

name : string, optional

The mesh name.

Returns:
mesh : Mesh instance
sfepy.mesh.mesh_generators.gen_mesh_from_geom(geo, a=None, verbose=False, refine=False)[source]

Runs mesh generator - tetgen for 3D or triangle for 2D meshes.

Parameters:
geo : geometry

geometry description

a : int, optional

a maximum area/volume constraint

verbose : bool, optional

detailed information

refine : bool, optional

refines mesh

Returns:
mesh : Mesh instance

triangular or tetrahedral mesh

sfepy.mesh.mesh_generators.gen_mesh_from_string(mesh_name, mesh_dir)[source]
sfepy.mesh.mesh_generators.gen_mesh_from_voxels(voxels, dims, etype=’q’)[source]

Generate FE mesh from voxels (volumetric data).

Parameters:
voxels : array

Voxel matrix, 1=material.

dims : array

Size of one voxel.

etype : integer, optional

‘q’ - quadrilateral or hexahedral elements ‘t’ - triangular or tetrahedral elements

Returns
——-
mesh : Mesh instance

Finite element mesh.

sfepy.mesh.mesh_generators.gen_misc_mesh(mesh_dir, force_create, kind, args, suffix=’.mesh’, verbose=False)[source]

Create sphere or cube mesh according to kind in the given directory if it does not exist and return path to it.

sfepy.mesh.mesh_generators.gen_tiled_mesh(mesh, grid=None, scale=1.0, eps=1e-06, ret_ndmap=False)[source]

Generate a new mesh by repeating a given periodic element along each axis.

Parameters:
mesh : Mesh instance

The input periodic FE mesh.

grid : array

Number of repetition along each axis.

scale : float, optional

Scaling factor.

eps : float, optional

Tolerance for boundary detection.

ret_ndmap : bool, optional

If True, return global node map.

Returns:
mesh_out : Mesh instance

FE mesh.

ndmap : array

Maps: actual node id –> node id in the reference cell.

sfepy.mesh.mesh_generators.get_tensor_product_conn(shape)[source]

Generate vertex connectivity for cells of a tensor-product mesh of the given shape.

Parameters:
shape : array of 2 or 3 ints

Shape (counts of nodes in x, y, z) of the mesh.

Returns:
conn : array

The vertex connectivity array.

desc : str

The cell kind.

sfepy.mesh.mesh_generators.main()[source]
sfepy.mesh.mesh_generators.tiled_mesh1d(conn, coors, ngrps, idim, n_rep, bb, eps=1e-06, ndmap=False)[source]