Skip to content

Generalize free-surface detection - #1282

Draft
svchb wants to merge 16 commits into
trixi-framework:mainfrom
svchb:feature/free-surface-detection
Draft

svchb wants to merge 16 commits into
trixi-framework:mainfrom
svchb:feature/free-surface-detection

Conversation

@svchb

@svchb svchb commented Aug 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Generalize free-surface geometry behind AbstractSurfaceMethod and AbstractSurfaceNormalMethod.
  • Add activity-only ColorfieldSurfaceDetection; ColorfieldSurfaceNormal uses the same detection pipeline and additionally computes normals and curvature.
  • Use one surface_activity pipeline for free surfaces, multicolor fluid interfaces, walls, rigid bodies, interpolation, custom quantities, metadata, and VTK output.
  • Support the generalized surface method in WCSPH, EDAC, and IISPH systems, including CPU/GPU-compatible cache and execution paths.

Surface semantics

  • Treat color_value as a categorical phase label. Its numeric magnitude and sign have no physical meaning.
  • Detect interfaces from phase-local indicator gradients, so relabeling phases does not change the resulting geometry.
  • Combine interface, boundary-contact, and ideal-density criteria into a smooth activity value while retaining configurable thresholds and interface tapering.
  • Allow systems that do not compute their own surface geometry to contribute phase or boundary information to neighboring systems.

API change

  • Rename the fluid-system field and primary keyword from surface_normal_method to surface_method for the 0.6.0 release.
  • Retain deprecated constructor-keyword and accessor compatibility for the transition.
  • Keep surface-tension models responsible for declaring whether they require normals; cohesion-only configurations do not allocate surface-normal caches.

Stack

This PR is stacked directly on #1280. It retains the threshold hardening introduced there while generalizing the multicolor implementation into the categorical, phase-local surface-activity pipeline described above.

Follow-up #1283 consumes the shared surface_activity interface for surface-pressure blending.

Validation

  • Complete unit suite: TRIXIPARTICLES_TEST=unit julia --startup-file=no --project=. -e "using Pkg; Pkg.test()".
  • Focused surface detection, multicolor, wall/rigid, normal, surface-tension, interpolation, metadata, and VTK tests pass.
  • JuliaFormatter 2.1.1 is idempotent and the GitHub format check passes.
  • GitHub spell and invalidation checks pass.
  • git diff --check passes.

@codecov

codecov Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.79549% with 82 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.31%. Comparing base (6a56a72) to head (6380797).

Files with missing lines Patch % Lines
test/examples/gpu.jl 0.00% 59 Missing ⚠️
src/schemes/fluid/surface_normal_sph.jl 93.78% 12 Missing ⚠️
src/general/custom_quantities.jl 62.50% 3 Missing ⚠️
src/preprocessing/particle_packing/system.jl 50.00% 3 Missing ⚠️
src/schemes/fluid/surface_tension.jl 89.65% 3 Missing ⚠️
src/schemes/fluid/fluid.jl 96.55% 1 Missing ⚠️
...chemes/fluid/implicit_incompressible_sph/system.jl 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1282      +/-   ##
==========================================
- Coverage   90.49%   90.31%   -0.19%     
==========================================
  Files         141      142       +1     
  Lines       11419    11898     +479     
==========================================
+ Hits        10334    10746     +412     
- Misses       1085     1152      +67     
Flag Coverage Δ
total 90.32% <86.79%> (-0.19%) ⬇️
unit 80.25% <85.82%> (+2.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@svchb svchb self-assigned this Sep 1, 2026
@svchb
svchb requested a review from efaulhaber September 1, 2026 12:56
@svchb
svchb marked this pull request as ready for review September 1, 2026 12:56
@svchb
svchb marked this pull request as draft September 2, 2026 13:04
# Conflicts:
#	NEWS.md
#	docs/src/systems/fluid.md
#	src/general/custom_quantities.jl
#	src/schemes/fluid/surface_tension.jl
#	test/systems/edac_system.jl
@svchb
svchb force-pushed the feature/free-surface-detection branch from 649cd47 to 86f73cc Compare September 2, 2026 14:30
svchb added a commit to svchb/TrixiParticles.jlOpen that referenced this pull request Sep 2, 2026
# Conflicts:
#	examples/fluid/dam_break_2d.jl
#	examples/fluid/dam_break_oil_film_2d.jl
#	src/general/semidiscretization.jl
#	src/schemes/fluid/entropically_damped_sph/system.jl
#	src/schemes/fluid/implicit_incompressible_sph/system.jl
#	src/schemes/fluid/weakly_compressible_sph/system.jl
#	test/examples/gpu.jl

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking changes This change will break the public API and requires a new major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant