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 17 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
5 changes: 5 additions & 0 deletions include/arkode/arkode_arkstep.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <arkode/arkode_ls.h>
#include <sunadaptcontroller/sunadaptcontroller_imexgus.h>
#include <sunadaptcontroller/sunadaptcontroller_soderlind.h>
#include <sundials/sundials_stepper.h>

#ifdef __cplusplus /* wrapper to enable C++ usage */
extern "C" {
Expand Down Expand Up @@ -100,6 +101,10 @@ SUNDIALS_EXPORT int ARKStepGetTimestepperStats(
SUNDIALS_EXPORT int ARKStepCreateMRIStepInnerStepper(void* arkode_mem,
MRIStepInnerStepper* stepper);

/* SUNStepper interface functions */
SUNDIALS_EXPORT int ARKStepCreateSUNStepper(void* arkode_mem,
SUNStepper* stepper);

/* --------------------------------------------------------------------------
* Deprecated Functions -- all are superseded by shared ARKODE-level routines
* -------------------------------------------------------------------------- */
Expand Down
5 changes: 5 additions & 0 deletions include/arkode/arkode_mristep.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <arkode/arkode_butcher_dirk.h>
#include <arkode/arkode_butcher_erk.h>
#include <arkode/arkode_ls.h>
#include <sundials/sundials_stepper.h>

#ifdef __cplusplus /* wrapper to enable C++ usage */
extern "C" {
Expand Down Expand Up @@ -169,6 +170,10 @@ SUNDIALS_EXPORT int MRIStepGetLastInnerStepFlag(void* arkode_mem, int* flag);
/* Custom inner stepper functions */
SUNDIALS_EXPORT int MRIStepInnerStepper_Create(SUNContext sunctx,
MRIStepInnerStepper* stepper);

SUNDIALS_EXPORT int MRIStepInnerStepper_CreateFromSUNStepper(
SUNStepper sunstepper, MRIStepInnerStepper* stepper);

Steven-Roberts marked this conversation as resolved.
Show resolved Hide resolved
SUNDIALS_EXPORT int MRIStepInnerStepper_Free(MRIStepInnerStepper* stepper);
SUNDIALS_EXPORT int MRIStepInnerStepper_SetContent(MRIStepInnerStepper stepper,
void* content);
Expand Down
125 changes: 125 additions & 0 deletions include/sundials/sundials_stepper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/* -----------------------------------------------------------------
* 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
* -----------------------------------------------------------------*/

#ifndef _SUNDIALS_STEPPER_H
#define _SUNDIALS_STEPPER_H

#include <sundials/sundials_core.h>

#ifdef __cplusplus
extern "C" {
#endif

/* TryStep step result flags */
#define SUNSTEPPER_TRYSTEP_FAILED -1
#define SUNSTEPPER_TRYSTEP_SUCCESS +0
#define SUNSTEPPER_TRYSTEP_ADAPT +1
Steven-Roberts marked this conversation as resolved.
Show resolved Hide resolved

typedef int (*SUNJacFn)(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix Jac,
void* user_data, N_Vector tmp1, N_Vector tmp2,
N_Vector tmp3);

typedef int (*SUNJacTimesFn)(N_Vector v, N_Vector Jv, sunrealtype t, N_Vector y,
N_Vector fy, void* user_data, N_Vector tmp);

typedef _SUNDIALS_STRUCT_ SUNStepper_* SUNStepper;

balos1 marked this conversation as resolved.
Show resolved Hide resolved
balos1 marked this conversation as resolved.
Show resolved Hide resolved
balos1 marked this conversation as resolved.
Show resolved Hide resolved
typedef SUNErrCode (*SUNStepperEvolveFn)(SUNStepper stepper, sunrealtype t0,
sunrealtype tout, N_Vector y,
N_Vector yp, sunrealtype* tret,
int* stop_reason);

typedef SUNErrCode (*SUNStepperOneStepFn)(SUNStepper stepper, sunrealtype t0,
sunrealtype tout, N_Vector y,
N_Vector yp, sunrealtype* tret,
int* stop_reason);

typedef SUNErrCode (*SUNStepperTryStepFn)(SUNStepper stepper, sunrealtype t0,
sunrealtype tout, N_Vector y,
N_Vector yp, sunrealtype* tret,
int* stop_reason);

typedef SUNErrCode (*SUNStepperFullRhsFn)(SUNStepper stepper, sunrealtype t,
N_Vector y, N_Vector f, int mode);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to propose removing the mode argument since it's specific to ARKODE and I don't see any general need for it. Currently, the MRI and operator splitting methods always use ARK_FULLRHS_OTHER mode, and the other modes are unused. Any objections/concerns?


typedef SUNErrCode (*SUNStepperResetFn)(SUNStepper stepper, sunrealtype tR,
N_Vector yR, N_Vector ypR);

typedef SUNErrCode (*SUNStepperSetStopTimeFn)(SUNStepper stepper,
sunrealtype tstop);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_Create(SUNContext sunctx, SUNStepper* stepper);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_Destroy(SUNStepper* stepper);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_SetContent(SUNStepper stepper, void* content);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_GetContent(SUNStepper stepper, void** content);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_SetEvolveFn(SUNStepper stepper, SUNStepperEvolveFn fn);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_SetOneStepFn(SUNStepper stepper, SUNStepperOneStepFn fn);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_SetTryStepFn(SUNStepper stepper, SUNStepperTryStepFn fn);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_SetFullRhsFn(SUNStepper stepper, SUNStepperFullRhsFn fn);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_SetResetFn(SUNStepper stepper, SUNStepperResetFn fn);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_SetStopTimeFn(SUNStepper stepper,
SUNStepperSetStopTimeFn fn);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_AddForcing(SUNStepper stepper, sunrealtype t, N_Vector f);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_GetForcingData(SUNStepper stepper, sunrealtype* tshift,
sunrealtype* tscale, N_Vector** forcing,
int* nforcing);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_Advance(SUNStepper stepper, sunrealtype t0,
balos1 marked this conversation as resolved.
Show resolved Hide resolved
sunrealtype tout, N_Vector y, N_Vector yp,
sunrealtype* tret, int* stop_reason);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_OneStep(SUNStepper stepper, sunrealtype t0,
sunrealtype tout, N_Vector y, N_Vector yp,
sunrealtype* tret, int* stop_reason);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_TryStep(SUNStepper stepper, sunrealtype t0,
sunrealtype tout, N_Vector y, N_Vector yp,
sunrealtype* tret, int* stop_reason);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_Reset(SUNStepper stepper, sunrealtype tR, N_Vector yR,
N_Vector ypR);

SUNDIALS_EXPORT
SUNErrCode SUNStepper_SetStopTime(SUNStepper stepper, sunrealtype tstop);

#ifdef __cplusplus
}
#endif

#endif /* _SUNDIALS_STEPPER_H */
Loading
Loading