flow360.Box#

class Box[source]#

Bases: MultiConstructorBaseModel, _VolumeEntityBase

Box class represents a box in three-dimensional space.

Example

>>> fl.Box(
...     name="box",
...     axis_of_rotation = (1, 0, 0),
...     angle_of_rotation = 45 * fl.u.deg,
...     center = (1, 1, 1) * fl.u.m,
...     size=(0.2, 0.3, 2) * fl.u.m,
... )

Define a box using principal axes:

>>> fl.Box.from_principal_axes(
...     name="box",
...     axes=[(0, 1, 0), (0, 0, 1)],
...     center=(0, 0, 0) * fl.u.m,
...     size=(0.2, 0.3, 2) * fl.u.m,
... )

type_name: Literal['Box'] = 'Box'#
center: Annotated[_VectorType, PlainSerializer(func=_dimensioned_type_serializer, return_type=PydanticUndefined, when_used=always)] [Required]#

The coordinates of the center of the box.

Constraints:
  • func = <function _dimensioned_type_serializer at 0x79c44aad7130>

  • return_type = PydanticUndefined

  • when_used = always

size: Annotated[_VectorType, PlainSerializer(func=_dimensioned_type_serializer, return_type=PydanticUndefined, when_used=always)] [Required]#

The dimensions of the box (length, width, height).

Constraints:
  • func = <function _dimensioned_type_serializer at 0x79c44aad7130>

  • return_type = PydanticUndefined

  • when_used = always

axis_of_rotation: Axis = (0, 0, 1)#

The rotation axis. Cannot change once specified.

angle_of_rotation: Annotated[_AngleType, PlainSerializer(func=_dimensioned_type_serializer, return_type=PydanticUndefined, when_used=always)] = unyt_quantity(0, 'degree')#

The rotation angle. Cannot change once specified.

Constraints:
  • func = <function _dimensioned_type_serializer at 0x79c44aad7130>

  • return_type = PydanticUndefined

  • when_used = always

classmethod from_principal_axes(name, center, size, axes, **kwargs)[source]#

Construct box from principal axes

Parameters:
  • name (str)

  • center (Annotated[_VectorType, PlainSerializer(func=~flow360.component.simulation.unit_system._dimensioned_type_serializer, return_type=PydanticUndefined, when_used=always)])

  • size (Annotated[_VectorType, PlainSerializer(func=~flow360.component.simulation.unit_system._dimensioned_type_serializer, return_type=PydanticUndefined, when_used=always)])

  • axes (Annotated[Tuple[Axis, Axis], AfterValidator(func=~flow360.component.simulation.primitives._check_axis_is_orthogonal)])

property axes#

Return the axes that the box is aligned with.