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

SUNStepper basics based on MRIStepInnerStepper #463

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1267d97
move MRIStepInnerStepper to SUNStepper
balos1 Apr 29, 2024
19f921c
add advance, onestep, trystep functions
balos1 Apr 29, 2024
ca7768e
revert arkode changes
balos1 May 6, 2024
bf3d836
implement Advance, OneStep, and TryStep
balos1 May 6, 2024
b96f1ee
cleanup
balos1 May 6, 2024
e87e70f
wrap SUNStepper as MRIStepInnerStepper
balos1 May 6, 2024
86db0fe
update sunstepper evolve functions to pass tret and return reason
balos1 May 9, 2024
02fcf40
minor fixes
balos1 Jun 17, 2024
c04f24a
rebase fix
balos1 Jun 21, 2024
f9ff00c
Merge remote-tracking branch 'origin/develop' into feature/sunstepper
balos1 Jul 1, 2024
49e902c
Merge remote-tracking branch 'origin/develop' into feature/sunstepper
balos1 Jul 29, 2024
4be592c
Merge remote-tracking branch 'origin/develop' into feature/sunstepper
balos1 Aug 20, 2024
1a92308
bring up to date
balos1 Aug 20, 2024
3c3a406
move trystep flahs
balos1 Aug 20, 2024
cbfbd79
cleanup
balos1 Aug 20, 2024
e6815d6
add yp arg
balos1 Aug 20, 2024
c7d3f39
add setstoptime
balos1 Aug 20, 2024
b7d7e08
minor fixes
balos1 Aug 22, 2024
491765f
add missing SetForcing declaration
balos1 Aug 22, 2024
bc58f0c
Update src/sundials/sundials_stepper.c
balos1 Aug 22, 2024
e262fb6
Revert y prime argument
Steven-Roberts Aug 29, 2024
7881ddc
Fix compilation warnings
Steven-Roberts Aug 29, 2024
5e03e95
Apply formatter
Steven-Roberts Aug 29, 2024
40ee734
Merge remote-tracking branch 'origin/develop' into feature/sunstepper
balos1 Sep 4, 2024
a082c34
Fix freeing of fused vectors
Steven-Roberts Sep 4, 2024
cb6b0fd
Fix unset variable when creating inner stepper
Steven-Roberts Sep 13, 2024
4e0784a
Merge branch 'develop' into feature/sunstepper
Steven-Roberts Sep 13, 2024
7ba3a87
Merge branch 'develop' into feature/sunstepper
gardner48 Sep 16, 2024
5a110e3
apply formatting
gardner48 Sep 16, 2024
32d6f3d
update f2003 interface
gardner48 Sep 16, 2024
9980090
Changelog
Steven-Roberts Sep 18, 2024
b928595
Merge branch 'develop' into feature/sunstepper
Steven-Roberts Sep 18, 2024
d3ca3b8
Doc fixes
Steven-Roberts Sep 19, 2024
1672e09
Reorder implementation specific methods
Steven-Roberts Sep 19, 2024
12e1c2b
fix typo
balos1 Sep 26, 2024
319d899
ARKstepCreateSUNStepper -> ARKodeCreateSUNStepper
Steven-Roberts Sep 28, 2024
da6e773
Add missing file
Steven-Roberts Sep 28, 2024
a4fc856
Add missing SUNStepper_SetForcing
Steven-Roberts Sep 28, 2024
cd12b43
swig
Steven-Roberts Sep 28, 2024
c7b6cde
Add missing swig file
Steven-Roberts Sep 28, 2024
0c1b84c
Merge branch 'develop' into feature/sunstepper
Steven-Roberts Sep 30, 2024
9d32e88
Finish updating docs after ARKodeCreateSUNStepper refactor
Steven-Roberts Oct 2, 2024
01eba9e
Merge branch 'develop' into feature/sunstepper
Steven-Roberts Oct 2, 2024
13e444e
Reference ARKodeCreateSUNStepper in the SUNStepper docs
Steven-Roberts Oct 2, 2024
03e26d6
Revert ops check change
Steven-Roberts Oct 2, 2024
9f6baab
Mention MRIStepInnerStepper_CreateFromSUNStepper in changelog
Steven-Roberts Oct 2, 2024
b1a3dad
Typo fixes
Steven-Roberts Oct 2, 2024
50cb5a1
Remove extra include
Steven-Roberts Oct 2, 2024
ec8bbde
more cleanup
Steven-Roberts Oct 2, 2024
2a05e5d
Move function to make diff nicer
Steven-Roberts Oct 2, 2024
92a7f17
Improve error handling for MRI inner stepper wrapping SUNStepper
Steven-Roberts Oct 2, 2024
24114fe
document constant that was added
balos1 Oct 2, 2024
ef116d5
Merge branch 'feature/sunstepper' of github.com:LLNL/sundials into fe…
Steven-Roberts Oct 2, 2024
68e1d1e
Remove SUNStepper_TryStep
Steven-Roberts Oct 2, 2024
e24ed27
Revert trystep changes for xbraid
Steven-Roberts Oct 2, 2024
aa7ccc1
Apply formatter
Steven-Roberts Oct 2, 2024
ec41dfa
Typo fix
Steven-Roberts Oct 3, 2024
106022a
Add missing period
Steven-Roberts Oct 3, 2024
81fa70f
Make return consistent
Steven-Roberts Oct 3, 2024
9e95184
Update swig/sundials/fsundials_stepper.i
Steven-Roberts Oct 3, 2024
7158562
Doc style fixes
Steven-Roberts Oct 3, 2024
f9dc452
Merge branch 'feature/sunstepper' of github.com:LLNL/sundials into fe…
Steven-Roberts Oct 3, 2024
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

### New Features and Enhancements

Added the `SUNStepper` base class to represent a generic solution procedure for
IVPs. This is used by the SplittingStep and ForcingStep modules of ARKODE. A
SUNStepper can be created from an ARKODE memory block with the new function
`ARKodeCreateSUNStepper`. To enable interoperability with `MRIStepInnerStepper`,
the function `MRIStepInnerStepper_CreateFromSUNStepper` was added.

The default value of `CMAKE_CUDA_ARCHITECTURES` is no longer set to `70` and is
now determined automatically by CMake. The previous default was only valid for
Volta GPUs while the automatically selected value will vary across compilers and
Expand Down
2 changes: 2 additions & 0 deletions doc/arkode/guide/source/Constants.rst
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ contains the ARKODE output constants.
| :index:`ARK_STEPPER_UNSUPPORTED` | -48 | An operation was not supported by the current |
| | | time-stepping module. |
+-------------------------------------+------+------------------------------------------------------------+
| :index:`ARK_SUNSTEPPER_ERR` | -49 | An error occurred in the SUNStepper module |
+-------------------------------------+------+------------------------------------------------------------+
| :index:`ARK_UNRECOGNIZED_ERROR` | -99 | An unknown error was encountered. |
+-------------------------------------+------+------------------------------------------------------------+
| |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,34 @@ Creating and Destroying an Object
for details on how to attach member data and method function pointers.


.. c:function:: int MRIStepInnerStepper_CreateFromSUNStepper(SUNStepper sunstepper, MRIStepInnerStepper* stepper)

This utility function wraps a :c:type:`SUNStepper` as an
:c:type:`MRIStepInnerStepper`.

**Arguments:**
* ``sunctx`` -- the SUNDIALS simulation context.
* ``sunstepper`` -- the c:type:`SUNStepper` to wrap.
* ``stepper`` -- a pointer to an MRI inner stepper object.

**Return value:**
* ARK_SUCCESS if successful
* ARK_MEM_FAIL if a memory allocation error occurs

**Example usage:**

.. code-block:: C

SUNStepper sunstepper = NULL;
SUNStepper_Create(ctx, &sunstepper);
/* Attach content and functions to the SUNStepper... */

MRIStepInnerStepper inner_stepper = NULL;
flag = MRIStepInnerStepper_Create(sunstepper, &inner_stepper);

.. versionadded:: x.y.z


.. c:function:: int MRIStepInnerStepper_Free(MRIStepInnerStepper *stepper)

This function destroys an :c:type:`MRIStepInnerStepper` object.
Expand Down
23 changes: 23 additions & 0 deletions doc/arkode/guide/source/Usage/User_callable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4685,3 +4685,26 @@ rescale the upcoming time step by the specified factor. If a value
* ``examples/arkode/C_serial/ark_heat1D_adapt.c``

.. versionadded:: 6.1.0



.. _ARKODE.Usage.SUNStepperInterface:

Using an ARKODE solver as a SUNStepper
--------------------------------------

The utility function :c:func:`ARKodeCreateSUNStepper` wraps an ARKODE memory
block as a :c:type:`SUNStepper`.

.. c:function:: int ARKodeCreateSUNStepper(void *inner_arkode_mem, SUNStepper *stepper)

Wraps an ARKODE integrator as a :c:type:`SUNStepper`.

:param arkode_mem: pointer to the ARKODE memory block.
:param stepper: the :c:type:`SUNStepper` object.

:retval ARK_SUCCESS: the function exited successfully.
:retval ARK_MEM_FAIL: a memory allocation failed.
:retval ARK_SUNSTEPPER_ERR: the :c:type:`SUNStepper` initialization failed.

.. versionadded:: x.y.z
1 change: 1 addition & 0 deletions doc/arkode/guide/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ with support by the `US Department of Energy <http://www.doe.gov>`_,
sunlinsol/index.rst
sunnonlinsol/index.rst
sunadaptcontroller/index.rst
sunstepper/index.rst
sunmemory/index.rst
sundials/Install_link.rst
Constants
Expand Down
14 changes: 14 additions & 0 deletions doc/arkode/guide/source/sunstepper/SUNStepper_links.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.. ----------------------------------------------------------------
SUNDIALS Copyright Start
Copyright (c) 2002-2024, Lawrence Livermore National Security
and Southern Methodist University.
All rights reserved.
See the top-level LICENSE and NOTICE files for details.
SPDX-License-Identifier: BSD-3-Clause
SUNDIALS Copyright End
----------------------------------------------------------------
.. include:: ../../../../shared/sunstepper/SUNStepper_Description.rst
.. include:: ../../../../shared/sunstepper/SUNStepper_Implementing.rst
44 changes: 44 additions & 0 deletions doc/arkode/guide/source/sunstepper/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.. ----------------------------------------------------------------
Programmer(s): Steven B. Roberts @ LLNL
----------------------------------------------------------------
SUNDIALS Copyright Start
Copyright (c) 2002-2024, Lawrence Livermore National Security
and Southern Methodist University.
All rights reserved.

See the top-level LICENSE and NOTICE files for details.

SPDX-License-Identifier: BSD-3-Clause
SUNDIALS Copyright End
----------------------------------------------------------------

.. _SUNStepper:

#####################################
Stepper Data Structure
#####################################

This section presents the :c:type:`SUNStepper` base class which represents a
generic solution procedure for IVPs of the form

.. math::
\dot{v}(t) = f(t, v) + r(t), \qquad v(t_0) = v_0,
:label: SUNStepper_IVP

on an interval :math:`t \in [t_0, t_f]`. The time dependent forcing term,
:math:`r_i(t)`, is given by

.. math::
r(t) = \sum_{k = 0}^{n_{\text{forcing}}}
\frac{t - t_{\text{shift}}}{t_{\text{scale}}} \widehat{f}_k.
:label: SUNStepper_forcing

:c:type:`SUNStepper` provides an abstraction over SUNDIALS integrators, custom
integrators, exact solution procedures, or other approaches for solving
:eq:`SUNStepper_IVP`. These are used, for example, in operator splitting and
forcing methods to solve inner IVPs in a flexible way.

.. toctree::
:maxdepth: 1

SUNStepper_links.rst
9 changes: 9 additions & 0 deletions doc/shared/RecentChanges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

**New Features and Enhancements**

Added the :c:type:`SUNStepper` base class to represent a generic solution
procedure for IVPs. This is used by the
:ref:`SplittingStep <ARKODE.Usage.SplittingStep>` and
:ref:`ForcingStep <ARKODE.Usage.ForcingStep>` modules of ARKODE. A SUNStepper
can be created from an ARKODE memory block with the new function
:c:func:`ARKodeCreateSUNStepper`. To enable interoperability with
:c:type:`MRIStepInnerStepper`, the function
:c:func:`MRIStepInnerStepper_CreateFromSUNStepper` was added.

The default value of :cmakeop:`CMAKE_CUDA_ARCHITECTURES` is no longer set to
``70`` and is now determined automatically by CMake. The previous default was
only valid for Volta GPUs while the automatically selected value will vary
Expand Down
Loading
Loading