bempp.api.shapes

Define various test shapes.

Submodules

Package Contents

Functions

regular_sphere(refine_level)

Create a regular sphere with a given refinement level.

cube([length, origin, h])

Return a cube mesh.

multitrace_cube([h])

Definitition of a cube with an interface at z=.5.

reference_triangle()

Return a grid consisting of only the reference triangle.

sphere([r, origin, h])

Return a sphere grid.

ellipsoid([r1, r2, r3, origin, h])

Return an ellipsoid grid.

cuboid([length, origin, h])

Return a cuboid mesh.

almond([h])

Return the Nasa almond shape with element size h.

reentrant_cube([h, refinement_factor])

Create a reentrant corner in 3d.

screen(corners[, h])

Create a screen.

cylinders([h, z, r, origin, square])

Create a sequence of concentric cylindrical or cuboidal objects.

multitrace_ellipsoid([r1, r2, r3, origin, h])

Return an ellipsoid grid.

multitrace_sphere([r, origin, h])

Return a multitrace sphere grid.

bempp.api.shapes.regular_sphere(refine_level)

Create a regular sphere with a given refinement level.

Starting from an octahedron with 8 elements the grid is refined in each step by subdividing each element into four new elements, to create a sphere approximation.

The number of elements in the final sphere is given as 8 * 4**refine_level.

The maximum allowed refinement level is 9.

bempp.api.shapes.cube(length=1, origin=(0, 0, 0), h=0.1)

Return a cube mesh.

Parameters

lengthfloat

Side length of the cube.

origintuple

Coordinates of the origin (bottom left corner)

hfloat

Element size.

bempp.api.shapes.multitrace_cube(h=0.1)

Definitition of a cube with an interface at z=.5.

The normal direction at the interface shows into the positive z-direction and has the domain index and has the domain index 11. The lower half of the cube is given through the segments [1, 2, 3, 4, 5, 6]. The top half of the cube is defined by the segments [6, 7, 8, 9, 10, 11]. For the upper half the normal direction of segment 6 shows in the interior of the domain.

bempp.api.shapes.reference_triangle()

Return a grid consisting of only the reference triangle.

bempp.api.shapes.sphere(r=1, origin=(0, 0, 0), h=0.1)

Return a sphere grid.

Parameters

rfloat

Radius of the sphere.

origintuple

Center of the sphere.

hfloat

Element size.

bempp.api.shapes.ellipsoid(r1=1, r2=1, r3=1, origin=(0, 0, 0), h=0.1)

Return an ellipsoid grid.

Parameters

r1float

Radius of first major axis

r2float

Radius of second major axis

r3float

Radius of third major axis

origintuple

Tuple specifying the origin of the ellipsoid

hfloat

Element size.

bempp.api.shapes.cuboid(length=(1, 1, 1), origin=(0, 0, 0), h=0.1)

Return a cuboid mesh.

Parameters

lengthtuple

Side lengths of the cube.

origintuple

Coordinates of the origin (bottom left corner)

hfloat

Element size.

bempp.api.shapes.almond(h=0.01)

Return the Nasa almond shape with element size h.

bempp.api.shapes.reentrant_cube(h=0.1, refinement_factor=0.2)

Create a reentrant corner in 3d.

Parameters

hfloat

Element size.

refinement_factorfloat

Fractional size with respect to h of elements close to reentrant corner.

bempp.api.shapes.screen(corners, h=0.1)

Create a screen.

Parameters

cornersnp.ndarray

A (4 x 3) array that defines four corners of the screen.

hfloat

A floating point number specifying the grid size.

Output

gridbempp.Grid

A structured grid.

bempp.api.shapes.cylinders(h=1.0, z=1.0, r=[0.5, 1, 1.5, 1.7], origin=(0.0, 0.0, 0.0), square=False)

Create a sequence of concentric cylindrical or cuboidal objects.

Parameters

hfloat

A floating point number specifying the grid size.

zfloat

A floating point number specifying the extrusion parameter along z-axis.

rincreasing sequence of floats

A sequence definying the radius of each concentric cylinder.

origin: tuple of floats

The centre of the base of the cylinder.

square: boolean

Specifies whether the cylindrical shape is a sequence of squares or circles

Output

gridbempp.Grid

A structured grid.

bempp.api.shapes.multitrace_ellipsoid(r1=1, r2=1, r3=1, origin=(0, 0, 0), h=0.1)

Return an ellipsoid grid.

Parameters

r1float

Radius of first major axis

r2float

Radius of second major axis

r3float

Radius of third major axis

origintuple

Tuple specifying the origin of the ellipsoid

hfloat

Element size.

bempp.api.shapes.multitrace_sphere(r=1, origin=(0, 0, 0), h=0.1)

Return a multitrace sphere grid.

Parameters

rfloat

Radius of the sphere.

origintuple

Center of the sphere.

hfloat

Element size.