-
Notifications
You must be signed in to change notification settings - Fork 16
Add EnergyCalculatorCallback
#940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add EnergyCalculatorCallback
#940
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #940 +/- ##
==========================================
+ Coverage 64.45% 64.70% +0.25%
==========================================
Files 117 119 +2
Lines 8122 8203 +81
==========================================
+ Hits 5235 5308 +73
- Misses 2887 2895 +8
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the EnergyCalculatorCallback, a second version of energy calculation that evaluates forces on "fixed" (clamped) particles and integrates energy using explicit Euler method. The implementation provides a more efficient alternative to previous energy calculation approaches, adding only ~6% overhead compared to 25% of an earlier version.
- Adds a new
EnergyCalculatorCallbackfor calculating energy contributions from clamped particles in TLSPH systems - Modifies
TotalLagrangianSPHSystemto support energy calculator functionality with new cache allocation - Updates interaction functions to support selective particle processing for energy calculations
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/callbacks/energy_calculator.jl | New callback implementation with energy calculation logic and CombinedMatrix utility |
| src/schemes/structure/total_lagrangian_sph/system.jl | Added support flag and cache creation for energy calculator functionality |
| src/schemes/structure/total_lagrangian_sph/rhs.jl | Modified interaction functions to accept custom particle ranges |
| test/callbacks/energy_calculator.jl | Comprehensive test suite for the new callback |
| test/examples/examples.jl | Integration test using oscillating beam example |
| src/TrixiParticles.jl | Export declaration for the new callback |
| src/callbacks/callbacks.jl | Include statement for new callback file |
| test/callbacks/callbacks.jl | Include statement for new test file |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This PR implements the second version demonstrated in #897: