Skip to content

Complete mixed kernel-gradient correction - #1288

Draft
svchb wants to merge 195 commits into
trixi-framework:mainfrom
svchb:fix/mixed-kernel-gradient-correction
Draft

svchb wants to merge 195 commits into
trixi-framework:mainfrom
svchb:fix/mixed-kernel-gradient-correction

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

  • compose kernel and matrix correction caches with matching element types
  • assemble the mixed matrix from the kernel-corrected raw gradient
  • document constant and affine consistency
  • add direct-gradient, restart, EDAC, boundary, and GPU tests

Stack

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

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

Isolated layer: 5 files, 67 additions, 4 deletions.

Restack verification (2026-11-11)

Current stack: #1284 → #1292 → #1291 → #1290 → #1288. Updated head: ddff15b14; parent #1290: fe0b2fc38.

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.

  • 763/763 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.65031% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.94%. Comparing base (f24a312) to head (204d957).
⚠️ 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.41% 1 Missing ⚠️
test/general/corrections/kernel.jl 98.70% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1288      +/-   ##
==========================================
+ Coverage   90.71%   90.94%   +0.23%     
==========================================
  Files         143      149       +6     
  Lines       11493    12106     +613     
==========================================
+ Hits        10426    11010     +584     
- Misses       1067     1096      +29     
Flag Coverage Δ
total 90.94% <88.65%> (+0.23%) ⬆️
unit 80.14% <88.19%> (+2.00%) ⬆️

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 14 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/mixed-kernel-gradient-correction branch from fe0a364 to 5cfa215 Compare August 28, 2026 07:57
svchb and others added 23 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