FrustumShell

class FrustumShell(n_azi, n_longi, pt_left, pt_right, radius_left, radius_right, direc_pt=None)[source]

Bases: kokiy.shell_2d.Shell2D

A frustum computational shell.

Parameters
  • n_azi (int) – Number of azimuthal shell points.

  • n_longi (int) – Number of longitudinal shell points.

  • pt_left (numpy.ndarray) – coordinates of left circle’s center.

  • pt_right (numpy.ndarray) – coordinates of right circle’s center.

  • radius_left (float) – left circle’s radius.

  • radius_right (float) – right circle’s radius.

  • direc_pt (numpy.ndarray) – defines theta = 0 direction

Methods

__init__(n_azi, n_longi, pt_left, pt_right, ...)

add_curviwidth(label, points)

Add a 2D width matrix of shell shape extruded from points spline.

average_on_shell_over_dirs(variable, directions)

Performs an integration (average) over one or multiple directions.

bake_millefeuille(width_matrix_label, n_layers)

Create a millefeuille-like shell.

dump([filename, fields])

Dump shell geometrical and physical properties into hdf file.

dump_shell([name, fields])

Dump shell geometrical properties into hdf file.

export_geo(filename[, show_all])

Exports simplified boundary representation for visualization.

export_mesh(filename, elem_type, **kwargs)

Exports mesh.

get_mesh(elem_type)

Returns a yamio.Mesh.

invert_normals()

Invert directions of normal vectors.

operate_on_shell_over_dirs(variable, directions)

Applies an operator over one or multiple direction.

plot([savefile])

Plot 2D curve of the Shell.

rad_theta_components(vect_y, vect_z)

Computes the radial and azimuthal components of a vect y, z.

replicate(shape)

set_mask_on_shell(point_cloud, tol)

Create a mask on the shell from a point cloud.

Attributes

geom_type

n_xyz

Normals with same shape as xyz.

u_adim

Deprecated since version 0.2.0.

uv

uv matrix of shape self.shape.

v_adim

Deprecated since version 0.2.0.

xyz

xyz matrix of shape (*self.shape, 3).

Methods

FrustumShell.__init__(n_azi, n_longi, pt_left, pt_right, radius_left, radius_right, direc_pt=None)[source]
FrustumShell.add_curviwidth(label, points)

Add a 2D width matrix of shell shape extruded from points spline.

Parameters
  • label (str) – Label of the width matrix.

  • points (array-like) – Coordinates with shape (n, 2).

Notes

This method makes this object stateful. Avoid it if you can.

FrustumShell.average_on_shell_over_dirs(variable, directions, scale=True)

Performs an integration (average) over one or multiple directions.

Parameters
  • variable (numpy.ndarray) – Data to be averaged of shape (n_time, n_v, n_u).

  • directions (array-like) – A list() of directions on which the average process is to be performed. Contains keywords from [‘time’, ‘v’, ‘u’].

  • scale (bool) – Keeps nominal averaging (if False) or takes into account surface element (if True).

Returns

Averaged data on given directions.

Return type

np.array

FrustumShell.bake_millefeuille(width_matrix_label, n_layers, shift=0.0)

Create a millefeuille-like shell.

Extrude a 2D shell in the normal direction up pointwise height given by “width_matrix_label” matrix.

Parameters
  • width_matrix_label (str) – Label of the width matrix.

  • n_layers (int) – Number of layer for extrusion.

  • shift (float) – Additional depth.

Returns

ThickShell

Notes

Use Thickshell.bake_from_shell when possible.

“Bon appetit!”

FrustumShell.dump(filename='shell', fields=None)

Dump shell geometrical and physical properties into hdf file.

Parameters
  • filename (str) – Name of the file to dump.

  • fields (dict) – Additional fields to dump. (key, np.array).

FrustumShell.dump_shell(name='shell', fields=None)

Dump shell geometrical properties into hdf file.

Parameters
  • name (str) – Name of the file to dump. Default ‘shell’.

  • fields (dict) – Additional fields to dump. (key, np.array).

Deprecated since version 0.2.0: Use dump instead.

FrustumShell.export_geo(filename, show_all=False, **kwargs)

Exports simplified boundary representation for visualization.

Uses ensight gold format.

Parameters
  • show_all (bool) – Show all boundary edges?

  • kwargs – will be passed to writer.write method.

Notes

If goal is to proper export original mesh use export_mesh.

FrustumShell.export_mesh(filename, elem_type, **kwargs)

Exports mesh.

Parameters
  • filename (str) – file name. Extension guides file type (any acceptable by yamio).

  • elem_type (str) – ‘tri’, ‘quad’, ‘tetra’, ‘hexahedron’.

  • kwargs – will be passed to writer.write method.

Notes

hip does not allow 3d surface meshes.

FrustumShell.get_mesh(elem_type)

Returns a yamio.Mesh.

FrustumShell.invert_normals()[source]

Invert directions of normal vectors.

FrustumShell.operate_on_shell_over_dirs(variable, directions, operator=<function mean>)

Applies an operator over one or multiple direction.

Notes

Directions are not commutative for non-linear operators.

FrustumShell.plot(savefile=None)

Plot 2D curve of the Shell.

Parameters

savefile (str) – filename. If None, the figure is only plotted.

FrustumShell.rad_theta_components(vect_y, vect_z)

Computes the radial and azimuthal components of a vect y, z.

FrustumShell.replicate(shape)[source]
FrustumShell.set_mask_on_shell(point_cloud, tol)

Create a mask on the shell from a point cloud.

Parameters
  • point_cloud (numpy.ndarray) – Coordinates with shape (n, 3).

  • tol (float) – Tolerance.

Notes

The mask value is 0 for shell points located near cloud points. Otherwise the mask value is 1.