-
Notifications
You must be signed in to change notification settings - Fork 156
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_hist
andf_hist
be constructed to accommodate the new variables? -
For example, consider this case:
Time t_n
t_{n-1}
t_{n-2}
t_{n-3}
Number of equations 6 5 4 5 Notes y6
addedshrinks below original intermediate ( y1
) or last (y5
) removedback to original size -
What should the sizes of
y_hist
andf_hist
be 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:
sundials/test/unit_tests/cvode/CXX_serial/cv_test_resize_history.cpp
Lines 127 to 129 in 967f4d9
// resize = 0 -- do not resize | |
// resize = 1 -- call resize but with the same problem size | |
// resize = 2 -- grow the problem by one element each time step |
- 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!