Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

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

Summary

  • Adds fill! overloads for all cache types (DiffCache, FixedSizeDiffCache, LazyBufferCache, GeneralLazyBufferCache)
  • These overloads fill all allocated buffers with a given value
  • Needed to fix convergence issues in OrdinaryDiffEq.jl split ODE methods

Background

After the change in DiffEqBase.jl PR #1188 that prevents replacing LazyBufferCache when promoting functions, split ODE methods started failing convergence tests. The issue is that uninitialized cache buffers contain random values that accumulate into the solution, causing unpredictable errors that break convergence rate tests.

Solution

This PR adds fill! overloads that can be called to fill caches with any value, including zero. This uses the standard Julia fill! interface which is more idiomatic than adding a custom zero! function.

Implementation

The fill! methods:

  • For DiffCache and FixedSizeDiffCache: Fill both du and dual_du arrays with the value, and clear any_du
  • For LazyBufferCache and GeneralLazyBufferCache: Iterate through all allocated buffers and fill them with the value

Test plan

  • Added comprehensive tests for all cache types
  • Tests verify that buffers are properly filled with different values
  • Tests pass locally

🤖 Generated with Claude Code

@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Add zero! function for cache types Add fill! overloads for cache types Sep 2, 2025
This adds fill! overloads for DiffCache, FixedSizeDiffCache, LazyBufferCache, and GeneralLazyBufferCache that fill all allocated buffers with a given value. This is needed to ensure proper initialization of caches in split ODE methods to avoid convergence issues.

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

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas ChrisRackauckas merged commit dfc60b3 into SciML:master Sep 2, 2025
11 of 16 checks passed
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