Skip to content

Initialize structure boundary corrections over current neighborhoods - #1351

Draft
svchb wants to merge 13 commits into
fix/precomputed-search-query-capacityfrom
fix/structure-boundary-correction-caches
Draft

svchb wants to merge 13 commits into
fix/precomputed-search-query-capacityfrom
fix/structure-boundary-correction-caches

Conversation

@svchb

@svchb svchb commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Current stack refresh (2026-11-13)

Earlier revision-specific stack pins and validation results below are historical.

Summary

Compute the hydrodynamic sums of the BoundaryModelDummyParticles of
TotalLagrangianSPHSystems and RigidBodySystems over their current hydrodynamic
neighborhood, and lift the temporary correction=nothing restriction of #1342.

  • The correction values of structure boundary models (Shepard coefficient, kernel correction
    values and gradient-correction matrix) are computed with the kernel and smoothing length of
    the boundary model and with hydrodynamic masses and densities. The sums include all
    particles within the support of the boundary model in the current configuration,
    including the particles of the structure itself, independently of the frozen TLSPH
    self-interaction search and the contact search of rigid bodies. Structures without
    boundary model, e.g., contact-only rigid bodies, and disabled interactions don't
    contribute.
  • With SummationDensity, the density of structure boundary models is now computed in every
    update over the same neighborhood. Before, it kept its initial value, and
    ShepardKernelCorrection divided it by the Shepard coefficient in every update, so that
    it grew without bound.
  • The correction of the boundary model may now differ from the correction of the fluid.
    Only KernelCorrection and MixedKernelGradientCorrection, whose kernel gradients don't
    vanish at zero distance, require all fluids to use one of these two corrections, since
    pairs of particles at the same position are skipped otherwise.

The requirement of equal kernels and smoothing lengths of boundary model and fluid, the
continuity equation and the almostzero(h) convention are unchanged.

Validation

Fluid layer with uniform pressure on a structure, load relative to the continuum value
(uncorrected SPH: 0.98):

Boundary correction #1342 without restriction This PR
Rigid body, KernelCorrection 0.49 0.99
Rigid body, GradientCorrection 1.93 0.99
TLSPH with half the support, GradientCorrection 1.17 0.99

A rigid body moving into fluid at rest now compresses its ContinuityDensity boundary with
KernelCorrection. Before, the density rate was exactly zero.

The dummy-particle, semidiscretization, neighborhood-search, FSI RHS, restart and
density-calculator tests passed on Julia 1.11.9 with 2 threads. New tests cover the
summation density (fails without the recomputation), the reuse of the regular fluid
searches, the relaxed correction rule, coincident particles with corrected boundary
gradients, and structure neighbors without boundary model. JuliaFormatter 2.1.1 and
typos 1.50.3 passed.

Performance

The regular structure-fluid searches already use the support of the boundary model in the
current configuration, so they are reused instead of copied. Additional searches are only
created for non-fluid neighbors, and grid searches with static walls are not updated.
In a 2D case with 10,000 fluid and 400 structure particles, update_nhs! is about 2% slower
with boundary corrections (45% in the previous version of this PR). Structures without
boundary correction and without SummationDensity have no overhead.

Stack

Based on #1350, which is based on #1342.

@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.15068% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.04%. Comparing base (ce48b61) to head (92a9ca7).

Files with missing lines Patch % Lines
src/general/gpu.jl 0.00% 3 Missing ⚠️
src/general/neighborhood_search.jl 97.22% 1 Missing ⚠️
...es/boundary/wall_boundary/structure_corrections.jl 83.33% 1 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                            @@
##           fix/precomputed-search-query-capacity    #1351      +/-   ##
=========================================================================
+ Coverage                                  79.92%   80.04%   +0.11%     
=========================================================================
  Files                                        146      147       +1     
  Lines                                      11084    11153      +69     
=========================================================================
+ Hits                                        8859     8927      +68     
- Misses                                      2225     2226       +1     
Flag Coverage Δ
unit 80.04% <93.15%> (+0.11%) ⬆️

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 added a commit to svchb/TrixiParticles.jlOpen that referenced this pull request Nov 10, 2026
@svchb
svchb marked this pull request as draft November 10, 2026 19:59
@svchb svchb self-assigned this Nov 10, 2026
@svchb svchb added the bug Something isn't working label Nov 10, 2026
@svchb

svchb commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the contact-only-neighbor finding from the #1252 review in 95c5a66. Hydrodynamic correction assembly and its search lifecycle now skip rigid neighbors without a boundary model, while mechanical contact remains enabled. The new regressions compare correction caches with an isolated-body reference and verify finite, equal-and-opposite nonzero contact forces for all five correction types with shared, pair-local, and precomputed searches. Validation: 266/266 dummy-particle and RHS checks passed with Julia 1.11.9, two threads, bounds checking, and -O0; JuliaFormatter 2.1.1 and whitespace checks passed.

…re-boundary-correction-caches

# Conflicts:
#	NEWS.md
svchb added a commit that referenced this pull request Nov 11, 2026
…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.
- Allow corrections of the `BoundaryModelDummyParticles` of structures again. The
  correction may differ from the fluid correction, but a boundary gradient that doesn't
  vanish at zero distance (`KernelCorrection`, `MixedKernelGradientCorrection`) requires
  every fluid to use such a correction, since pairs at the same position are skipped
  otherwise.
- With `SummationDensity`, compute the density of structure boundary models in every
  update with the kernel of the boundary model over the current hydrodynamic
  neighborhood. Previously, it kept its initial value, and `ShepardKernelCorrection`
  divided this value by the Shepard coefficient in every update.
- Reuse the regular structure-fluid searches for the hydrodynamic sums instead of
  creating and updating copies, and don't update searches of static walls.
- Rename the correction-specific search helpers to hydrodynamic search helpers, since
  they are also used for the density summation.
Like rigid bodies with only a contact model, a `TotalLagrangianSPHSystem` without
boundary model has no hydrodynamic density or mass. Including it in the correction values
or summation density of a structure boundary model failed with an error.
efaulhaber added a commit that referenced this pull request Nov 18, 2026
…tion method is used (#1342)

* Use boundary-model kernel for corrected FSI pressure

* address review

* reduce tests

* AI review

* review

* revert

* address review

* Require uncorrected structure boundary models and address review findings

- 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.

* remove support for continuitydensity in dummy bnds of tlshp structures

* address review comments

* review

---------

Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com>
@svchb
svchb added this pull request to stack #1392 November 18, 2026 11:08

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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant