Skip to content

Boundary Configuration

FluxRender.physics.BoundaryConfiguration

BoundaryConfiguration(boundary_type: BoundaryType, inflow_velocity_x: float = 0.03, inflow_velocity_y: float = 0.0)

Defines the physical behavior of a specific perimeter edge in the fluid domain.

Determines exactly how the fluid interacts with the extreme edges of the sandbox. You can configure the boundaries to act as impenetrable walls, continuous wind tunnels (inflow/outflow streams), or seamless periodic spaces (Pac-Man style topology wrapping).

Parameters:

Name Type Description Default
boundary_type BoundaryType

The designated fluid behavior for this boundary edge (e.g., BoundaryType.SOLID_WALL, BoundaryType.PERIODIC, BoundaryType.VELOCITY_INFLOW).

required
inflow_velocity_x float

The horizontal velocity of the fluid entering the domain. Only evaluated if the type is VELOCITY_INFLOW. It is strictly clamped to a mathematically safe limit to prevent LBM Mach-number instability.

0.03
inflow_velocity_y float

The vertical velocity of the fluid entering the domain. Only evaluated if the type is VELOCITY_INFLOW.

0.0
Source code in FluxRender/physics.py
def __init__(
    self,
    boundary_type: BoundaryType,
    inflow_velocity_x: float = 0.03,
    inflow_velocity_y: float = 0.0
):
    """
    Args:
        boundary_type (BoundaryType): The designated fluid behavior for this boundary edge
            (e.g., BoundaryType.SOLID_WALL, BoundaryType.PERIODIC, BoundaryType.VELOCITY_INFLOW).
        inflow_velocity_x (float, optional): The horizontal velocity of the fluid entering the domain.
            Only evaluated if the type is VELOCITY_INFLOW. It is strictly clamped to a mathematically
            safe limit to prevent LBM Mach-number instability.
        inflow_velocity_y (float, optional): The vertical velocity of the fluid entering the domain.
            Only evaluated if the type is VELOCITY_INFLOW.
    """

    self.boundary_type = boundary_type

    # We silently enforce the LBM Mach limit to protect the user from numerical explosions
    maximum_safe_velocity = 0.08

    self.inflow_velocity_x = max(-maximum_safe_velocity, min(inflow_velocity_x, maximum_safe_velocity))
    self.inflow_velocity_y = max(-maximum_safe_velocity, min(inflow_velocity_y, maximum_safe_velocity))

    if self.inflow_velocity_x != inflow_velocity_x or self.inflow_velocity_y != inflow_velocity_y:
        warnings.warn(
            "[FluxRender] Inflow velocity was clamped to the safe mathematical limit "
            f"({maximum_safe_velocity}) to prevent LBM stability failure."
        )