Skip to content

Use boundary-model kernel to calculate the FSI pressure when a correction method is used - #1342

Merged
efaulhaber merged 15 commits into
mainfrom
fix/fsi-hydrodynamic-boundary-kernels
Nov 18, 2026
Merged

efaulhaber merged 15 commits into
mainfrom
fix/fsi-hydrodynamic-boundary-kernels

Conversation

@svchb

@svchb svchb commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix the pressure acceleration between fluids with an asymmetric corrected kernel gradient
(KernelCorrection, GradientCorrection, BlendedGradientCorrection,
MixedKernelGradientCorrection) and TotalLagrangianSPHSystems or RigidBodySystems with
BoundaryModelDummyParticles.

  • The kernel gradient at the structure particle now uses the smoothing kernel and smoothing
    length of the boundary model instead of the TLSPH kernel for solid mechanics. With a
    smaller TLSPH support, the boundary contribution was missing. For a fluid layer with
    uniform pressure on a TLSPH plate with half the support, the load was 0.67 instead of
    0.98 of the continuum value.
  • Fix the assembly of the correction matrix of GradientCorrection and
    BlendedGradientCorrection. It used the corrected kernel gradient, i.e., multiplied each
    gradient with the matrix that was being assembled. As a result, GradientCorrection had
    no effect and BlendedGradientCorrection depended on the order of the neighbors.
    Results with these corrections change.
  • DensityDiffusionAntuono now uses the uncorrected kernel gradient for the renormalized
    density gradient, as documented. It used the corrected kernel gradient of the fluid,
    whose correction values are only computed after the density diffusion in each update,
    i.e., they were from the previous update and uninitialized in the first one.

Temporary restriction

For now, the correction of the BoundaryModelDummyParticles of a TLSPH system or rigid
body must be nothing. The correction values of these boundary particles are sums over
their complete hydrodynamic neighborhood in the current configuration, including the
particles of the structure itself. The neighborhood searches of structures don't provide
this neighborhood: the TLSPH self-interaction search is frozen in the initial configuration
and uses the TLSPH kernel, and rigid bodies only search for contact. Without complete
neighborhoods, these corrections changed the pressure load on a structure by factors
between 0.5 and 2. On main, they were ignored or failed with an error.
#1351 adds these neighborhoods and lifts the restriction.

Performance

  • No regression in the fluid-structure and structure-fluid interaction loops.
  • The fluid update with GradientCorrection is about 15% faster, since the assembly no
    longer multiplies every kernel gradient with a matrix.
  • The structure-fluid interaction computes the kernel gradient of the boundary model only
    once for the pressure acceleration and the continuity equation.
  • The correction caches of BoundaryModelDummyParticles now use the element type of the
    density instead of always Float64, so that Float32 simulations don't mix in Float64.

Further changes

  • system_correction(::BoundaryModelDummyParticles) replaces a custom smoothing_kernel_grad
    method for boundary models, so that smoothing_kernel_grad and
    smoothing_kernel_grad_unsafe of a boundary model are consistent.
  • NEWS lists the restriction under API changes, and the bugfix entry states that results
    with GradientCorrection and BlendedGradientCorrection change.

Tests

  • FSI pressure forces with all four asymmetric fluid corrections against an independent
    calculation with cubic-spline values. The fluid particles are inside the support of the
    boundary model, but outside the support of the TLSPH kernel, so using the TLSPH kernel
    fails this test.
  • Coincident and nearly coincident fluid and structure particles.
  • Correction matrices of GradientCorrection and BlendedGradientCorrection against
    analytical values.
  • DensityDiffusionAntuono is independent of the fluid correction (fails without the fix).
  • Float32 correction caches of BoundaryModelDummyParticles.
  • The restriction in the Semidiscretization.

Validation

On Julia 1.11.9 with 2 threads:

  • Full unit test suite: 28,743/28,743 passed.
  • dam_break_2d.jl with all corrections: 36/36 passed.
  • FSI examples (falling water column, dam break with plate, falling rigid spheres,
    hydrostatic water column with WCSPH and EDAC, falling rotating rigid squares):
    12/12 passed.
  • JuliaFormatter 2.1.1 and typos 1.50.3 passed.

Stack

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.13483% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.08%. Comparing base (5aebd3f) to head (2af99a2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../schemes/boundary/wall_boundary/dummy_particles.jl 46.15% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1342      +/-   ##
==========================================
+ Coverage   79.67%   80.08%   +0.40%     
==========================================
  Files         145      147       +2     
  Lines       11037    11061      +24     
==========================================
+ Hits         8794     8858      +64     
+ Misses       2243     2203      -40     
Flag Coverage Δ
unit 80.08% <92.13%> (+0.40%) ⬆️

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 force-pushed the fix/fsi-hydrodynamic-boundary-kernels branch from 19cf836 to 4a97b62 Compare October 29, 2026 14:32
@svchb
svchb changed the base branch from fix/fsi-pressure-mirroring to main October 29, 2026 14:32

@efaulhaber efaulhaber left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already found several critical issues here that could've probably easily been found by AI. Please AI-review this PR.

Comment thread src/schemes/structure/structure.jl Resolved
Comment thread test/schemes/fluid/rhs.jl Resolved
Comment thread test/schemes/fluid/rhs.jl Resolved
Comment thread test/schemes/fluid/rhs.jl Resolved
@svchb svchb changed the title Use boundary-model kernel for corrected FSI pressure Use boundary-model kernel to calculate the FSI pressure in when a correction method is used Nov 9, 2026
@svchb svchb changed the title Use boundary-model kernel to calculate the FSI pressure in when a correction method is used Use boundary-model kernel to calculate the FSI pressure when a correction method is used Nov 9, 2026
@svchb
svchb requested a review from efaulhaber November 10, 2026 09:05
svchb added a commit to svchb/TrixiParticles.jlOpen that referenced this pull request Nov 10, 2026

@efaulhaber efaulhaber left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit overwhelmed by the changes and tests here, as there are too many things happening at once in this single PR. Please split future PRs if they need three NEWS.md entries.

Is there now a test that verifies that FSI is not using the TLSPH kernel? Is that checked in "Boundary kernel in pressure acceleration with corrected gradients"?

Comment thread docs/src/general/smoothing_kernels.md Resolved
Comment thread src/general/smoothing_kernels.jl Resolved
Comment thread src/schemes/structure/structure.jl Resolved
Comment thread NEWS.md Resolved
Comment thread test/schemes/fluid/rhs.jl Resolved
Comment thread test/schemes/fluid/rhs.jl Resolved
Comment thread test/schemes/fluid/rhs.jl Resolved
Comment thread test/schemes/fluid/rhs.jl Resolved
Comment thread test/schemes/fluid/rhs.jl Resolved
@svchb

svchb commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator Author

I am a bit overwhelmed by the changes and tests here, as there are too many things happening at once in this single PR. Please split future PRs if they need three NEWS.md entries.

Is there now a test that verifies that FSI is not using the TLSPH kernel? Is that checked in "Boundary kernel in pressure acceleration with corrected gradients"?

Yes, this is checked in “Boundary kernel in pressure acceleration with corrected gradients”.

@svchb
svchb requested a review from efaulhaber November 11, 2026 14:51
svchb and others added 3 commits November 11, 2026 17:06
…ings

- Temporarily require `correction=nothing` for the `BoundaryModelDummyParticles` of a
  `TotalLagrangianSPHSystem` or `RigidBodySystem`. Their correction values require the
  complete current hydrodynamic neighborhood, which is added in #1351.
- Assemble the renormalized density gradient of `DensityDiffusionAntuono` from the
  uncorrected kernel gradient instead of the corrected fluid gradient, whose correction
  values are not computed yet when the density diffusion is updated.
- Allocate the dummy-particle correction caches with the element type of the density.
- Compute the kernel gradient of the boundary model once for the pressure acceleration
  and the continuity equation in the structure-fluid interaction.
- Define `system_correction` for `BoundaryModelDummyParticles` instead of a custom
  `smoothing_kernel_grad` method, so that the safe and unsafe gradients are consistent.
Comment thread docs/src/general/smoothing_kernels.md Resolved
Comment thread src/schemes/structure/structure.jl Resolved
Comment thread src/schemes/structure/structure.jl Resolved
Comment thread src/schemes/structure/structure.jl Resolved
Comment thread src/schemes/structure/structure.jl Resolved
Comment thread src/schemes/structure/structure.jl Resolved
@efaulhaber

Copy link
Copy Markdown
Member

/run-gpu-tests

@efaulhaber
efaulhaber enabled auto-merge (squash) November 17, 2026 10:41
@efaulhaber
efaulhaber disabled auto-merge November 18, 2026 10:50
@efaulhaber
efaulhaber merged commit 6588929 into main Nov 18, 2026
25 of 29 checks passed
@efaulhaber
efaulhaber deleted the fix/fsi-hydrodynamic-boundary-kernels branch November 18, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants