Skip to content
Open
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
6f54295
add constraints unit test
gardner48 Jul 12, 2025
be4103f
cmake testing fixes
gardner48 Jul 12, 2025
715a228
add CVODE constraint test
gardner48 Jul 12, 2025
37c8fe6
add IDS constraint test
gardner48 Jul 12, 2025
65f34b3
remove constraints malloc and set flags
gardner48 Oct 18, 2025
4441e0b
testing output
gardner48 Oct 18, 2025
6821c6d
fix error message
gardner48 Oct 18, 2025
fa6f19f
separate out constraint check
gardner48 Oct 18, 2025
30e2aef
update copyright
gardner48 Oct 18, 2025
96239ba
clean up constraint handling
gardner48 Oct 18, 2025
6cd03b6
fix comment
gardner48 Oct 18, 2025
3bfd2f2
update docs
gardner48 Oct 18, 2025
ce19943
update change log
gardner48 Oct 18, 2025
4d5ec81
sync CVODE and CVODES
gardner48 Oct 18, 2025
91f0809
sync docs
gardner48 Oct 18, 2025
45d1837
add constraint fails to print all stats
gardner48 Oct 18, 2025
5921290
note change to StepSolveFails values
gardner48 Oct 18, 2025
8932230
note changes to step solve fails and version added
gardner48 Oct 18, 2025
7facb14
fix typo
gardner48 Oct 18, 2025
b12de66
match nflag check style
gardner48 Oct 18, 2025
17f0259
match names in header
gardner48 Oct 18, 2025
4028f5b
initialize constraint fails count
gardner48 Oct 18, 2025
66dd93e
note fix to GetReturnFlagName
gardner48 Oct 18, 2025
e16194b
fix typo
gardner48 Oct 18, 2025
f49b0d5
separate constraints fails from correction fails
gardner48 Oct 19, 2025
87bb46e
sync IDA and IDAS
gardner48 Oct 19, 2025
16020c9
update IDAS
gardner48 Oct 19, 2025
9de52f6
update change log
gardner48 Oct 19, 2025
872897e
add IDA(S) docs, fix CVODE(S) docs
gardner48 Oct 19, 2025
98ebab7
re-enable CVODES test
gardner48 Oct 19, 2025
4bee5a3
update fortran interfaces
gardner48 Oct 19, 2025
d85b10d
apply formatting
gardner48 Oct 19, 2025
6d59d21
update output files
gardner48 Oct 19, 2025
83b292f
update fortran outputs
gardner48 Oct 20, 2025
0bc9be9
update logging output files
gardner48 Oct 20, 2025
bf1a94c
update answer submodule
gardner48 Oct 20, 2025
d5a16e5
fix output
gardner48 Oct 20, 2025
788bbd7
update answer submodule
gardner48 Oct 20, 2025
9ff781f
update answers submodule
gardner48 Oct 20, 2025
7d0547f
reinitialize constraint fail counter
gardner48 Oct 20, 2025
256bb2c
add end-step-attempt log message
gardner48 Oct 20, 2025
7411ab2
set ida_phase
gardner48 Oct 20, 2025
e424a04
update h after IDARestore
gardner48 Oct 20, 2025
10cc224
update IDA output
gardner48 Oct 20, 2025
e68194d
sync IDAS with IDA
gardner48 Oct 20, 2025
240aff8
combine nflag checks
gardner48 Oct 20, 2025
37e7a4b
update answers submodule
gardner48 Oct 20, 2025
524916b
update some debug logging
gardner48 Oct 21, 2025
3d9cafe
add constraint logging
gardner48 Oct 25, 2025
0e9c948
Update region labels
gardner48 Oct 25, 2025
a17869a
apply formatting
gardner48 Oct 25, 2025
3942e23
breakup constraint correction update, count corrections
gardner48 Oct 26, 2025
b62af62
sync CVODES
gardner48 Oct 26, 2025
684e2bb
IDA breakup constraint correction update, count corrections
gardner48 Oct 26, 2025
f47b4c6
sync IDAS
gardner48 Oct 26, 2025
7ab72c8
update logging output
gardner48 Oct 26, 2025
1000fe2
update answers submodule
gardner48 Oct 26, 2025
8b2a804
apply formatting
gardner48 Oct 26, 2025
88b246c
update fortran interface
gardner48 Oct 26, 2025
14ace03
update outputs with printallstats
gardner48 Oct 26, 2025
fb1ef93
update answers submodule
gardner48 Oct 26, 2025
09c4d3b
fix find and replace
gardner48 Oct 26, 2025
f5de3db
update logging output level 4 and 5
gardner48 Oct 26, 2025
ed75e16
update ida(s) outputs
gardner48 Oct 26, 2025
7c5a2c6
update cvode output
gardner48 Oct 26, 2025
30632d9
CVODES to CVODE in cvode docs
gardner48 Oct 26, 2025
e8953ee
IDA to IDAS
gardner48 Oct 26, 2025
652fa77
IDASLS to IDALS
gardner48 Oct 26, 2025
3405778
add cli options for max constraint fails
gardner48 Oct 26, 2025
4c7c0c7
sync arkode constraints
gardner48 Oct 26, 2025
f2c4fa2
update fused kernels
gardner48 Oct 26, 2025
3fbb153
fix constraint changes in AdjointStepper
gardner48 Oct 27, 2025
8bf0f6b
fix fused prototype
gardner48 Oct 27, 2025
ad8c127
apply formatting
gardner48 Oct 27, 2025
8282b6a
fix typo
gardner48 Oct 27, 2025
602a679
Merge branch 'develop' into bugfix/constraints
gardner48 Oct 30, 2025
a450c90
Merge branch 'develop' into bugfix/constraints
gardner48 Nov 3, 2025
9f17793
Merge branch 'develop' into bugfix/constraints
gardner48 Nov 12, 2025
92ab760
add docs for GetNumConstraintCorrections
gardner48 Nov 12, 2025
fed68cd
Merge branch 'develop' into bugfix/constraints
gardner48 Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,29 @@

### New Features and Enhancements

Added functions to CVODE(S) and IDA(S) to set the maximum number of inequality
constraint failures in a step attempt (`CVodeSetMaxNumConstraintFails` and
`IDASetMaxNumConstraintFails`) and to retrieve the total number of failed step
attempts due to an inequality constraint violation (`CVodeGetNumConstraintFails`
and `IDAGetNumConstraintFails`). As a result, constraint failures are no longer
included in the number of step failures due to a solver failure (i.e., the
values returned by `CVodeGetNumStepSolveFails` and `IDAGetNumStepSolveFails`).

### Bug Fixes

The SPRKStep module now accounts for zero coefficients in the SPRK tables, eliminating
extraneous function evaluations.
Fixed a bug in the CVODE(S) inequality constraint handling where the predicted
state was used to compute the step size reduction factor which could lead to an
insufficient reduction in the step size or, when the prediction violates the
constraints, an infinitely large step size in the next step attempt.

The SPRKStep module now accounts for zero coefficients in the SPRK tables,
eliminating extraneous function evaluations.

A bug preventing a user supplied `SUNStepper_ResetCheckpointIndex` function from
being called was fixed.

A bug preventing a user supplied `SUNStepper_ResetCheckpointIndex` function from being
called was fixed.
In CVODES and IDA, added missing return flag names to `CVodeGetReturnFlagName`
and `IDAGetReturnFlagName`, respectively.

### Deprecation Notices

Expand Down
65 changes: 56 additions & 9 deletions doc/cvode/guide/source/Usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,8 @@ Main solver optional input functions
+-------------------------------+---------------------------------------------+----------------+
| **Optional input** | **Function name** | **Default** |
+===============================+=============================================+================+
| Set CVODE options from the | :c:func:`CVodeSetOptions`. | |
| command line or file | | |
| Set CVODE options from the | :c:func:`CVodeSetOptions` | |
| command line or a file | | |
+-------------------------------+---------------------------------------------+----------------+
| User data | :c:func:`CVodeSetUserData` | ``NULL`` |
+-------------------------------+---------------------------------------------+----------------+
Expand Down Expand Up @@ -867,9 +867,12 @@ Main solver optional input functions
| Maximum no. of error test | :c:func:`CVodeSetMaxErrTestFails` | 7 |
| failures | | |
+-------------------------------+---------------------------------------------+----------------+
| Inequality constraints on | :c:func:`CVodeSetConstraints` | |
| Inequality constraints on | :c:func:`CVodeSetConstraints` | disabled |
| solution | | |
+-------------------------------+---------------------------------------------+----------------+
| Maximum number of inequality | :c:func:`CVodeSetMaxNumConstraintFails` | 10 |
| constraint fails in a step | | |
+-------------------------------+---------------------------------------------+----------------+
| Flag to activate specialized | :c:func:`CVodeSetUseIntegratorFusedKernels` | ``SUNFALSE`` |
| fused kernels | | |
+-------------------------------+---------------------------------------------+----------------+
Expand Down Expand Up @@ -1178,7 +1181,6 @@ Main solver optional input functions
This routine will be called by :c:func:`CVodeSetOptions`
when using the key "cvid.interpolate_stop_time".


.. versionadded:: 6.6.0

.. c:function:: int CVodeClearStopTime(void* cvode_mem)
Expand Down Expand Up @@ -1239,7 +1241,28 @@ Main solver optional input functions
* ``CV_ILL_INPUT`` -- The constraints vector contains illegal values.

**Notes:**
The presence of a non-``NULL`` constraints vector that is not 0.0 in all components will cause constraint checking to be performed. However, a call with 0.0 in all components of ``constraints`` will result in an illegal input return. A ``NULL`` constraints vector will disable constraint checking.
The presence of a non-``NULL`` constraints vector that is not 0.0 in all
components will cause constraint checking to be performed. However, a call
with 0.0 in all components of ``constraints`` will result in an illegal
input return. A ``NULL`` constraints vector will disable constraint
checking.

.. c:function:: int CVodeSetMaxNumConstraintFails(void* cvode_mem, int max_fails)

Sets the maximum number of inequality constraint failures allowed in a step
attempt (default 10).

**Arguments:**
* ``cvode_mem`` -- pointer to the CVODE memory block.
* ``max_fail`` -- the maximum number of failures. Passing a value
:math:`\leq 0` will restore the default value.

**Return value:**
* ``CV_SUCCESS`` -- The optional value has been successfully set.
* ``CV_MEM_NULL`` -- The CVODE memory block was not initialized through a
previous call to :c:func:`CVodeCreate`

.. versionadded:: x.y.z

.. c:function:: int CVodeSetUseIntegratorFusedKernels(void* cvode_mem, sunbooleantype onoff)

Expand Down Expand Up @@ -2254,12 +2277,16 @@ the rootfinding algorithm.
* ``CV_MEM_NULL`` -- The CVODE memory block was not initialized through a previous call to :c:func:`CVodeCreate`.

**Notes:**
CVODE will not report the initial conditions as a possible zero-crossing (assuming that one or more components :math:`g_i` are zero at the initial time). However, if it appears that some :math:`g_i` is identically zero at the initial time (i.e., :math:`g_i` is zero at the initial time and after the first step), CVODE will issue a warning which can be disabled with this optional input function.
CVODES will not report the initial conditions as a possible zero-crossing
(assuming that one or more components :math:`g_i` are zero at the initial time).
However, if it appears that some :math:`g_i` is identically zero at the initial
time (i.e., :math:`g_i` is zero at the initial time and after the first step),
CVODES will issue a warning which can be disabled with this optional input
function.

This routine will be called by :c:func:`CVodeSetOptions`
when using the key "cvid.no_inactive_root_warn".


.. _CVODE.Usage.CC.optional_input.optin_proj:

Projection optional input functions
Expand Down Expand Up @@ -2469,6 +2496,9 @@ the preconditioner.
| No. of failed steps due to a nonlinear solver | :c:func:`CVodeGetNumStepSolveFails` |
| failure | |
+-------------------------------------------------+------------------------------------------+
| No. of failed steps due to an inequality | :c:func:`CVodeGetNumConstraintFails` |
| constraint failure | |
+-------------------------------------------------+------------------------------------------+
| Order used during the last step | :c:func:`CVodeGetLastOrder` |
+-------------------------------------------------+------------------------------------------+
| Order to be attempted on the next step | :c:func:`CVodeGetCurrentOrder` |
Expand Down Expand Up @@ -2615,7 +2645,6 @@ described next.
Work space functions will be removed in version 8.0.0.



.. c:function:: int CVodeGetNumSteps(void* cvode_mem, long int *nsteps)

The function ``CVodeGetNumSteps`` returns the cumulative number of internal steps taken by the solver (total so far).
Expand Down Expand Up @@ -2687,7 +2716,26 @@ described next.
* ``CV_SUCCESS`` -- The optional output value has been successfully set.
* ``CV_MEM_NULL`` -- The CVODE memory block was not initialized through a previous call to :c:func:`CVodeCreate`.

.. versionchanged:: x.y.z

In prior versions, inequality constraint failures were included with the
number of step failures due to a nonlinear solver failure. These failures
are now counted separately, see :c:func:`CVodeGetNumConstraintFails`.

.. c:function:: int CVodeGetNumConstraintFails(void* cvode_mem, long int* num_fails_out)

Returns the number of failed steps due to an inequality constraint failure.

**Arguments:**
* ``cvode_mem`` -- pointer to the CVODE memory block.
* ``num_fails_out`` -- number of step failures.

**Return value:**
* ``CV_SUCCESS`` -- The optional output value has been successfully set.
* ``CV_MEM_NULL`` -- The CVODE memory block was not initialized through a
previous call to :c:func:`CVodeCreate`.

.. versionadded:: x.y.z

.. c:function:: int CVodeGetLastOrder(void* cvode_mem, int *qlast)

Expand Down Expand Up @@ -2974,7 +3022,6 @@ described next.
The user is responsible for freeing the returned string.



.. _CVODE.Usage.CC.optional_output.optout_root:

Rootfinding optional output functions
Expand Down
Loading
Loading