CartShell

class CartShell(n_trans, n_longi, zero, umax, vmax)[source]

Bases: kokiy.shell_2d.Shell2D

Base class for cartesian computational shells.

Some attributes are based on u and v, defined as the curvilinear longitudinal (u) abscissa and curvilinear transversal (v) abscissa respectively.

The shell is set using three corners (assuming they are orthogonal).

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

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

  • zero (numpy.ndarray) – Lower left corner of shell of shape (3,).

  • umax (numpy.ndarray) – Corner of shell for umax of shape (3,).

  • vmax (numpy.ndarray) – corner of shell for vmax of shape (3,).

X umax
________________
|              |            Cartesian system
|              |            Example longi/u <=> x  and v <==> z
|              |            zero. (0, 0, 0)
|              |            umax. (1, 0, 0)
|              |            vmax. (0, 0, 1)
|              |            x - longi/u
|              |            ^
|              |            |
|              |            |
|              |            O-----> z - transvers/v
|______________| X vmax     y
X zero.

Methods

__init__(n_trans, n_longi, zero, umax, vmax)

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)

Creates a similar instance, but possibly with different 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

CartShell.__init__(n_trans, n_longi, zero, umax, vmax)[source]
CartShell.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.

CartShell.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

CartShell.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!”

CartShell.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).

CartShell.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.

CartShell.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.

CartShell.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.

CartShell.get_mesh(elem_type)

Returns a yamio.Mesh.

CartShell.invert_normals()

Invert directions of normal vectors.

CartShell.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.

CartShell.plot(savefile=None)

Plot 2D curve of the Shell.

Parameters

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

CartShell.rad_theta_components(vect_y, vect_z)

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

CartShell.replicate(shape)[source]

Creates a similar instance, but possibly with different shape.

CartShell.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.