-
Notifications
You must be signed in to change notification settings - Fork 156
Feature/dom eig #710
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/dom eig #710
Changes from 136 commits
651aa31
1e2c3f2
2553603
8cda819
7e1ac25
458c3fc
acee184
2c910d2
45aba8e
6b6a57e
fa30f2e
d278d6e
749b43d
4fe2173
6650b90
2a271cf
a8f46db
0ad47c8
0bc088b
587eeaf
cf61411
a3ed799
377d54a
8c45054
441d82f
09b1c29
ada6e6e
b8581eb
2dd60c4
a30128d
dfc1a41
582519d
6015f05
97ce489
3ff8e89
092114c
77fca38
8fdb8b0
00320b8
6a42006
7226d93
d42471b
10369e7
2a16f1a
66202d3
477c50d
8461e44
90016a9
84898ac
9130482
67f6740
c415504
18d3b3f
eee9a50
3288aba
7d6090e
073cd8d
002a518
84f85e1
9001c03
9a6a61c
d73dcd7
6d0caf7
5e65761
28cde31
e9689fa
a0f6ffd
0ade7f4
f0263db
6fa8a9c
691fe10
4729b05
3a11168
ef48f26
8287d8b
471b5c1
1abba72
63d5940
12ac2b3
88a24e4
12a15b2
c014514
99dc4f4
58b0f49
492f157
cfea235
bece642
6d451a8
5fbd5e7
25fd3cb
3902fdc
7b90e2d
44ef64e
eabb13d
196dee2
7c4e953
187dd1f
8b36a23
deb6ad7
96bcdcc
a75bf14
2dd982e
884217e
4e72994
7865af5
742cc63
026ee80
69f794a
695a26d
5aee4c8
72f3def
ffc260b
e3cb290
d2371f3
af328ab
b7b6168
1144084
6826a90
5b01c1e
21e155b
55fac99
2fd158b
0c65a84
cb60123
ca32f7d
fd83275
9afa5ae
90c0748
4e3ef14
d77563c
85d6280
b07da3f
4338498
789a3b9
f9b62b1
911d09a
957ce76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -174,20 +174,65 @@ Allowable Method Families | |||||||||
|
||||||||||
.. c:function:: int LSRKStepSetDomEigFn(void* arkode_mem, ARKDomEigFn dom_eig); | ||||||||||
|
||||||||||
Specifies the dominant eigenvalue approximation routine to | ||||||||||
Specifies the user-supplied dominant eigenvalue approximation routine to | ||||||||||
be used for determining the number of stages that will be used by either the | ||||||||||
RKC or RKL methods. | ||||||||||
RKC or RKL methods. ``dom_eig = NULL`` input creates internal SUNDIALS Dominant | ||||||||||
Eigenvalue Estimator (DEE) to serve this goal. | ||||||||||
|
||||||||||
**Arguments:** | ||||||||||
* *arkode_mem* -- pointer to the LSRKStep memory block. | ||||||||||
* *dom_eig* -- name of user-supplied dominant eigenvalue approximation function (of type :c:func:`ARKDomEigFn()`). | ||||||||||
|
||||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
* *ARK_ILL_INPUT* ``dom_eig = NULL`` and LSRKStep does not currently estimate this internally. | ||||||||||
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
* *ARK_DEE_FAIL* if ``dom_eig = NULL`` and DEE failed. | ||||||||||
|
||||||||||
.. note:: This function is currently required when either the RKC or RKL methods are used. | ||||||||||
.. note:: *ARK_DEE_FAIL* return should also produce error messages due to DEE error(s). These errors | ||||||||||
are handled by :c:type:`SUNErrCode`. | ||||||||||
|
||||||||||
Either this function or the DEE creator function, :c:func:`LSRKStepSetDomEigEstimator` is required | ||||||||||
when either the RKC or RKL methods are used. | ||||||||||
|
||||||||||
:c:func:`LSRKStepSetDomEigFn` expects a user-provided spectral radius function pointer of type | ||||||||||
:c:func:`ARKDomEigFn()`. | ||||||||||
|
||||||||||
Note that although a DEE creation routine requires :c:func:`SUNDomEigEst_SetATimes` with a valid | ||||||||||
matrix-vector product function pointer, creating a DEE with :c:func:`LSRKStepSetDomEigFn` | ||||||||||
uses an internal Jacobian-vector product estimation that is passed with the *arkode_mem* pointer. | ||||||||||
Similarly, it estimates the eigenvalue as needed internally without requiring a call to | ||||||||||
:c:func:`SUNDomEig_Estimate`. | ||||||||||
|
||||||||||
|
||||||||||
.. c:function:: int LSRKStepSetDomEigEstimator(void* arkode_mem, SUNDomEigEstimator DEE); | ||||||||||
|
||||||||||
Specifies the user-supplied dominant eigenvalue estimator (DEE) to be used for | ||||||||||
determining the number of stages that will be used by either the RKC or RKL methods. | ||||||||||
This function is an alternative to :c:func:`LSRKStepSetDomEigFn` and is used when a DEE | ||||||||||
has already been created. TODO: Add extra information about how we implement this function | ||||||||||
after deciding on it by the group. | ||||||||||
|
||||||||||
**Arguments:** | ||||||||||
* *arkode_mem* -- pointer to the LSRKStep memory block. | ||||||||||
* *DEE* -- pointer to the SUNDIALS Dominant Eigenvalue Estimator (of type :c:type:`SUNDomEigEstimator`). | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the
Suggested change
|
||||||||||
|
||||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
* *ARK_ILL_INPUT* if an argument had an illegal value (e.g. DEE itself or some of the required options is ``NULL``) | ||||||||||
* *ARK_DEE_FAIL* if DEE failed. | ||||||||||
|
||||||||||
.. note:: *ARK_DEE_FAIL* return should also produce error messages due to DEE error(s). These errors | ||||||||||
are handled by :c:type:`SUNErrCode`. | ||||||||||
|
||||||||||
Either this function or the user-supplied dominant eigenvalue estimator creator function, | ||||||||||
:c:func:`LSRKStepSetDomEigFn` is required when either the RKC or RKL methods are used. | ||||||||||
|
||||||||||
Note that although a DEE creation routine requires :c:func:`SUNDomEigEst_SetATimes` with a valid | ||||||||||
matrix-vector product function pointer, setting a DEE with :c:func:`LSRKStepSetDomEigEstimator` | ||||||||||
uses an internal Jacobian-vector product estimation that is passed with the *arkode_mem* pointer. | ||||||||||
Similarly, it estimates the eigenvalue as needed internally without requiring a call to | ||||||||||
:c:func:`SUNDomEig_Estimate`. | ||||||||||
|
||||||||||
|
||||||||||
.. c:function:: int LSRKStepSetDomEigFrequency(void* arkode_mem, long int nsteps); | ||||||||||
|
@@ -201,7 +246,7 @@ Allowable Method Families | |||||||||
|
||||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
|
||||||||||
.. note:: If LSRKStepSetDomEigFrequency routine is not called, then the default ``nsteps`` is set to :math:`25` as recommended in :cite:p:`VSH:04`. | ||||||||||
Calling this function with ``nsteps < 0`` resets the default value while ``nsteps = 0`` refers to constant dominant eigenvalue. | ||||||||||
|
@@ -218,7 +263,7 @@ Allowable Method Families | |||||||||
|
||||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
|
||||||||||
.. note:: If LSRKStepSetMaxNumStages routine is not called, then the default ``stage_max_limit`` is | ||||||||||
set to :math:`200`. Calling this function with ``stage_max_limit < 2`` resets the default value. | ||||||||||
|
@@ -239,12 +284,28 @@ Allowable Method Families | |||||||||
|
||||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
|
||||||||||
.. note:: If LSRKStepSetDomEigSafetyFactor routine is not called, then the default ``dom_eig_safety`` is | ||||||||||
set to :math:`1.01`. Calling this function with ``dom_eig_safety < 1`` resets the default value. | ||||||||||
|
||||||||||
|
||||||||||
.. c:function:: int LSRKStepSetNumSucceedingWarmups(void* arkode_mem, int num_succ_warmups); | ||||||||||
|
||||||||||
Specifies the number of the preprocessing warmups before each estimate call succeeding the very first estimate call. | ||||||||||
|
||||||||||
**Arguments:** | ||||||||||
* *arkode_mem* -- pointer to the LSRKStep memory block. | ||||||||||
* *num_succ_warmups* -- the number of succeeding warmups. | ||||||||||
|
||||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
|
||||||||||
.. note:: If LSRKStepSetNumSucceedingWarmups routine is not called, then the default ``num_succ_warmups`` is set to :math:`0`. | ||||||||||
Calling this function with ``num_succ_warmups < 0`` resets the default. | ||||||||||
Comment on lines
+338
to
+339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd indent this so that the "Note" is included as part of this function's documentation:
Suggested change
|
||||||||||
|
||||||||||
|
||||||||||
.. c:function:: int LSRKStepSetNumSSPStages(void* arkode_mem, int num_of_stages); | ||||||||||
|
||||||||||
Sets the number of stages, ``s`` in ``SSP(s, p)`` methods. This input is only utilized by SSPRK methods. | ||||||||||
|
@@ -259,7 +320,7 @@ Allowable Method Families | |||||||||
|
||||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``. | ||||||||||
* *ARK_ILL_INPUT* if an argument had an illegal value (e.g. SSP method is not declared) | ||||||||||
|
||||||||||
.. note:: If LSRKStepSetNumSSPStages routine is not called, then the default ``num_of_stages`` is | ||||||||||
|
@@ -298,6 +359,26 @@ Optional output functions | |||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARK_MEM_NULL* if the LSRKStep memory was ``NULL`` | ||||||||||
* *ARK_ILL_INPUT* if ``stage_max`` is illegal | ||||||||||
|
||||||||||
|
||||||||||
.. c:function:: int LSRKStepGetNumDomEigEstRhsEvals(void* arkode_mem, long int* nfeDQ); | ||||||||||
|
||||||||||
Returns the number of RHS function evaluations used in the difference quotient | ||||||||||
Jacobian approximations (so far). | ||||||||||
|
||||||||||
**Arguments:** | ||||||||||
* *arkode_mem* -- pointer to the LSRKStep memory block. | ||||||||||
* *nfeDQ* -- number of rhs calls. | ||||||||||
|
||||||||||
**Return value:** | ||||||||||
* *ARK_SUCCESS* if successful | ||||||||||
* *ARK_MEM_NULL* if the LSRKStep memory was ``NULL`` | ||||||||||
* *ARK_ILL_INPUT* if ``nfeDQ`` is illegal | ||||||||||
|
||||||||||
.. note:: The internal SUNDIALS dominant eigenvalue estimator (DEE) uses this approximation. | ||||||||||
Therefore, it returns 0 if DEE the was not created. | ||||||||||
Comment on lines
+417
to
+418
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I'd indent this to reside within the function documentation:
Suggested change
|
||||||||||
|
||||||||||
|
||||||||||
.. _ARKODE.Usage.LSRKStep.Reinitialization: | ||||||||||
|
||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.. ---------------------------------------------------------------- | ||
SUNDIALS Copyright Start | ||
Copyright (c) 2002-2025, 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/sundomeigest/SUNDomEigEst_Introduction.rst | ||
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_API.rst | ||
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_Power.rst | ||
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_Arnoldi.rst | ||
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_Examples.rst |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.. ---------------------------------------------------------------- | ||
Mustafa Aggul @ SMU | ||
---------------------------------------------------------------- | ||
SUNDIALS Copyright Start | ||
Copyright (c) 2002-2025, 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 | ||
---------------------------------------------------------------- | ||
|
||
.. _SUNDomEigEst: | ||
|
||
############################## | ||
Dominant Eigenvalue Estimators | ||
############################## | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
SUNDomEigEst_links.rst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unclear to me what is needed for this "TODO". Generally, we describe the "mathematics" of the algorithms elsewhere in the documentation, and refer back to that here. If the question refers to what should be described about the algorithms, then my response is that inside the relevant file, all aspects of the algorithm should either be cited from publications or should be described in sufficient detail so that the inputs to each "set" routine make sense.
Given that you implemented these as standalone SUNDIALS utilities, the proper location to describe those algorithms is in
doc/sundomeigest/SUNDomEigEst_Arnoldi.rst
anddoc/sundomeigest/SUNDomEigEst_Power.rst
. I would then add a reference to those here similar to "Information on the SUNDomEigEstimator implementations provided by SUNDIALS may be found in :ref:SUNDomEigEst.Introduction
."