Implement velocity averaging for TLSPH#1069
Implement velocity averaging for TLSPH#1069efaulhaber wants to merge 8 commits intotrixi-framework:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1069 +/- ##
==========================================
+ Coverage 89.25% 89.30% +0.05%
==========================================
Files 122 123 +1
Lines 8949 9032 +83
==========================================
+ Hits 7987 8066 +79
- Misses 962 966 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
067e215 to
b74d8d0
Compare
There was a problem hiding this comment.
Pull request overview
Implements exponential moving-average (EMA) velocity averaging for TotalLagrangianSPHSystem to stabilize challenging FSI cases by using a smoothed structure velocity only in the fluid-structure viscous (no-slip) coupling.
Changes:
- Add
VelocityAveragingoption, cache fields, and averaged-velocity update routines for TLSPH. - Update callbacks (
UpdateCallbackand split integration) to initialize/update averaged velocities over time. - Wire averaged velocity into boundary no-slip velocity evaluation, add docs, and extend an example-based test.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/examples/examples.jl | Enables velocity averaging in an FSI example test and adds assertions that it is being used. |
| src/schemes/structure/total_lagrangian_sph/velocity_averaging.jl | New implementation of EMA velocity averaging and velocity_for_viscosity selector. |
| src/schemes/structure/total_lagrangian_sph/total_lagrangian_sph.jl | Includes the new velocity averaging implementation file. |
| src/schemes/structure/total_lagrangian_sph/system.jl | Adds velocity_averaging field/keyword, cache creation, and callback requirement logic for TLSPH. |
| src/schemes/fluid/shifting_techniques.jl | Updates requires_update_callback signature to accept semi. |
| src/schemes/boundary/wall_boundary/dummy_particles.jl | Uses velocity_for_viscosity when computing boundary velocity for no-slip. |
| src/schemes/boundary/open_boundary/system.jl | Updates requires_update_callback signature to accept semi. |
| src/preprocessing/particle_packing/system.jl | Updates requires_update_callback signature to accept semi. |
| src/general/semidiscretization.jl | Calls requires_update_callback(system, semi) in check_update_callback. |
| src/callbacks/update.jl | Initializes and updates averaged velocity from the UpdateCallback. |
| src/callbacks/split_integration.jl | Injects a lightweight averaged-velocity updater into split integration and adds display support. |
| src/TrixiParticles.jl | Exports VelocityAveraging. |
| examples/fsi/dam_break_plate_2d.jl | Adds velocity_averaging keyword (set to nothing) in the example setup. |
| docs/src/systems/total_lagrangian_sph.md | Adds user documentation for velocity averaging and exposes autodocs. |
Comments suppressed due to low confidence (1)
test/examples/examples.jl:168
@test !iszero(velocity_for_viscosity(...))is potentially flaky if the chosen particle’s velocity happens to be (near-)zero at the sampled time. A more robust check would assert that averaging was updated (e.g.,system.cache.t_last_averaging[]reached the final time, or thataveraged_velocitychanged from its initialization) rather than relying on a nonzero value.
@test_throws "no method" TrixiParticles.current_velocity(nothing, system, 1)
@test !iszero(TrixiParticles.velocity_for_viscosity(nothing, system, 1))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
this is what codex says: |
svchb
left a comment
There was a problem hiding this comment.
Please add an actual unit test since this is not very hard here.
|
|
||
| ## [Velocity Averaging](@id velocity_averaging) | ||
|
|
||
| In challenging FSI cases with very stiff structures, the two techniques above might not be |
There was a problem hiding this comment.
| In challenging FSI cases with very stiff structures, the two techniques above might not be | |
| In FSI cases with very stiff structures, the two techniques above might not be |
|
|
||
| In challenging FSI cases with very stiff structures, the two techniques above might not be | ||
| sufficient to prevent instabilities. | ||
| High-frequency noise in the structure velocity can trigger instabilities or spurious |
There was a problem hiding this comment.
| High-frequency noise in the structure velocity can trigger instabilities or spurious | |
| High-frequency noise of the structure velocity can trigger instabilities or spurious |
| In challenging FSI cases with very stiff structures, the two techniques above might not be | ||
| sufficient to prevent instabilities. | ||
| High-frequency noise in the structure velocity can trigger instabilities or spurious | ||
| pressure waves (due to aliasing) in the fluid. |
There was a problem hiding this comment.
| pressure waves (due to aliasing) in the fluid. | |
| pressure waves in the fluid due to aliasing. |
| sufficient to prevent instabilities. | ||
| High-frequency noise in the structure velocity can trigger instabilities or spurious | ||
| pressure waves (due to aliasing) in the fluid. | ||
| Another stabilization technique is an exponential moving average (EMA) of the structure |
There was a problem hiding this comment.
| Another stabilization technique is an exponential moving average (EMA) of the structure | |
| Another stabilization technique is to use an exponential moving average (EMA) of the structure |
| High-frequency noise in the structure velocity can trigger instabilities or spurious | ||
| pressure waves (due to aliasing) in the fluid. | ||
| Another stabilization technique is an exponential moving average (EMA) of the structure | ||
| velocity used **only** for the fluid-structure viscous coupling (no-slip boundary condition). |
There was a problem hiding this comment.
| velocity used **only** for the fluid-structure viscous coupling (no-slip boundary condition). | |
| velocity used **only** for the fluid-structure viscous coupling (i.e. the no-slip boundary condition). |
| velocity used **only** for the fluid-structure viscous coupling (no-slip boundary condition). | ||
|
|
||
| The averaged velocity ``\bar v`` is updated (by the [`UpdateCallback`](@ref) | ||
| or in every sub-step of the [`SplitIntegrationCallback`](@ref) if it is used) as |
There was a problem hiding this comment.
| or in every sub-step of the [`SplitIntegrationCallback`](@ref) if it is used) as | |
| or at every sub-step of the [`SplitIntegrationCallback`](@ref) if it is used) as |
In challenging FSI cases with very stiff structures, penalty force and artificial viscosity might not be sufficient to prevent instabilities. High-frequency noise in the structure velocity can trigger instabilities or spurious
pressure waves (due to aliasing) in the fluid.
This PR implements velocity averaging as another stabilization technique. An exponential moving average of the structure velocity is used only for the fluid-structure viscous coupling (no-slip boundary condition).