discretisedfield.tools.max_neighbouring_cell_angle#
- discretisedfield.tools.max_neighbouring_cell_angle(field, /, units='rad')#
Calculate maximum angle between neighbouring cells in all directions.
This function computes an angle between a cell and all its six neighbouring cells and assigns the maximum to that cell. The calculation is only possible for vector fields of three dimensions (i.e.
nvdim=3
). Angles are computed in degrees ifunits='deg'
and in radians ifunits='rad'
.The resulting field has one discretisation cell less in the specified direction.
- Parameters:
field (discretisedfield.Field) – Vector field.
units (str, optional) – Angles are computed in degrees if
units='deg'
and in radians ifunits='rad'
. Defaults to'rad'
.
- Returns:
A scalar field with maximum angles.
- Return type:
Examples
Computing the maximum angle between neighbouring cells.
>>> import discretisedfield as df >>> import discretisedfield.tools as dft ... >>> p1 = (0, 0, 0) >>> p2 = (100, 100, 100) >>> n = (10, 10, 10) >>> mesh = df.Mesh(p1=p1, p2=p2, n=n) >>> field = df.Field(mesh, nvdim=3, value=(0, 1, 0)) ... >>> dft.max_neighbouring_cell_angle(field) Field(...)