Recipes#
- sigmaepsilon.mesh.recipes.circular_disk(nangles: int, nradii: int, rmin: float, rmax: float, frame: CartesianFrame | None = None) TriMesh[source]#
Returns the triangulation of a circular disk.
- Parameters:
- Return type:
Examples
>>> from sigmaepsilon.mesh.recipes import circular_disk >>> mesh = circular_disk(120, 60, 5, 25)
- sigmaepsilon.mesh.recipes.circular_helix(a: Number | None = None, b: Number | None = None, *, slope: Number | None = None, pitch: Number | None = None) Callable[[Number], Tuple[float, float, float]][source]#
Returns the function \(f(t) = [a \cdot cos(t), a \cdot sin(t), b \cdot t]\), which describes a circular helix of radius a and slope a/b (or pitch 2πb).
- sigmaepsilon.mesh.recipes.cylinder(shape: Tuple[Tuple[Number, Number] | Number, Number], size: Tuple | float | int, *, voxelize: bool = False, celltype: PolyCellProtocol | None = None, frame: CartesianFrame | None = None) PolyData[source]#
Returns the coordinates and the topology of cylinder as numpy arrays.
- Parameters:
shape (Tuple[Tuple[Number, Number] | Number, Number]) – The parameter is a 2-tuple that describes the dimensions of the cylinder. The first element is either a number (radius), or a 2-tuple of numbers (inner and outer radii) describing the radius of the cylinder. The second element is the height of the cylinder.
size (Union[tuple, float, int]) –
Parameter controlling the resolution of the mesh. Default is None.
If voxelize is
False,sizemust be a tuple of three integers, describing the number of angular, radial, and vertical divions in this order.If voxelize is
Trueandsizeis afloat, the parameter controls the size of the individual voxels.If voxelize is
Trueandsizeis anint, the parameter controls the size of the individual voxels according to \(edge \, length = (r_{ext} - r_{int})/shape\).voxelize (bool, Optional) – If
True, the cylinder gets voxelized to a collection of H8 cells. In this case the size of a voxel can be controlled by specifying a flaot or an integer as the second parametersize. Default isFalse.celltype – Specifies the celltype to be used.
Example
>>> from sigmaepsilon.mesh.recipes import cylinder >>> n_angles = 30 # number of subdivions along the angular direction >>> n_radii = 15 # number of subdivisions along the radial direction >>> min_radius = 10 # minimum radius of the cylinder >>> max_radius = 25 # maximum radius of the cylinder >>> n_z = 20 # number of subdivisions along the z direction >>> h = 50 # height of the cylinder >>> shape = (min_radius, max_radius), h >>> size = n_radii, n_angles, n_z >>> mesh = cylinder(shape, size, voxelize=False)
- Return type:
- sigmaepsilon.mesh.recipes.perforated_cube(lx: float, ly: float, lz: float, radius: float, *, nangles: int | None = None, lmax: float | None = None, order: int = 1, prismatic: bool = True) PolyData[source]#
Returns a cube of side lengths ‘lx’, ‘ly’ and ‘lz’, with a circular hole along the ‘z’ axis.
- Return type:
- sigmaepsilon.mesh.recipes.ribbed_plate(lx: float, ly: float, t: float, *, wx: float | None = None, wy: float | None = None, hx: float | None = None, hy: float | None = None, ex: float | None = None, ey: float | None = None, lmax: float | None = None, order: int = 1, tetrahedralize: bool = False) PolyData[source]#
Creates a ribbed plate.
- Parameters:
lx (float) – The length of the plate along the X axis.
ly (float) – The length of the plate along the Y axis.
t (float) – The thickness of a plate.
wx (float, Optional) – The width of the ribs running in X direction. Must be defined alongside hx. Default is None.
hx (float, Optional) – The height of the ribs running in X direction. Must be defined alongside wx. Default is None.
ex (float, Optional) – The eccentricity of the ribs running in X direction.
wy (float, Optional) – The width of the ribs running in Y direction. Must be defined alongside hy. Default is None.
hy (float, Optional) – The height of the ribs running in Y direction. Must be defined alongside wy. Default is None.
ey (float, Optional) – The eccentricity of the ribs running in Y direction.
lmax (float, Optional) – Maximum edge length of the cells in the resulting mesh. Default is None.
order (int, Optional) – Determines the order of the cells used. Allowed values are 1 and 2. If order is 1, either H8 hexahedra or TET4 tetrahedra are returned. If order is 2, H27 hexahedra or TET10 tetrahedra are returned.
tetrahedralize (bool, Optional) – If True, a mesh of 4-noded tetrahedra is returned. Default is False.
Example
>>> from sigmaepsilon.mesh.recipes import ribbed_plate >>> mesh = ribbed_plate(lx=5.0, ly=5.0, t=1.0, ... wx=1.0, hx=2.0, ex=0.05, ... wy=1.0, hy=2.0, ey=-0.05)
- Return type:
- sigmaepsilon.mesh.recipes.sphere(radius: float, n_azimuthal_divisions: int, n_polar_divisions: int | None = None) PolyData[source]#
Generate a triangulated mesh representing a sphere.
- Parameters:
- Return type:
Notes
This function generates a triangulated mesh of a sphere using separate divisions for azimuthal and polar angles. The resulting mesh represents a sphere with given radius and resolution.
Examples
>>> from sigmaepsilon.mesh import PolyData >>> from sigmaepsilon.mesh.recipes import sphere >>> mesh: PolyData = sphere(1.0, 20, 10)