Skip to content

Commit 894262a

Browse files
magguldrreynoldsbalos1gardner48
committed
Feature: Dominant Eigenvalue Estimator (#710)
Add dominant eigenvalue estimator class --------- Co-authored-by: Daniel R. Reynolds <reynolds@smu.edu> Co-authored-by: Daniel R. Reynolds <dreynolds@umbc.edu> Co-authored-by: Balos, Cody, J <balos1@llnl.gov> Co-authored-by: David J. Gardner <gardner48@llnl.gov>
1 parent 7215b89 commit 894262a

File tree

75 files changed

+6823
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+6823
-63
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
# SUNDIALS Changelog
22

3+
34
## Changes to SUNDIALS in release X.Y.Z
45

56
### Major Features
67

8+
Added the `SUNDomEigEstimator` interface for estimating the dominant value of a system.
9+
Two implementations are provided: Power Iteration and Arnoldi Iteration. The latter
10+
method requires building with LAPACK support enabled.
11+
12+
Added the function `LSRKStepSetDomEigEstimator` in LSRKStep to attach a
13+
`SUNDomEigEstimator`, when using Runge-Kutta-Chebyshev or Runge-Kutta-Legendre
14+
methods, as an alternative to supplying a user-defined function to compute the dominant
15+
eigenvalue.
16+
717
### New Features and Enhancements
818

919
The functions `KINSetMAA` and `KINSetOrthAA` have been updated to allow for
@@ -36,6 +46,7 @@ erroneous forcing terms.
3646

3747
### Deprecation Notices
3848

49+
3950
## Changes to SUNDIALS in release 7.4.0
4051

4152
### New Features and Enhancements

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ set(sunlinsollib_SOVERSION "5")
102102
set(sunnonlinsollib_VERSION "4.4.0")
103103
set(sunnonlinsollib_SOVERSION "4")
104104

105+
set(sundomeigestlib_VERSION "1.0.0")
106+
set(sundomeigestlib_SOVERSION "1")
107+
105108
set(sundialslib_VERSION
106109
"${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}"
107110
)

cmake/SUNDIALSConfig.cmake.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ if("@ENABLE_ADIAK@" AND NOT TARGET adiak::adiak)
7272
find_dependency(adiak PATHS "@adiak_DIR@")
7373
endif()
7474

75-
if("@ENABLE_CUDA@" AND NOT (TARGET CUDA::cudart AND TARGET CUDA::cublas
76-
AND TARGET CUDA::cusparse AND TARGET CUDA::cusolver))
75+
if("@ENABLE_CUDA@" AND NOT (TARGET CUDA::cudart AND TARGET CUDA::curand
76+
AND TARGET CUDA::cublas AND TARGET CUDA::cusparse AND TARGET CUDA::cusolver))
7777
find_dependency(CUDAToolkit)
7878
endif()
7979

doc/arkode/guide/source/Usage/LSRKStep/User_callable.rst

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,23 +182,70 @@ Allowable Method Families
182182

183183
.. c:function:: int LSRKStepSetDomEigFn(void* arkode_mem, ARKDomEigFn dom_eig);
184184
185-
Specifies the dominant eigenvalue approximation routine to
185+
Specifies the user-supplied dominant eigenvalue approximation routine to
186186
be used for determining the number of stages that will be used by either the
187-
RKC or RKL methods.
187+
RKC or RKL methods. ``dom_eig = NULL`` input creates internal SUNDIALS Dominant
188+
Eigenvalue Estimator (DEE) to serve this goal.
188189

189190
**Arguments:**
190191
* *arkode_mem* -- pointer to the LSRKStep memory block.
191192
* *dom_eig* -- name of user-supplied dominant eigenvalue approximation function (of type :c:func:`ARKDomEigFn()`).
192193

193194
**Return value:**
194195
* *ARK_SUCCESS* if successful
195-
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``.
196-
* *ARK_ILL_INPUT* ``dom_eig = NULL`` and LSRKStep does not currently estimate this internally.
196+
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``.
197+
* *ARK_DEE_FAIL* if ``dom_eig = NULL`` and DEE failed.
197198

198199
.. note::
199200

200201
This function is currently required when either the RKC or RKL methods are used.
201202

203+
.. note:: *ARK_DEE_FAIL* return should also produce error messages due to DEE error(s). These errors
204+
are handled by :c:type:`SUNErrCode`.
205+
206+
Either this function or the DEE creator function, :c:func:`LSRKStepSetDomEigEstimator` is required
207+
when either the RKC or RKL methods are used.
208+
209+
:c:func:`LSRKStepSetDomEigFn` expects a user-provided spectral radius function pointer of type
210+
:c:func:`ARKDomEigFn()`.
211+
212+
Note that although a DEE creation routine requires :c:func:`SUNDomEigEst_SetATimes` with a valid
213+
matrix-vector product function pointer, creating a DEE with :c:func:`LSRKStepSetDomEigFn`
214+
uses an internal Jacobian-vector product estimation that is passed with the *arkode_mem* pointer.
215+
Similarly, it estimates the eigenvalue as needed internally without requiring a call to
216+
:c:func:`SUNDomEig_Estimate`.
217+
218+
219+
.. c:function:: int LSRKStepSetDomEigEstimator(void* arkode_mem, SUNDomEigEstimator DEE);
220+
221+
Specifies the user-supplied dominant eigenvalue estimator (DEE) to be used for
222+
determining the number of stages that will be used by either the RKC or RKL methods.
223+
This function is an alternative to :c:func:`LSRKStepSetDomEigFn` and is used when a DEE
224+
has already been created. TODO: Add extra information about how we implement this function
225+
after deciding on it by the group.
226+
227+
**Arguments:**
228+
* *arkode_mem* -- pointer to the LSRKStep memory block.
229+
* *DEE* -- pointer to the SUNDIALS Dominant Eigenvalue Estimator (of type :c:type:`SUNDomEigEstimator`).
230+
231+
**Return value:**
232+
* *ARK_SUCCESS* if successful
233+
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``.
234+
* *ARK_ILL_INPUT* if an argument had an illegal value (e.g. DEE itself or some of the required options is ``NULL``)
235+
* *ARK_DEE_FAIL* if DEE failed.
236+
237+
.. note:: *ARK_DEE_FAIL* return should also produce error messages due to DEE error(s). These errors
238+
are handled by :c:type:`SUNErrCode`.
239+
240+
Either this function or the user-supplied dominant eigenvalue estimator creator function,
241+
:c:func:`LSRKStepSetDomEigFn` is required when either the RKC or RKL methods are used.
242+
243+
Note that although a DEE creation routine requires :c:func:`SUNDomEigEst_SetATimes` with a valid
244+
matrix-vector product function pointer, setting a DEE with :c:func:`LSRKStepSetDomEigEstimator`
245+
uses an internal Jacobian-vector product estimation that is passed with the *arkode_mem* pointer.
246+
Similarly, it estimates the eigenvalue as needed internally without requiring a call to
247+
:c:func:`SUNDomEig_Estimate`.
248+
202249

203250
.. c:function:: int LSRKStepSetDomEigFrequency(void* arkode_mem, long int nsteps);
204251
@@ -211,7 +258,7 @@ Allowable Method Families
211258

212259
**Return value:**
213260
* *ARK_SUCCESS* if successful
214-
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``.
261+
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``.
215262

216263
.. note::
217264

@@ -235,7 +282,7 @@ Allowable Method Families
235282

236283
**Return value:**
237284
* *ARK_SUCCESS* if successful
238-
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``.
285+
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``.
239286

240287
.. note::
241288

@@ -264,7 +311,7 @@ Allowable Method Families
264311

265312
**Return value:**
266313
* *ARK_SUCCESS* if successful
267-
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``.
314+
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``.
268315

269316
.. note::
270317

@@ -276,6 +323,22 @@ Allowable Method Families
276323
when using the key "arkid.dom_eig_safety_factor".
277324

278325

326+
.. c:function:: int LSRKStepSetNumSucceedingWarmups(void* arkode_mem, int num_succ_warmups);
327+
328+
Specifies the number of the preprocessing warmups before each estimate call succeeding the very first estimate call.
329+
330+
**Arguments:**
331+
* *arkode_mem* -- pointer to the LSRKStep memory block.
332+
* *num_succ_warmups* -- the number of succeeding warmups.
333+
334+
**Return value:**
335+
* *ARK_SUCCESS* if successful
336+
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``.
337+
338+
.. note:: If LSRKStepSetNumSucceedingWarmups routine is not called, then the default ``num_succ_warmups`` is set to :math:`0`.
339+
Calling this function with ``num_succ_warmups < 0`` resets the default.
340+
341+
279342
.. c:function:: int LSRKStepSetNumSSPStages(void* arkode_mem, int num_of_stages);
280343
281344
Sets the number of stages, ``s`` in ``SSP(s, p)`` methods. This input is only utilized by SSPRK methods.
@@ -290,7 +353,7 @@ Allowable Method Families
290353

291354
**Return value:**
292355
* *ARK_SUCCESS* if successful
293-
* *ARKLS_MEM_NULL* if ``arkode_mem`` was ``NULL``.
356+
* *ARK_MEM_NULL* if ``arkode_mem`` was ``NULL``.
294357
* *ARK_ILL_INPUT* if an argument had an illegal value (e.g. SSP method is not declared)
295358

296359
.. note::
@@ -334,6 +397,26 @@ Optional output functions
334397
**Return value:**
335398
* *ARK_SUCCESS* if successful
336399
* *ARK_MEM_NULL* if the LSRKStep memory was ``NULL``
400+
* *ARK_ILL_INPUT* if ``stage_max`` is illegal
401+
402+
403+
.. c:function:: int LSRKStepGetNumDomEigEstRhsEvals(void* arkode_mem, long int* nfeDQ);
404+
405+
Returns the number of RHS function evaluations used in the difference quotient
406+
Jacobian approximations (so far).
407+
408+
**Arguments:**
409+
* *arkode_mem* -- pointer to the LSRKStep memory block.
410+
* *nfeDQ* -- number of rhs calls.
411+
412+
**Return value:**
413+
* *ARK_SUCCESS* if successful
414+
* *ARK_MEM_NULL* if the LSRKStep memory was ``NULL``
415+
* *ARK_ILL_INPUT* if ``nfeDQ`` is illegal
416+
417+
.. note:: The internal SUNDIALS dominant eigenvalue estimator (DEE) uses this approximation.
418+
Therefore, it returns 0 if DEE the was not created.
419+
337420

338421
.. _ARKODE.Usage.LSRKStep.Reinitialization:
339422

doc/arkode/guide/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ with support by the `US Department of Energy <http://www.doe.gov>`_,
6464
sunmatrix/index.rst
6565
sunlinsol/index.rst
6666
sunnonlinsol/index.rst
67+
sundomeigest/index.rst
6768
sunadaptcontroller/index.rst
6869
sunstepper/index.rst
6970
sunadjoint/index.rst
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. ----------------------------------------------------------------
2+
SUNDIALS Copyright Start
3+
Copyright (c) 2002-2025, Lawrence Livermore National Security
4+
and Southern Methodist University.
5+
All rights reserved.
6+
7+
See the top-level LICENSE and NOTICE files for details.
8+
9+
SPDX-License-Identifier: BSD-3-Clause
10+
SUNDIALS Copyright End
11+
----------------------------------------------------------------
12+
13+
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_Introduction.rst
14+
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_API.rst
15+
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_Power.rst
16+
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_Arnoldi.rst
17+
.. include:: ../../../../shared/sundomeigest/SUNDomEigEst_Examples.rst
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. ----------------------------------------------------------------
2+
Mustafa Aggul @ SMU
3+
----------------------------------------------------------------
4+
SUNDIALS Copyright Start
5+
Copyright (c) 2002-2025, Lawrence Livermore National Security
6+
and Southern Methodist University.
7+
All rights reserved.
8+
9+
See the top-level LICENSE and NOTICE files for details.
10+
11+
SPDX-License-Identifier: BSD-3-Clause
12+
SUNDIALS Copyright End
13+
----------------------------------------------------------------
14+
15+
.. _SUNDomEigEst:
16+
17+
##############################
18+
Dominant Eigenvalue Estimators
19+
##############################
20+
21+
.. toctree::
22+
:maxdepth: 1
23+
24+
SUNDomEigEst_links.rst

doc/shared/sundials.bib

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,3 +2645,31 @@ @article{rackauckas2020universal
26452645
journal={arXiv preprint arXiv:2001.04385},
26462646
year={2020}
26472647
}
2648+
2649+
%
2650+
% Arnoldi Iteration
2651+
%
2652+
2653+
@article{arnoldi51,
2654+
title={The principle of minimized iterations in the solution of the matrix eigenvalue problem},
2655+
author={Arnoldi, W. E.},
2656+
journal={Quarterly of Applied Mathematics},
2657+
volume={9},
2658+
number={1},
2659+
pages={17--29},
2660+
year={1951}
2661+
}
2662+
2663+
%
2664+
% Power Iteration
2665+
%
2666+
2667+
@article{vonmises29,
2668+
title={Praktische Verfahren der Gleichungsauflösung},
2669+
author={von Mises, Richard and Pollaczek-Geiringer, Hilda},
2670+
journal={Zeitschrift für Angewandte Mathematik und Mechanik},
2671+
volume={9},
2672+
pages={152--164},
2673+
doi = {10.1002/zamm.19290090206},
2674+
year={1929}
2675+
}

0 commit comments

Comments
 (0)