Shell2D

class Shell2D(n_axe_1, n_axe_2, lims_u=(0.0, 1.0), lims_v=(0.0, 1.0))[source]

Bases: kokiy.shell.Shell

Abstract shell.

Parameters
  • n_axe_1 (int) – Number of x/longitudinal shell points.

  • n_axe_2 (int) – Number of y/azimuthal shell points.

shape

Shape of the shell: (n_axe_1, n_axe_2).

Type

array-like

rad

rad matrix of shape self.shape.

Type

numpy.ndarray

theta

theta matrix of shape self.shape.

Type

numpy.ndarray

x

x matrix of shape self.shape.

Type

numpy.ndarray

y

y matrix of shape self.shape.

Type

numpy.ndarray

z

z matrix of shape self.shape.

Type

numpy.ndarray

n_x

x-normal matrix of shape self.shape.

Type

numpy.ndarray

n_r

r-normal matrix of shape self.shape.

Type

numpy.ndarray

n_y

y-normal matrix of shape self.shape.

Type

numpy.ndarray

n_z

z-normal matrix of shape self.shape.

Type

numpy.ndarray

du

u-direction spacing matrix of shape self.shape.

Type

numpy.ndarray

dv

v-direction spacing matrix of shape self.shape.

Type

numpy.ndarray

u

u-direction adimensional matrix of shape self.shape.

Type

numpy.ndarray

v

v-direction adimensional matrix of shape self.shape.

Type

numpy.ndarray

abs_curv

Central curvilinear abscissa array of shape (self.shape[1],).

Type

numpy.ndarray

dwu

Weighted u-direction spacing matrix of shape self.shape.

Type

numpy.ndarray

dwv

Weighted v-direction spacing matrix of shape self.shape.

Type

numpy.ndarray

surf

Weighted surface matrix of shape self.shape.

Type

numpy.ndarray

Methods

__init__(n_axe_1, n_axe_2[, lims_u, lims_v])

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

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

Shell2D.__init__(n_axe_1, n_axe_2, lims_u=(0.0, 1.0), lims_v=(0.0, 1.0))[source]
Shell2D.add_curviwidth(label, points)[source]

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.

Shell2D.average_on_shell_over_dirs(variable, directions, scale=True)[source]

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

Shell2D.bake_millefeuille(width_matrix_label, n_layers, shift=0.0)[source]

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

Shell2D.dump(filename='shell', fields=None)[source]

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

Shell2D.dump_shell(name='shell', fields=None)[source]

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.

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

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

Shell2D.get_mesh(elem_type)

Returns a yamio.Mesh.

Shell2D.invert_normals()[source]

Invert directions of normal vectors.

Shell2D.operate_on_shell_over_dirs(variable, directions, operator=<function mean>)[source]

Applies an operator over one or multiple direction.

Notes

Directions are not commutative for non-linear operators.

Shell2D.plot(savefile=None)[source]

Plot 2D curve of the Shell.

Parameters

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

Shell2D.rad_theta_components(vect_y, vect_z)[source]

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

abstract Shell2D.replicate(shape)
Shell2D.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.