Examples for `CVodeResizeHistory` when `y` changes size
@gardner48 is already working on this.
Since Jun 13, 2025.
- Dominant language
- C
- Stars
- 686
- Forks
- 167
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 17
Description
CVodeResizeHistory is a very nice function and I am glad it was released in v7.3.0. I'm working on a project that requires dynamically resizing the ODE system during integration using CVodeResizeHistory(). While the documentation explains the API, I’m unclear on how to handle some scenarios.
1. Resizing when the solution vector y changes size
-
When the ODE system increases or decreases in size, how should
y_histandf_histbe constructed to accommodate the new variables? -
For example, consider this case:
Time t_nt_{n-1}t_{n-2}t_{n-3}Number of equations 6 5 4 5 Notes y6addedshrinks below original intermediate ( y1) or last (y5) removedback to original size -
What should the sizes of
y_histandf_histbe in this case?
Att_n, should the sizes of the vectors in history remain as[6, 5, 4, 5], or should all history vectors be resized to[6, 6, 6, 6]to match the new system size? -
If resizing history vectors, how should the new components be filled? Is zero-initialization acceptable, or should they be extrapolated or estimated in a specific way?
2. Clarification on test behavior
In this test case, I noticed two different behaviors:
https://github.com/LLNL/sundials/blob/967f4d9d18563b8d0f7c79d056a7d1fa607f145a/test/unit_tests/cvode/CXX_serial/cv_test_resize_history.cpp#L127-L129
- Resizing while keeping the same problem size
- Growing the problem by one element each time step
Could you clarify the purpose of each approach? How do they differ in terms of results, stability, or accuracy?
3. Request for a complete working example
It would be incredibly helpful to see a full example that demonstrates a dynamic resize where the number of unknowns (NEQ) both expands and shrinks
Thank you for your work on this excellent integration library!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.