Skip to content

Fix energy conservation with sparse autodiff #3939

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dennisYatunin
Copy link
Member

@dennisYatunin dennisYatunin commented Aug 9, 2025

This PR fixes energy conservation when using AutoSparseJacobian by adding padding bands to most of the ∂ᶜρe_totₜ/∂ᶜχ blocks, and also by explicitly handling quaddiagonal bands of the ∂ᶜρe_totₜ/∂ᶠu₃ block.

Based on the dry and moist Float64 baroclinic wave conservation tests, errors in the ∂ᶜρe_totₜ/∂ᶠu₃ block as small as one part in a trillion seem to affect energy conservation. The new bands eliminate all such errors, so that energy conservation is even better than with ManualSparseJacobian. Further experiments may show that this is more precise than we need, so we could potentially improve performance by removing some of these new bands. For now, though, we can continue testing sparse autodiff with optimal energy conservation.

This PR also adds a dry Float64 baroclinic wave conservation test with sparse autodiff to CI, removes the soft-fail annotation from the moist test, and clarifies the bandwidth tables printed when debugging the Jacobian.


  • I have read and checked the items on the review checklist.

@dennisYatunin dennisYatunin requested a review from szy21 August 9, 2025 16:53
@dennisYatunin dennisYatunin force-pushed the dy/autodiff_conservation branch from bbd0885 to 0877f2f Compare August 10, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants