Skip to content

Conversation

ChrisRackauckas-Claude
Copy link

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 2, 2025

Summary

Fixes convergence test failures in split ODE methods (AlgConvergence_III and others) by ensuring caches are properly initialized.

Background

After DiffEqBase.jl PR #1188 changed promote_f to no longer replace LazyBufferCache with a zero-initialized array, split ODE methods started failing convergence tests. The issue was that uninitialized memory in the cache contained random values that would accumulate into the solution, causing unpredictable errors that broke convergence rate tests.

Solution

This PR uses the standard fill! function to zero out the cache for SplitFunction objects during integrator initialization. It adds PreallocationTools as a dependency and requires version 0.4.34+ which includes fill! overloads for cache types.

Changes

  • Add PreallocationTools v0.4.34+ as a dependency to OrdinaryDiffEqCore
  • Use fill!(cache, 0) to zero out SplitFunction caches during initialization
  • The code checks if fill! is applicable before calling it, ensuring backward compatibility

Test Results

Created a test that verifies convergence rates for SplitEuler with a LazyBufferCache. The test shows correct first-order convergence (rates ≈ 1.0) with this fix applied.

Errors: [0.064, 0.031, 0.016, 0.008]
Convergence rates: [1.030, 1.015, 1.007]

Dependencies

Related Issues

  • Fixes the convergence test failures reported after DiffEqBase.jl#1188

🤖 Generated with Claude Code

@ChrisRackauckas-Claude ChrisRackauckas-Claude force-pushed the fix-split-cache-initialization branch from 46a0154 to 84854b3 Compare September 2, 2025 13:44
After DiffEqBase.jl PR SciML#1188 stopped replacing LazyBufferCache in promote_f, split ODE methods started failing convergence tests due to uninitialized memory in caches. This fix uses fill! to zero out the cache when a SplitFunction with a cache is initialized, ensuring clean initial state.

Changes:
- Add PreallocationTools as a dependency to OrdinaryDiffEqCore
- Use fill! to zero out SplitFunction caches during initialization
- Requires PreallocationTools v0.4.34+ which adds fill! overloads for cache types

The fix uses the standard fill! function which works with PreallocationTools.jl PR SciML#142 that adds fill! overloads for cache types.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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