Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tstop-copy #292

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ Updated the F2003 utility routines `SUNDIALSFileOpen` and `SUNDIALSFileClose`
to support user specification of `stdout` and `stderr` strings for the output
file names.

Updated CVODE, CVODES and ARKODE default behavior when returning the solution when
the internal time has reached a user-specified stop time. Previously, the output
solution was interpolated to the value of `tstop`; the default is now to copy the
internal solution vector. Users who wish to revert to interpolation may call a new
routine `CVodeInterpolateStopTime`, `ARKStepInterpolateStopTime`,
`ERKStepInterpolateStopTime`, or `MRIStepInterpolateStopTime`.

## Changes to SUNDIALS in release 6.5.1

Added the functions `ARKStepClearStopTime`, `ERKStepClearStopTime`,
Expand Down
7 changes: 7 additions & 0 deletions doc/arkode/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ Updated the F2003 utility routines :c:func:`SUNDIALSFileOpen` and :c:func:`SUNDI
to support user specification of ``stdout`` and ``stderr`` strings for the output
file names.

Updated the default ARKODE behavior when returning the solution when
the internal time has reached a user-specified stop time. Previously, the output
solution was interpolated to the value of ``tstop``; the default is now to copy the
internal solution vector. Users who wish to revert to interpolation may call a new
routine :c:func:`ARKStepInterpolateStopTime`, :c:func:`ERKStepInterpolateStopTime`,
or :c:func:`MRIStepInterpolateStopTime`.

Changes in v5.5.1
-----------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,7 @@ Maximum no. of internal steps before *tout* :c:func:`ARKStepSetMaxNumSteps
Maximum absolute step size :c:func:`ARKStepSetMaxStep` :math:`\infty`
Minimum absolute step size :c:func:`ARKStepSetMinStep` 0.0
Set a value for :math:`t_{stop}` :c:func:`ARKStepSetStopTime` undefined
Interpolate at :math:`t_{stop}` :c:func:`ARKStepInterpolateStopTime` ``SUNFALSE``
Disable the stop time :c:func:`ARKStepClearStopTime` N/A
Supply a pointer for user data :c:func:`ARKStepSetUserData` ``NULL``
Maximum no. of ARKStep error test failures :c:func:`ARKStepSetMaxErrTestFails` 7
Expand Down Expand Up @@ -1267,6 +1268,23 @@ Set max number of constraint failures :c:func:`ARKStepSetMaxNumConst
:c:func:`ARKStepClearStopTime`.


.. c:function:: int ARKStepInterpolateStopTime(void* arkode_mem, booleantype interp)

Specifies that the output solution should be interpolated when the current
:math:`t` equals the specified ``tstop`` (instead of merely copying the
internal solution :math:`y_n`).

**Arguments:**
* *arkode_mem* -- pointer to the ARKStep memory block.
* *interp* -- flag indicating to use interpolation (1) or copy (0).

**Return value:**
* *ARK_SUCCESS* if successful
* *ARK_MEM_NULL* if the ARKStep memory is ``NULL``

.. versionadded:: 5.6.0


.. c:function:: int ARKStepClearStopTime(void* arkode_mem)

Disables the stop time set with :c:func:`ARKStepSetStopTime`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ Optional inputs for ERKStep
+----------------------------------------------------+-----------------------------------------+------------------------+
| Set a value for :math:`t_{stop}` | :c:func:`ERKStepSetStopTime()` | undefined |
+----------------------------------------------------+-----------------------------------------+------------------------+
| Interpolate at :math:`t_{stop}` | :c:func:`ERKStepInterpolateStopTime()` | ``SUNFALSE`` |
+----------------------------------------------------+-----------------------------------------+------------------------+
| Disable the stop time | :c:func:`ERKStepClearStopTime` | N/A |
+----------------------------------------------------+-----------------------------------------+------------------------+
| Supply a pointer for user data | :c:func:`ERKStepSetUserData()` | ``NULL`` |
Expand Down Expand Up @@ -886,6 +888,23 @@ Optional inputs for ERKStep
:c:func:`ERKStepClearStopTime`.


.. c:function:: int ERKStepInterpolateStopTime(void* arkode_mem, booleantype interp)

Specifies that the output solution should be interpolated when the current
:math:`t` equals the specified ``tstop`` (instead of merely copying the
internal solution :math:`y_n`).

**Arguments:**
* *arkode_mem* -- pointer to the ERKStep memory block.
* *interp* -- flag indicating to use interpolation (1) or copy (0).

**Return value:**
* *ARK_SUCCESS* if successful
* *ARK_MEM_NULL* if the ARKStep memory is ``NULL``

.. versionadded:: 5.6.0


.. c:function:: int ERKStepClearStopTime(void* arkode_mem)

Disables the stop time set with :c:func:`ERKStepSetStopTime`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,8 @@ Optional inputs for MRIStep
+---------------------------------------------------------------+-----------------------------------------+------------------------+
| Set a value for :math:`t_{stop}` | :c:func:`MRIStepSetStopTime()` | undefined |
+---------------------------------------------------------------+-----------------------------------------+------------------------+
| Interpolate at :math:`t_{stop}` | :c:func:`MRIStepInterpolateStopTime()` | ``SUNFALSE`` |
+---------------------------------------------------------------+-----------------------------------------+------------------------+
| Disable the stop time | :c:func:`MRIStepClearStopTime` | N/A |
+---------------------------------------------------------------+-----------------------------------------+------------------------+
| Supply a pointer for user data | :c:func:`MRIStepSetUserData()` | ``NULL`` |
Expand Down Expand Up @@ -1105,6 +1107,23 @@ Optional inputs for MRIStep
:c:func:`MRIStepClearStopTime`.


.. c:function:: int MRIStepInterpolateStopTime(void* arkode_mem, booleantype interp)

Specifies that the output solution should be interpolated when the current
:math:`t` equals the specified ``tstop`` (instead of merely copying the
internal solution :math:`y_n`).

**Arguments:**
* *arkode_mem* -- pointer to the MRIStep memory block.
* *interp* -- flag indicating to use interpolation (1) or copy (0).

**Return value:**
* *ARK_SUCCESS* if successful
* *ARK_MEM_NULL* if the ARKStep memory is ``NULL``

.. versionadded:: 5.6.0


.. c:function:: int MRIStepClearStopTime(void* arkode_mem)

Disables the stop time set with :c:func:`MRIStepSetStopTime`.
Expand Down
6 changes: 6 additions & 0 deletions doc/cvode/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ Updated the F2003 utility routines :c:func:`SUNDIALSFileOpen` and :c:func:`SUNDI
to support user specification of ``stdout`` and ``stderr`` strings for the output
file names.

Updated the default CVODE behavior when returning the solution when
the internal time has reached a user-specified stop time. Previously, the output
solution was interpolated to the value of ``tstop``; the default is now to copy the
internal solution vector. Users who wish to revert to interpolation may call the
routine :c:func:`CVodeInterpolateStopTime`.

Changes in v6.5.1
-----------------

Expand Down
19 changes: 19 additions & 0 deletions doc/cvode/guide/source/Usage/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,9 @@ Main solver optional input functions
+-------------------------------+---------------------------------------------+----------------+
| Value of :math:`t_{stop}` | :c:func:`CVodeSetStopTime` | undefined |
+-------------------------------+---------------------------------------------+----------------+
| Interpolate at | :c:func:`CVodeInterpolateStopTime` | ``SUNFALSE`` |
| :math:`t_{stop}` | | |
+-------------------------------+---------------------------------------------+----------------+
| Disable the stop time | :c:func:`CVodeClearStopTime` | N/A |
+-------------------------------+---------------------------------------------+----------------+
| Maximum no. of error test | :c:func:`CVodeSetMaxErrTestFails` | 7 |
Expand Down Expand Up @@ -1091,6 +1094,22 @@ Main solver optional input functions
A stop time not reached before a call to :c:func:`CVodeReInit` will
remain active but can be disabled by calling :c:func:`CVodeClearStopTime`.

.. c:function:: int CVodeInterpolateStopTime(void* cvode_mem, booleantype interp)

The function ``CVodeInterpolateStopTime`` specifies that the output solution should be
interpolated when the current :math:`t` equals the specified ``tstop`` (instead of
merely copying the internal solution :math:`y_n`).

**Arguments:**
* ``cvode_mem`` -- pointer to the CVODES memory block.
* ``interp`` -- flag indicating to use interpolation (1) or copy (0).

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

.. versionadded:: 6.6.0

.. c:function:: int CVodeClearStopTime(void* cvode_mem)

Disables the stop time set with :c:func:`CVodeSetStopTime`.
Expand Down
6 changes: 6 additions & 0 deletions doc/cvodes/guide/source/Introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ Updated the F2003 utility routines :c:func:`SUNDIALSFileOpen` and :c:func:`SUNDI
to support user specification of ``stdout`` and ``stderr`` strings for the output
file names.

Updated the default CVODES behavior when returning the solution when
the internal time has reached a user-specified stop time. Previously, the output
solution was interpolated to the value of ``tstop``; the default is now to copy the
internal solution vector. Users who wish to revert to interpolation may call the
routine :c:func:`CVodeInterpolateStopTime`.

Changes in v6.5.1
-----------------

Expand Down
96 changes: 57 additions & 39 deletions doc/cvodes/guide/source/Usage/SIM.rst
Original file line number Diff line number Diff line change
Expand Up @@ -829,45 +829,47 @@ Main solver optional input functions

.. table:: Optional inputs for CVODES

+-------------------------------+---------------------------------------------+----------------+
| **Optional input** | **Function name** | **Default** |
+===============================+=============================================+================+
| Pointer to an error file | :c:func:`CVodeSetErrFile` | ``stderr`` |
+-------------------------------+---------------------------------------------+----------------+
| Error handler function | :c:func:`CVodeSetErrHandlerFn` | internal fn. |
+-------------------------------+---------------------------------------------+----------------+
| User data | :c:func:`CVodeSetUserData` | ``NULL`` |
+-------------------------------+---------------------------------------------+----------------+
| Maximum order for BDF method | :c:func:`CVodeSetMaxOrd` | 5 |
+-------------------------------+---------------------------------------------+----------------+
| Maximum order for Adams | :c:func:`CVodeSetMaxOrd` | 12 |
| method | | |
+-------------------------------+---------------------------------------------+----------------+
| Maximum no. of internal steps | :c:func:`CVodeSetMaxNumSteps` | 500 |
| before :math:`t_{out}` | | |
+-------------------------------+---------------------------------------------+----------------+
| Maximum no. of warnings for | :c:func:`CVodeSetMaxHnilWarns` | 10 |
| :math:`t_n+h=t_n` | | |
+-------------------------------+---------------------------------------------+----------------+
| Flag to activate stability | :c:func:`CVodeSetStabLimDet` | ``SUNFALSE`` |
| limit detection | | |
+-------------------------------+---------------------------------------------+----------------+
| Initial step size | :c:func:`CVodeSetInitStep` | estimated |
+-------------------------------+---------------------------------------------+----------------+
| Minimum absolute step size | :c:func:`CVodeSetMinStep` | 0.0 |
+-------------------------------+---------------------------------------------+----------------+
| Maximum absolute step size | :c:func:`CVodeSetMaxStep` | :math:`\infty` |
+-------------------------------+---------------------------------------------+----------------+
| Value of :math:`t_{stop}` | :c:func:`CVodeSetStopTime` | undefined |
+-------------------------------+---------------------------------------------+----------------+
| Disable the stop time | :c:func:`CVodeClearStopTime` | N/A |
+-------------------------------+---------------------------------------------+----------------+
| Maximum no. of error test | :c:func:`CVodeSetMaxErrTestFails` | 7 |
| failures | | |
+-------------------------------+---------------------------------------------+----------------+
| Inequality constraints on | :c:func:`CVodeSetConstraints` | |
| solution | | |
+-------------------------------+---------------------------------------------+----------------+
+---------------------------------+---------------------------------------------+----------------+
| **Optional input** | **Function name** | **Default** |
+=================================+=============================================+================+
| Pointer to an error file | :c:func:`CVodeSetErrFile` | ``stderr`` |
+---------------------------------+---------------------------------------------+----------------+
| Error handler function | :c:func:`CVodeSetErrHandlerFn` | internal fn. |
+---------------------------------+---------------------------------------------+----------------+
| User data | :c:func:`CVodeSetUserData` | ``NULL`` |
+---------------------------------+---------------------------------------------+----------------+
| Maximum order for BDF method | :c:func:`CVodeSetMaxOrd` | 5 |
+---------------------------------+---------------------------------------------+----------------+
| Maximum order for Adams | :c:func:`CVodeSetMaxOrd` | 12 |
| method | | |
+---------------------------------+---------------------------------------------+----------------+
| Maximum no. of internal steps | :c:func:`CVodeSetMaxNumSteps` | 500 |
| before :math:`t_{out}` | | |
+---------------------------------+---------------------------------------------+----------------+
| Maximum no. of warnings for | :c:func:`CVodeSetMaxHnilWarns` | 10 |
| :math:`t_n+h=t_n` | | |
+---------------------------------+---------------------------------------------+----------------+
| Flag to activate stability | :c:func:`CVodeSetStabLimDet` | ``SUNFALSE`` |
| limit detection | | |
+---------------------------------+---------------------------------------------+----------------+
| Initial step size | :c:func:`CVodeSetInitStep` | estimated |
+---------------------------------+---------------------------------------------+----------------+
| Minimum absolute step size | :c:func:`CVodeSetMinStep` | 0.0 |
+---------------------------------+---------------------------------------------+----------------+
| Maximum absolute step size | :c:func:`CVodeSetMaxStep` | :math:`\infty` |
+---------------------------------+---------------------------------------------+----------------+
| Value of :math:`t_{stop}` | :c:func:`CVodeSetStopTime` | undefined |
+---------------------------------+---------------------------------------------+----------------+
| Interpolate at :math:`t_{stop}` | :c:func:`CVodeInterpolateStopTime` | ``SUNFALSE`` |
+---------------------------------+---------------------------------------------+----------------+
| Disable the stop time | :c:func:`CVodeClearStopTime` | N/A |
+---------------------------------+---------------------------------------------+----------------+
| Maximum no. of error test | :c:func:`CVodeSetMaxErrTestFails` | 7 |
| failures | | |
+---------------------------------+---------------------------------------------+----------------+
| Inequality constraints on | :c:func:`CVodeSetConstraints` | |
| solution | | |
+---------------------------------+---------------------------------------------+----------------+


.. c:function:: int CVodeSetErrFile(void* cvode_mem, FILE * errfp)
Expand Down Expand Up @@ -1096,6 +1098,22 @@ Main solver optional input functions
A stop time not reached before a call to :c:func:`CVodeReInit` will
remain active but can be disabled by calling :c:func:`CVodeClearStopTime`.

.. c:function:: int CVodeInterpolateStopTime(void* cvode_mem, booleantype interp)

The function ``CVodeInterpolateStopTime`` specifies that the output solution should be
interpolated when the current :math:`t` equals the specified ``tstop`` (instead of
merely copying the internal solution :math:`y_n`).

**Arguments:**
* ``cvode_mem`` -- pointer to the CVODES memory block.
* ``interp`` -- flag indicating to use interpolation (1) or copy (0).

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

.. versionadded:: 6.6.0

.. c:function:: int CVodeClearStopTime(void* cvode_mem)

Disables the stop time set with :c:func:`CVodeSetStopTime`.
Expand Down
2 changes: 2 additions & 0 deletions include/arkode/arkode_arkstep.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ SUNDIALS_EXPORT int ARKStepSetMinStep(void *arkode_mem,
realtype hmin);
SUNDIALS_EXPORT int ARKStepSetMaxStep(void *arkode_mem,
realtype hmax);
SUNDIALS_EXPORT int ARKStepInterpolateStopTime(void *arkode_mem,
balos1 marked this conversation as resolved.
Show resolved Hide resolved
booleantype interp);
SUNDIALS_EXPORT int ARKStepSetStopTime(void *arkode_mem,
realtype tstop);
SUNDIALS_EXPORT int ARKStepClearStopTime(void *arkode_mem);
Expand Down
Loading