Skip to content

Harden gradient correction matrices - #1290

Draft
svchb wants to merge 186 commits into
trixi-framework:mainfrom
svchb:fix/gradient-correction-lifecycle
Draft

svchb wants to merge 186 commits into
trixi-framework:mainfrom
svchb:fix/gradient-correction-lifecycle

Conversation

@svchb

@svchb svchb commented Aug 16, 2026 •

Copy link
Copy Markdown
Collaborator

Current stack refresh (2026-11-13)

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

Summary

  • assemble correction matrices from raw kernel gradients
  • use scale-independent singularity detection and identity fallback
  • validate blended correction factors
  • preserve boundary cache element types
  • add affine reproduction, manufactured continuity, restart, and GPU tests

Stack

Depends on #1291. This PR targets main and temporarily includes the preceding stack.

Review-only diff: svchb/TrixiParticles.jlOpen@fix/kernel-correction-lifecycle...fix/gradient-correction-lifecycle

Isolated layer: 7 files, 296 additions, 8 deletions.

Restack verification (2026-11-11)

Current stack: #1284 → #1292 → #1291 → #1290. Updated head: fe0b2fc38; parent #1291: 9448a9de5.

Includes the updated #1284 foundation (061e9a278), its FSI dependencies #1342, #1351, #1344, and #1345, and the fresh rigid-body Shepard summation numerator fix. Conflicts were resolved while preserving current boundary-model kernels/neighborhoods and the shared physical pair operator.

  • 736/736 correction and boundary-cache checks passed.
  • Julia 1.11.9, two threads, -O1, and bounds checking enabled.
  • JuliaFormatter 2.1.1 passed on this isolated layer; whitespace checks passed.

Previous verification

Updated against main at c6ef5bd8e and propagated through the full correction stack on 2026-10-30.

  • combined stack: 29,232/29,232 unit tests passed on Julia 1.11.9 with bounds checking
  • latest-main custom-quantity regressions: 107/107 passed
  • Aqua default checks passed
  • JuliaFormatter 2.1.1 passed on every stack layer; whitespace checks passed

@codecov

codecov Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.47352% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.94%. Comparing base (f24a312) to head (eea49e7).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
test/examples/gpu.jl 0.00% 61 Missing ⚠️
...rc/schemes/fluid/weakly_compressible_sph/system.jl 90.62% 6 Missing ⚠️
...c/schemes/structure/total_lagrangian_sph/system.jl 87.17% 5 Missing ⚠️
src/general/corrections.jl 98.21% 1 Missing ⚠️
test/general/corrections/kernel.jl 98.70% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1290      +/-   ##
==========================================
+ Coverage   90.71%   90.94%   +0.22%     
==========================================
  Files         143      148       +5     
  Lines       11493    12103     +610     
==========================================
+ Hits        10426    11007     +581     
- Misses       1067     1096      +29     
Flag Coverage Δ
total 90.94% <88.47%> (+0.22%) ⬆️
unit 80.13% <88.00%> (+1.99%) ⬆️

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 12 commits August 17, 2026 10:53
Fix conflicts in src/schemes/fluid/entropically_damped_sph/rhs.jl and
src/schemes/fluid/weakly_compressible_sph/rhs.jl:
- Use gradient_correction (and force_correction) from correction lifecycle branch
- Preserve mapreduce_neighbor functional API (add_dv_* functions) from origin/main
- pressure_acceleration now uses gradient_correction
- shifting now uses add_dv_shifting with gradient_correction
Fix conflicts in EDAC and WCSPH RHS:
- adopt mapreduce_neighbor / add_dv_* functional API from origin/main
- preserve gradient/force correction splitting from stack (gradient_correction for pressure/shifting, force_correction for free-surface)
@svchb
svchb force-pushed the fix/gradient-correction-lifecycle branch from 8ac748e to 75e051e Compare August 27, 2026 21:31
svchb and others added 22 commits November 11, 2026 15:50
…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 trixi-framework#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.
…re-boundary-correction-caches

# Conflicts:
#	NEWS.md
- 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.

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants