Skip to content

improve: tangential velocity boundary condition at obstacle edges #9

@jayf0x

Description

@jayf0x

Problem

Current branchless (1-obs) weight zeroes velocity inside obstacles but provides no explicit tangential (slip) condition at boundaries. A thin layer of incorrect velocity just outside text slightly distorts the flow path.

Proposed change

After the gradient-subtract pass, add a boundary-condition step:

  1. Compute obstacle gradient ∇obs via 2-tap finite difference of the obstacle texture — this gives the surface normal.
  2. For cells where obs > 0 && obs < 0.5, subtract the normal component from velocity (project to tangential).

Acceptance criteria

  • Boundary condition pass runs after gradient-subtract
  • Fluid flows tangentially along obstacle edges rather than stagnating
  • No observable performance regression at simResolution=0.5

Files likely touched: src/core/shaders.ts, src/core/wgsl-shaders.ts, src/core/simulation.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:physicsFluid solver, pressure, advectioneffort:3Medium — half to full daytype:improvementEnhances existing behaviour

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions