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

Feature/sprkstep #290

Merged
merged 180 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
bed0356
add kepler problem and try sprk butcher tables
balos1 Jul 16, 2022
ba62d1d
fix missing return
balos1 Jul 19, 2022
2290ec0
optimize rhs
balos1 Jul 19, 2022
49ccfff
code working, plot is as it should be
balos1 Jul 20, 2022
cc5fc3c
some upgrades to plotting and example
balos1 Jul 20, 2022
bc61104
switch to one step mode to avoid interpolation
balos1 Jul 22, 2022
3a25237
add increment SPRK algorithm with compensated sums (works for sprk or…
balos1 Jul 22, 2022
f115811
avoid dense output when we can
balos1 Jul 23, 2022
614b027
move terr to ark mem
balos1 Jul 25, 2022
4c0865d
use tstop instead of compensated sums for tcur
balos1 Jul 25, 2022
b92d667
fix SprkInc implementation
balos1 Jul 26, 2022
7dd6f58
fix regular sprk implementation
balos1 Jul 26, 2022
93988e7
cleanup
balos1 Jul 26, 2022
0009d07
use sdata
balos1 Jul 26, 2022
d80ffb7
fix 2nd order table
balos1 Jul 29, 2022
72cf56a
update TakeStep_Z to work with sprk
balos1 Jul 29, 2022
523f10a
use less storage in sprk special implementations
balos1 Jul 29, 2022
36f5692
adapt working sort of
balos1 Aug 6, 2022
49a8315
fix methods, add 4th order, adjust adaptivity
balos1 Aug 11, 2022
d42960e
small improvements/fixes
balos1 Aug 11, 2022
4661e9a
save work
balos1 Oct 4, 2022
6ec26bf
sprk stepper compiles and runs, but answer is wrong
balos1 Mar 15, 2023
f3a013b
revert changes that were in arkstep
balos1 Mar 16, 2023
67f4d76
some minor fixes, still looking for segfault issue
balos1 Mar 16, 2023
5b627f8
changes in arkode related to comp summation
balos1 Mar 16, 2023
f0bd9d7
add a bunch more methods
balos1 Mar 16, 2023
ffe5bd2
changes in arkode for compensated sums
balos1 Mar 17, 2023
8146717
redo incremental formulation
balos1 Mar 18, 2023
b0b46e7
fix some io options
balos1 Mar 18, 2023
c2d6188
fix mc2
balos1 Mar 18, 2023
bbd5500
udpates that fix convergence (mostly)
balos1 Mar 29, 2023
a4e9524
various cleanup of unused functions
balos1 Mar 31, 2023
e6a3cb6
cleanup the vectors being used
balos1 Mar 31, 2023
d1f61ea
remove perturbed code
balos1 Mar 31, 2023
8734961
remove perturbed code
balos1 Mar 31, 2023
d58362d
remove perturbed code
balos1 Mar 31, 2023
f409a05
update example documentation
balos1 Mar 31, 2023
f9631d8
format
balos1 Mar 31, 2023
ef41db0
updates for adaptivity
balos1 Mar 31, 2023
13bb42e
format sprkstep
balos1 Mar 31, 2023
c05c186
add rootfinding
balos1 Mar 31, 2023
2908a6c
add missing stdio include
balos1 Mar 31, 2023
941b862
add hookes law example
balos1 Apr 1, 2023
b3950c6
add out files and fix hookes law problem
balos1 Apr 3, 2023
15d3b74
order
balos1 Apr 18, 2023
e1cdc68
use lagrange interpolant
balos1 Apr 21, 2023
3b463dd
update plot scripts
balos1 Apr 23, 2023
78fb0eb
fix adaptive step control (sort-of)
balos1 Apr 23, 2023
0f2eedd
docs
balos1 Jun 8, 2023
e60b878
finish mathematics section
balos1 Jun 9, 2023
43c2c87
cleanup unused functions and add their docs
balos1 Jun 9, 2023
fe51662
automatically use tstop mode if a fixed step is used
balos1 Jun 11, 2023
820ec83
add skeleton
balos1 Jun 11, 2023
680607a
add example paths to index
balos1 Jun 12, 2023
386244b
Revert "automatically use tstop mode if a fixed step is used"
balos1 Jun 12, 2023
dad6499
add better command line arguments
balos1 Jun 12, 2023
476a252
add comment regarding SetStopTime use
balos1 Jun 12, 2023
ed8845f
add SPRKStep to ARKODE introduction
balos1 Jun 12, 2023
0d14ca0
cross-verify docs and header/impls
balos1 Jun 12, 2023
d5becec
add support of postprocess functions
balos1 Jun 12, 2023
6046cec
remove inner stepper routine for now
balos1 Jun 12, 2023
b5d6975
add SPRK methods to Butcher section
balos1 Jun 13, 2023
ceda918
add stage number to method constants
balos1 Jun 13, 2023
de9fc58
ARKodeSPRKMem --> ARKodeSPRKStorage
balos1 Jun 14, 2023
71ce30d
add loadbyname function
balos1 Jun 15, 2023
8451e08
add ability to provide method name
balos1 Jun 15, 2023
045b4df
remove adaptivity
balos1 Jun 15, 2023
ff4ba8e
remove remaining adaptivity prototypes
balos1 Jun 15, 2023
14609b5
add SPRK constants to constants table
balos1 Jun 15, 2023
a9dc3d5
clean up plotting scripts
balos1 Jun 16, 2023
c9e0f53
update cmake to test order
balos1 Jun 16, 2023
7b79293
update answers module to point to staging
balos1 Jun 17, 2023
82fd037
clean up order check
balos1 Jun 17, 2023
8f2e4b3
further updates
balos1 Jun 18, 2023
6fa53dc
update tarscript
balos1 Jun 18, 2023
b3bc745
update defaults
balos1 Jun 18, 2023
49f6e8f
remove extra script
balos1 Jun 19, 2023
6e41fc4
add baseline output for examples
balos1 Jun 19, 2023
4a8e1ec
doc and tarscript updates
balos1 Jun 19, 2023
60d88d9
update docs
balos1 Jun 19, 2023
b1158f5
update examples
balos1 Jun 19, 2023
51ef530
remove extra underscore
balos1 Jun 19, 2023
3b282c8
update example header
balos1 Jun 19, 2023
9c605e3
clean up
balos1 Jun 19, 2023
ce6a40b
remove guard on arkGetDky
balos1 Jun 19, 2023
ea04dd4
bump answers
balos1 Jun 19, 2023
c9f6cae
update answers
balos1 Jun 19, 2023
cb05f49
fix ark profiler reference and tidy
balos1 Jun 20, 2023
afa2d28
revert accidental change
balos1 Jun 20, 2023
3e5d80f
fix warnings
balos1 Jun 20, 2023
ca75d16
bump answers
balos1 Jun 20, 2023
6afd907
Apply suggestions from code review
balos1 Jun 22, 2023
b94ea11
reduce number of output times in ark_kepler
balos1 Jun 27, 2023
159908d
add more details to changelog
balos1 Jun 27, 2023
fcea98e
fix function names
balos1 Jun 27, 2023
c72c814
fix notation
balos1 Jun 27, 2023
22bdbb0
a bunch of fixes for PR comments
balos1 Jun 27, 2023
9d480a8
Update src/arkode/arkode_sprkstep.c
balos1 Jun 27, 2023
a92e7d3
remove controller reference
balos1 Jun 27, 2023
2f2a8d4
check that order is within bounds
balos1 Jun 27, 2023
c8072ac
doc updates
balos1 Jun 27, 2023
99d1fa4
move yerr to SPRKStep
balos1 Jun 27, 2023
50dbd3f
revert bad change
balos1 Jun 27, 2023
957ce97
compute coefficients directly for 3rd order MacLachlan
balos1 Jun 27, 2023
8733615
add 6th order Yoshida coefficients for extended precision
balos1 Jun 28, 2023
a1f639b
add 8th order McLachlan extended precision coefficients
balos1 Jun 28, 2023
c4d2fae
Update doc/arkode/guide/source/Mathematics.rst
balos1 Jun 28, 2023
32d56e2
remove unused header
balos1 Jun 28, 2023
0da5fef
update McLachlan 8 name
balos1 Jun 28, 2023
c010d8b
change ARKODE_SYMPLECTIC to ARKODE_SPRK
balos1 Jun 29, 2023
74383d7
address more PR comments
balos1 Jun 29, 2023
904f17b
update references
balos1 Jun 29, 2023
c00d71e
add time-dependent example and discuss it in math section
balos1 Jun 30, 2023
df18fa4
Update doc/arkode/guide/source/ARKodeSPRKStorage.rst
balos1 Jun 30, 2023
f2861e5
fix example
balos1 Jun 30, 2023
7d9b845
change to time-dependent example
balos1 Jun 30, 2023
c7ce1e5
remove unused macros
balos1 Jun 30, 2023
aeaf39e
get rid of M_PI
balos1 Jun 30, 2023
187c80f
fix malformed tables
balos1 Jun 30, 2023
648fa87
fix reference
balos1 Jun 30, 2023
8458c79
give full filenames for out files in tarscript
balos1 Jun 30, 2023
e4cce85
fix all warnings
balos1 Jun 30, 2023
4bc3ecc
fix set but unused warning
balos1 Jun 30, 2023
171d5bd
fix output precisions
balos1 Jul 6, 2023
b5613d3
add warning about precision for McLachlan 4 and 5
balos1 Jul 6, 2023
82f66b6
Merge remote-tracking branch 'origin/develop' into feature/sprkstep
balos1 Jul 6, 2023
d20dfd2
fix unused variable error
balos1 Jul 6, 2023
6d4e813
gen fortran
balos1 Jul 6, 2023
8e72a69
bump answers
balos1 Jul 6, 2023
dcd1eed
fix typo
balos1 Jul 6, 2023
e238519
fix out file names
balos1 Jul 6, 2023
50c04e8
update outputs from test machine
gardner48 Jul 8, 2023
a780a4f
address many PR comments
balos1 Jul 17, 2023
5ef29c4
address more comments
balos1 Jul 17, 2023
5309216
change ARKSPRKStorage to ARKSPRKTable
balos1 Jul 17, 2023
55c2669
adress remaining comments
balos1 Jul 17, 2023
58f3c6f
regen fortran
balos1 Jul 17, 2023
8d9c676
bump answers
balos1 Jul 17, 2023
f4f0b63
fix memory leak
balos1 Jul 17, 2023
5646341
fix remaining PR comments
balos1 Jul 18, 2023
048d06c
Merge remote-tracking branch 'origin/develop' into feature/sprkstep
balos1 Jul 18, 2023
8d7c3d7
remove duplicates from merge
balos1 Jul 18, 2023
9886364
fix table spacing
gardner48 Jul 18, 2023
217f29c
fix reference
gardner48 Jul 18, 2023
14ca738
remove duplicate array end
gardner48 Jul 18, 2023
175dfa2
update answers submodule commit
gardner48 Jul 18, 2023
09315ed
add missing ARKSPRKTable_Crate implementation, regen F2003
gardner48 Jul 18, 2023
317bd8a
symplectic to sprk in tarscript .out files
gardner48 Jul 18, 2023
fba5fb9
add Create implementation
balos1 Jul 18, 2023
d43be32
regen f2003
gardner48 Jul 18, 2023
aa2c9b3
fix C90 error
gardner48 Jul 18, 2023
ffc415b
add sprkstep f2003 files to tarscript
gardner48 Jul 18, 2023
48344d9
install headers for examples
balos1 Jul 18, 2023
48c38c6
Merge remote-tracking branch 'origin/develop' into feature/sprkstep
balos1 Jul 18, 2023
da891c5
various doc formatting fixes
gardner48 Jul 18, 2023
dce46ae
install sprk headers
gardner48 Jul 18, 2023
16d1ab6
update output files
gardner48 Jul 19, 2023
d4a3800
add into text for SPRK table type
gardner48 Jul 19, 2023
d62ce6b
storage to table
gardner48 Jul 19, 2023
febcafb
fix signature types in doc
gardner48 Jul 19, 2023
67fd7b9
add into text for method list
gardner48 Jul 19, 2023
3aec87e
move table storage details to table strucutre section
gardner48 Jul 19, 2023
e34acf0
remove structure, refer to type
gardner48 Jul 19, 2023
8efa793
remove return in docs for void function
gardner48 Jul 19, 2023
858cd00
minor updates to math section
gardner48 Jul 19, 2023
6713fde
add copyright block
gardner48 Jul 19, 2023
3dacbef
structure and storage to table
gardner48 Jul 19, 2023
393fddb
use their for user pronoun
gardner48 Jul 19, 2023
a40ec54
fix incomplete sentence
gardner48 Jul 19, 2023
3e4fa1d
fix typo
gardner48 Jul 19, 2023
b84a5cb
clarify context
gardner48 Jul 19, 2023
49e960e
fix typo
gardner48 Jul 19, 2023
bba8319
remove incorrect comment
gardner48 Jul 19, 2023
f793b1f
remove double allocation of a and ahat
gardner48 Jul 19, 2023
b43aaf9
free table on failure
gardner48 Jul 19, 2023
f3eeb96
use linear interpolant for first degree method
gardner48 Jul 19, 2023
8f5bd51
bump answers
balos1 Jul 19, 2023
3255d3b
bump answers
balos1 Jul 19, 2023
2f71186
update double
balos1 Jul 19, 2023
cf4aee4
update answers submodule
gardner48 Jul 19, 2023
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
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# This should be applied to all new code. See the developer documentation.
# ------------------------------------------------------------------------------
---
Checks: '-*,clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,-cppcoreguidelines-explicit-virtual-functions,-cppcoreguidelines-pro-bounds-pointer-arithmetic,google-*,-google-explicit-constructor,modernize-*,-modernize-use-trailing-return-type,mpi-*'
Checks: '-*,clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,-cppcoreguidelines-explicit-virtual-functions,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-avoid-magic-numbers,google-*,-google-explicit-constructor,modernize-*,-modernize-use-trailing-return-type,mpi-*,readability-*,-readability-magic-numbers,-readability-identifier-length'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Updated the F2003 utility routines `SUNDIALSFileOpen` and `SUNDIALSFileClose`
to support user specification of `stdout` and `stderr` strings for the output
file names.

A new time-stepping module, `SPRKStep`, was added to ARKODE. This time-stepper
provides explicit symplectic partitioned Runge-Kutta methods up to order 10
for separable Hamiltonian systems.

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
Expand Down
184 changes: 184 additions & 0 deletions doc/arkode/guide/source/ARKodeSPRKTable.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
.. ----------------------------------------------------------------
SUNDIALS Copyright Start
Copyright (c) 2002-2023, 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
----------------------------------------------------------------

.. _ARKodeSPRKTable:

===========================
SPRK Method Table Structure
===========================

To store the pair of Butcher tables defining a SPRK method of order :math:`q`
ARKODE provides the :c:type:`ARKodeSPRKTable` type and several related utility
routines. We use the following notation

.. math::

B \; \equiv \;
\begin{array}{r|c}
c & A \\
\hline
& b \\
\end{array}
\; = \;
\begin{array}{c|cccc}
c_1 & 0 & \cdots & 0 & 0 \\
c_2 & a_1 & 0 & \cdots & \vdots \\
\vdots & \vdots & \ddots & \ddots & \vdots \\
c_s & a_1 & \cdots & a_{s-1} & 0 \\
\hline
& a_1 & \cdots & a_{s-1} & a_s
\end{array}
\qquad
\qquad
\hat{B} \; \equiv \;
\begin{array}{r|c}
\hat{c} & \hat{A} \\
\hline
& \hat{b} \\
\end{array}
\; = \;
\begin{array}{c|cccc}
\hat{c}_1 & \hat{a}_1 & \cdots & 0 & 0 \\
\hat{c}_2 & \hat{a}_1 & \hat{a}_2 & \cdots & \vdots \\
\vdots & \vdots & \ddots & \ddots & \vdots \\
\hat{c}_s & \hat{a}_1 & \hat{a}_2 & \cdots & \hat{a}_{s} \\
\hline
& \hat{a}_1 & \hat{a}_2 & \cdots & \hat{a}_{s}
\end{array}

where :math:`B` and :math:`\hat{B}` contain the coefficients for the explicit
and diagonally implicit tables, respectively. We use a compact storage of these
coefficients in terms of two arrays, one for :math:`a` values and one for
:math:`\hat{a}` values. The abscissae (only relevant for non-autonomous
problems) are computed dynamically as :math:`c_j = \sum_{i=1}^j a_i` and
:math:`\hat{c}_j = \sum_{i=1}^j \hat{a}_i`, respectively
:cite:p:`Jay:21,Diele:11`. The :c:type:`ARKodeSPRKTable` type is a pointer to
the :c:type:`ARKodeSPRKTableMem` structure:

.. c:type:: ARKodeSPRKTableMem* ARKodeSPRKTable

.. c:type:: ARKodeSPRKTableMem

Structure representing the SPRK method that holds the method coefficients.

.. c:member:: int q

The method order of accuracy.

.. c:member:: int stages

The number of stages.

.. c:member:: sunrealtype* a

Array of coefficients that generate the explicit Butcher table.
``a[i]`` is the coefficient appearing in column i+1.

.. c:member:: sunrealtype* ahat

Array of coefficients that generate the diagonally-implicit Butcher table.
``ahat[i]`` is the coefficient appearing in column i.


ARKodeSPRKTable functions
---------------------------

.. _ARKodeSPRKTable.FunctionsTable:
.. table:: ARKodeSPRKTable functions

+----------------------------------------------+------------------------------------------------------------+
| **Function name** | **Description** |
+==============================================+============================================================+
| :c:func:`ARKodeSPRKTable_Alloc()` | Allocate an empty table |
+----------------------------------------------+------------------------------------------------------------+
| :c:func:`ARKodeSPRKTable_Load()` | Load SPRK method using an identifier |
+----------------------------------------------+------------------------------------------------------------+
| :c:func:`ARKodeSPRKTable_LoadByName()` | Load SPRK method using a string version of the identifier |
+----------------------------------------------+------------------------------------------------------------+
| :c:func:`ARKodeSPRKTable_Create()` | Create a new table |
+----------------------------------------------+------------------------------------------------------------+
| :c:func:`ARKodeSPRKTable_Copy()` | Create a copy of a table |
+----------------------------------------------+------------------------------------------------------------+
| :c:func:`ARKodeSPRKTable_Space()` | Get the table real and integer workspace size |
+----------------------------------------------+------------------------------------------------------------+
| :c:func:`ARKodeSPRKTable_Free()` | Deallocate a table |
+----------------------------------------------+------------------------------------------------------------+


.. c:function:: ARKodeSPRKTable ARKodeSPRKTable_Create(int stages, int q, const sunrealtype* a, const sunrealtype* ahat)

Creates and allocates an :c:type:`ARKodeSPRKTable` with the specified number
of stages and the coefficients provided.

:param stages: The number of stages.
:param q: The order of the method.
:param a: An array of the coefficients for the ``a`` table.
:param ahat: An array of the coefficients for the ``ahat`` table.
:return: :c:type:`ARKodeSPRKTable` for the loaded method.

.. c:function:: ARKodeSPRKTable ARKodeSPRKTable_Alloc(int stages)

Allocate memory for an :c:type:`ARKodeSPRKTable` with the specified
number of stages.

:param stages: The number of stages.
:return: :c:type:`ARKodeSPRKTable` for the loaded method.

.. c:function:: ARKodeSPRKTable ARKodeSPRKTable_Load(ARKODE_SPRKMethodID id)

Load the :c:type:`ARKodeSPRKTable` for the specified method ID.

:param id: The ID of the SPRK method, see :ref:`Butcher.sprk`.
:return: :c:type:`ARKodeSPRKTable` for the loaded method.

.. c:function:: ARKodeSPRKTable ARKodeSPRKTable_LoadByName(const char* method)

Load the :c:type:`ARKodeSPRKTable` for the specified method name.

:param method: The name of the SPRK method, see :ref:`Butcher.sprk`.
:return: :c:type:`ARKodeSPRKTable` for the loaded method.

.. c:function:: ARKodeSPRKTable ARKodeSPRKTable_Copy(ARKodeSPRKTable sprk_table)

Create a copy of the :c:type:`ARKodeSPRKTable`.

:param sprk_table: The :c:type:`ARKodeSPRKTable` to copy.
:return: Pointer to the copied :c:type:`ARKodeSPRKTable`.

.. c:function:: void ARKodeSPRKTable_Write(ARKodeSPRKTable sprk_table, FILE* outfile)

Write the ARKodeSPRKTable out to the file.

:param sprk_table: The :c:type:`ARKodeSPRKTable` to write.
:param outfile: The FILE that will be written to.

.. c:function:: void ARKodeSPRKTable_Space(ARKodeSPRKTable sprk_table, sunindextype* liw, sunindextype* lrw)

Get the workspace sizes required for the :c:type:`ARKodeSPRKTable`.

:param sprk_table: The :c:type:`ARKodeSPRKTable`.
:param liw: Pointer to store the integer workspace size.
:param lrw: Pointer to store the real workspace size.

.. c:function:: void ARKodeSPRKTable_Free(ARKodeSPRKTable sprk_table)

Free the memory allocated for the :c:type:`ARKodeSPRKTable`.

:param sprk_table: The :c:type:`ARKodeSPRKTable` to free.

.. c:function:: int ARKodeSPRKTable_ToButcher(ARKodeSPRKTable sprk_table, ARKodeButcherTable* a_ptr, ARKodeButcherTable* b_ptr)

Convert the :c:type:`ARKodeSPRKTable` to the Butcher table representation.

:param sprk_table: The :c:type:`ARKodeSPRKTable`.
:param a_ptr: Pointer to store the explicit Butcher table.
:param b_ptr: Pointer to store the diagonally-implicit Butcher table.
Loading