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

New Low Order MRI Methods #439

Merged
merged 52 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
56844ec
Add explicit midpoint method
Steven-Roberts Mar 11, 2024
e0201e8
Add additional coefficients
Steven-Roberts Mar 13, 2024
83986c0
Update test output files for Dahlquist test problem
Steven-Roberts Mar 13, 2024
9563569
Remove extra ERK tables from this branch
Steven-Roberts Mar 13, 2024
4d7c00e
Revert whitespace change
Steven-Roberts Mar 13, 2024
a7cab48
Fix reallocation bug when changing MRI coupling
Steven-Roberts Mar 14, 2024
ea4fe97
Add missing ERK table entry
Steven-Roberts Mar 14, 2024
a1a06de
Finish adding tables and make MRIStepSetOrder error handling more con…
Steven-Roberts Mar 14, 2024
ebe3240
Fix table construction typos
Steven-Roberts Mar 14, 2024
3aec725
Clean up Dahlquist MRI test
Steven-Roberts Mar 14, 2024
e1d37eb
Update out files
Steven-Roberts Mar 14, 2024
71f8795
Apply suggestions from code review
Steven-Roberts Mar 19, 2024
3bb4f08
Revert efun logic
Steven-Roberts Mar 19, 2024
b7c6872
Merge branch 'feature/low-order-mri' of github.com:LLNL/sundials into…
Steven-Roberts Mar 19, 2024
9cd3fcb
Update ARK test output for Forward Euler after fixing stage bug
Steven-Roberts Mar 19, 2024
590009f
Fix variable naming following Dan's suggestion
Steven-Roberts Mar 19, 2024
f2738c5
Add alloc casts back for consistency
Steven-Roberts Mar 19, 2024
0314b0b
Fix integer coefficient
Steven-Roberts Mar 27, 2024
43c3e79
Switch back to calloc+free
Steven-Roberts Mar 27, 2024
b4797af
Update test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_mri.cpp
Steven-Roberts Mar 28, 2024
595a91e
Use static const int for defaults
Steven-Roberts Mar 28, 2024
a68f347
Use consistent alloc style
Steven-Roberts Mar 28, 2024
0ba65bd
Merge branch 'feature/low-order-mri' of github.com:LLNL/sundials into…
Steven-Roberts Mar 28, 2024
0ee54bd
Apply formatter
Steven-Roberts Mar 28, 2024
b35781c
Merge branch 'develop' into feature/low-order-mri
Steven-Roberts Apr 5, 2024
ffae89c
Add MRI coupling to docs
Steven-Roberts Apr 5, 2024
ad155b0
Fix table formatting
Steven-Roberts Apr 5, 2024
3a0f51f
Add new MRI coefficients to the constants docs
Steven-Roberts Apr 5, 2024
de27d24
Fix citation
Steven-Roberts Apr 5, 2024
045a7ad
Add docs for new ERK methods
Steven-Roberts Apr 9, 2024
12457cd
Add ERK stability plots
Steven-Roberts Apr 9, 2024
503296c
Fix title length
Steven-Roberts Apr 9, 2024
ef457b6
Add backward Euler docs
Steven-Roberts Apr 10, 2024
23cefab
Add forward Euler citation
Steven-Roberts Apr 10, 2024
f96ef67
Add midpoint and trapezoidal docs
Steven-Roberts Apr 10, 2024
69a1a47
Correct name for trapezoidal rule
Steven-Roberts Apr 10, 2024
cca7be5
Update changelog
Steven-Roberts Apr 10, 2024
d9f2249
Fix formatting
Steven-Roberts Apr 10, 2024
5fe51fa
Update section ids for consistency
Steven-Roberts Apr 10, 2024
3413c2f
Fix dublicate target
Steven-Roberts Apr 10, 2024
0b95ca1
Add publisher to bib entry
Steven-Roberts Apr 10, 2024
246a062
Update answers submodule
Steven-Roberts Apr 10, 2024
a442f4a
Update Fortran interface
Steven-Roberts Apr 11, 2024
ddbfe62
Apply suggestions from code review
Steven-Roberts Apr 11, 2024
e7405b5
Update answers to fix missing out files in Fortran tests
Steven-Roberts Apr 11, 2024
4afeebf
Update answers
Steven-Roberts May 7, 2024
06f5162
Merge develop
Steven-Roberts May 7, 2024
6f0de00
Merge branch 'develop' into feature/low-order-mri
gardner48 May 11, 2024
5a686ce
Apply suggestions from code review
gardner48 May 11, 2024
c624d92
update answers
gardner48 May 11, 2024
5c71c50
add missing tables to docs
gardner48 May 12, 2024
cd0022f
add missing defaults for first order methods
gardner48 May 12, 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: 4 additions & 1 deletion include/arkode/arkode_butcher_dirk.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ typedef enum
ARKODE_ESDIRK547L2SA_7_4_5,
ARKODE_ESDIRK547L2SA2_7_4_5,
ARKODE_ARK2_DIRK_3_1_2,
ARKODE_MAX_DIRK_NUM = ARKODE_ARK2_DIRK_3_1_2
ARKODE_BACKWARD_EULER_1_1,
ARKODE_IMPLICIT_MIDPOINT_1_2,
ARKODE_IMPLICIT_TRAPEZOIDAL_1_2,
ARKODE_MAX_DIRK_NUM = ARKODE_IMPLICIT_TRAPEZOIDAL_1_2
} ARKODE_DIRKTableID;

/* Accessor routine to load built-in DIRK table */
Expand Down
5 changes: 4 additions & 1 deletion include/arkode/arkode_butcher_erk.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ typedef enum
ARKODE_VERNER_10_6_7,
ARKODE_VERNER_13_7_8,
ARKODE_VERNER_16_8_9,
ARKODE_MAX_ERK_NUM = ARKODE_VERNER_16_8_9
ARKODE_FORWARD_EULER_1_1,
ARKODE_RALSTON_EULER_2_1_2,
ARKODE_EXPLICIT_MIDPOINT_EULER_2_1_2,
ARKODE_MAX_ERK_NUM = ARKODE_EXPLICIT_MIDPOINT_EULER_2_1_2
} ARKODE_ERKTableID;

/* Accessor routine to load built-in ERK table */
Expand Down
39 changes: 27 additions & 12 deletions include/arkode/arkode_mristep.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,35 @@ typedef enum
ARKODE_IMEX_MRI_GARK3a,
ARKODE_IMEX_MRI_GARK3b,
ARKODE_IMEX_MRI_GARK4,
ARKODE_MAX_MRI_NUM = ARKODE_IMEX_MRI_GARK4
ARKODE_MRI_GARK_FORWARD_EULER,
ARKODE_MRI_GARK_RALSTON2,
ARKODE_MRI_GARK_ERK22a,
ARKODE_MRI_GARK_ERK22b,
ARKODE_MRI_GARK_RALSTON3,
ARKODE_MRI_GARK_BACKWARD_EULER,
ARKODE_MRI_GARK_IMPLICIT_MIDPOINT,
ARKODE_IMEX_MRI_GARK_EULER,
ARKODE_IMEX_MRI_GARK_TRAPEZOIDAL,
ARKODE_IMEX_MRI_GARK_MIDPOINT,
ARKODE_MAX_MRI_NUM = ARKODE_IMEX_MRI_GARK_MIDPOINT,

/* Default MRI coupling tables for each order */
MRISTEP_DEFAULT_EXPL_1 = ARKODE_MRI_GARK_FORWARD_EULER,
MRISTEP_DEFAULT_EXPL_2 = ARKODE_MRI_GARK_ERK22b,
MRISTEP_DEFAULT_EXPL_3 = ARKODE_MIS_KW3,
MRISTEP_DEFAULT_EXPL_4 = ARKODE_MRI_GARK_ERK45a,

MRISTEP_DEFAULT_IMPL_SD_1 = ARKODE_MRI_GARK_BACKWARD_EULER,
MRISTEP_DEFAULT_IMPL_SD_2 = ARKODE_MRI_GARK_IRK21a,
MRISTEP_DEFAULT_IMPL_SD_3 = ARKODE_MRI_GARK_ESDIRK34a,
MRISTEP_DEFAULT_IMPL_SD_4 = ARKODE_MRI_GARK_ESDIRK46a,

MRISTEP_DEFAULT_IMEX_SD_1 = ARKODE_IMEX_MRI_GARK_EULER,
MRISTEP_DEFAULT_IMEX_SD_2 = ARKODE_IMEX_MRI_GARK_TRAPEZOIDAL,
MRISTEP_DEFAULT_IMEX_SD_3 = ARKODE_IMEX_MRI_GARK3b,
MRISTEP_DEFAULT_IMEX_SD_4 = ARKODE_IMEX_MRI_GARK4
} ARKODE_MRITableID;

/* Default MRI coupling tables for each order */

static const int MRISTEP_DEFAULT_3 = ARKODE_MIS_KW3;
static const int MRISTEP_DEFAULT_EXPL_3 = ARKODE_MIS_KW3;
static const int MRISTEP_DEFAULT_EXPL_4 = ARKODE_MRI_GARK_ERK45a;
static const int MRISTEP_DEFAULT_IMPL_SD_2 = ARKODE_MRI_GARK_IRK21a;
static const int MRISTEP_DEFAULT_IMPL_SD_3 = ARKODE_MRI_GARK_ESDIRK34a;
static const int MRISTEP_DEFAULT_IMPL_SD_4 = ARKODE_MRI_GARK_ESDIRK46a;
static const int MRISTEP_DEFAULT_IMEX_SD_3 = ARKODE_IMEX_MRI_GARK3b;
static const int MRISTEP_DEFAULT_IMEX_SD_4 = ARKODE_IMEX_MRI_GARK4;
Steven-Roberts marked this conversation as resolved.
Show resolved Hide resolved

/* ------------------------------------
* MRIStep Inner Stepper Function Types
* ------------------------------------ */
Expand Down
46 changes: 45 additions & 1 deletion src/arkode/arkode_butcher_dirk.def
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@

imeth type A-stable L-stable QP
-----------------------------------------------------------------
ARKODE_BACKWARD_EULER_1_1 SDIRK Y Y Y
ARKODE_SDIRK_2_1_2 SDIRK Y N Y
ARKODE_ARK2_DIRK_3_1_2 ESDIRK Y Y Y
ARKODE_IMPLICIT_MIDPOINT_1_2 SDIRK Y N Y
ARKODE_IMPLICIT_TRAPEZOIDAL_1_2 ESDIRK Y N Y
ARKODE_BILLINGTON_3_3_2 SDIRK N N N
ARKODE_TRBDF2_3_3_2 ESDIRK N N Y
ARKODE_KVAERNO_4_2_3 ESDIRK Y Y N
Expand All @@ -57,14 +61,26 @@
ARKODE_ARK548L2SAb_DIRK_8_4_5* ESDIRK Y Y N
ARKODE_ESDIRK547L2SA_7_4_5 ESDIRK Y Y N
ARKODE_ESDIRK547L2SA2_7_4_5 ESDIRK Y Y N
ARKODE_ARK2_DIRK_3_1_2 ESDIRK Y Y Y
-----------------------------------------------------------------
*/

ARK_BUTCHER_TABLE(ARKODE_DIRK_NONE, {
return NULL;
})

ARK_BUTCHER_TABLE(ARKODE_BACKWARD_EULER_1_1, { /* Backward Euler (L,B stable) */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(1, SUNFALSE);
B->q = 1;
B->p = 0;

B->A[0][0] = SUN_RCONST(1.0);

B->b[0] = SUN_RCONST(1.0);

B->c[0] = SUN_RCONST(1.0);
return B;
})

ARK_BUTCHER_TABLE(ARKODE_SDIRK_2_1_2, { /* SDIRK-2-1 (A,B stable) */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(2, SUNTRUE);
B->q = 2;
Expand Down Expand Up @@ -119,6 +135,34 @@ ARK_BUTCHER_TABLE(ARKODE_ARK2_DIRK_3_1_2, { /* ARK2 Implicit Table (A,L stable)
return B;
})

ARK_BUTCHER_TABLE(ARKODE_IMPLICIT_MIDPOINT_1_2, { /* Implicit Midpoint Rule (A,B stable) */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(1, SUNFALSE);
B->q = 2;
B->p = 0;

B->A[0][0] = SUN_RCONST(0.5);

B->b[0] = SUN_RCONST(1.0);

B->c[0] = SUN_RCONST(0.5);
return B;
})

ARK_BUTCHER_TABLE(ARKODE_IMPLICIT_TRAPEZOIDAL_1_2, { /* Implicit Trapezoidal Rule (A stable) */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(2, SUNFALSE);
B->q = 2;
B->p = 0;

B->A[1][0] = SUN_RCONST(0.5);
B->A[1][1] = SUN_RCONST(0.5);

B->b[0] = SUN_RCONST(0.5);
B->b[1] = SUN_RCONST(0.5);

B->c[1] = SUN_RCONST(1.0);
return B;
})

ARK_BUTCHER_TABLE(ARKODE_BILLINGTON_3_3_2, { /* Billington-SDIRK */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(3, SUNTRUE);

Expand Down
95 changes: 69 additions & 26 deletions src/arkode/arkode_butcher_erk.def
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,50 @@
are known precisely enough for use in quad precision (128-bit)
calculations.

imeth QP
--------------------------------------
ARKODE_HEUN_EULER_2_1_2 Y
ARKODE_BOGACKI_SHAMPINE_4_2_3 Y
ARKODE_ARK324L2SA_ERK_4_2_3* N
ARKODE_SHU_OSHER_3_2_3 Y
ARKODE_SOFRONIOU_SPALETTA_5_3_4 Y
ARKODE_ZONNEVELD_5_3_4 Y
ARKODE_ARK436L2SA_ERK_6_3_4* N
ARKODE_ARK437L2SA_ERK_7_3_4* N
ARKODE_SAYFY_ABURUB_6_3_4 N
ARKODE_CASH_KARP_6_4_5 Y
ARKODE_FEHLBERG_6_4_5 Y
ARKODE_DORMAND_PRINCE_7_4_5 Y
ARKODE_ARK548L2SA_ERK_8_4_5* N
ARKODE_ARK548L2SAb_ERK_8_4_5* N
ARKODE_VERNER_8_5_6 Y
ARKODE_FEHLBERG_13_7_8 Y
ARKODE_ARK2_ERK_3_1_2 Y
ARKODE_VERNER_9_5_6 Y
ARKODE_VERNER_10_6_7 Y
ARKODE_VERNER_13_7_8 Y
ARKODE_VERNER_16_8_9 Y
--------------------------------------
ARKODE_KNOTH_WOLKE_3_3^ Y
--------------------------------------
imeth QP
---------------------------------------
ARKODE_FORWARD_EULER_1_1 Y
ARKODE_HEUN_EULER_2_1_2 Y
ARKODE_RALSTON_EULER_2_1_2 Y
ARKODE_EXPLICIT_MIDPOINT_EULER_2_1_2 Y
ARKODE_BOGACKI_SHAMPINE_4_2_3 Y
ARKODE_ARK324L2SA_ERK_4_2_3* N
ARKODE_SHU_OSHER_3_2_3 Y
ARKODE_SOFRONIOU_SPALETTA_5_3_4 Y
ARKODE_ZONNEVELD_5_3_4 Y
ARKODE_ARK436L2SA_ERK_6_3_4* N
ARKODE_ARK437L2SA_ERK_7_3_4* N
ARKODE_SAYFY_ABURUB_6_3_4 N
ARKODE_CASH_KARP_6_4_5 Y
ARKODE_FEHLBERG_6_4_5 Y
ARKODE_DORMAND_PRINCE_7_4_5 Y
ARKODE_ARK548L2SA_ERK_8_4_5* N
ARKODE_ARK548L2SAb_ERK_8_4_5* N
ARKODE_VERNER_8_5_6 Y
ARKODE_FEHLBERG_13_7_8 Y
ARKODE_ARK2_ERK_3_1_2 Y
ARKODE_VERNER_9_5_6 Y
ARKODE_VERNER_10_6_7 Y
ARKODE_VERNER_13_7_8 Y
ARKODE_VERNER_16_8_9 Y
---------------------------------------
ARKODE_KNOTH_WOLKE_3_3^ Y
---------------------------------------
*/

ARK_BUTCHER_TABLE(ARKODE_ERK_NONE, {
return NULL;
})

ARK_BUTCHER_TABLE(ARKODE_FORWARD_EULER_1_1, { /* Euler-ERK */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(1, SUNFALSE);
B->q = 1;
B->p = 0;

B->b[0] = SUN_RCONST(1.0);
return B;
})

ARK_BUTCHER_TABLE(ARKODE_HEUN_EULER_2_1_2, { /* Heun-Euler-ERK */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(2, SUNTRUE);
B->q = 2;
Expand All @@ -84,6 +96,37 @@ ARK_BUTCHER_TABLE(ARKODE_HEUN_EULER_2_1_2, { /* Heun-Euler-ERK */
return B;
})

ARK_BUTCHER_TABLE(ARKODE_RALSTON_EULER_2_1_2, { /* Ralston-Euler-ERK */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(2, SUNTRUE);
B->q = 2;
B->p = 1;

B->A[1][0] = SUN_RCONST(2.0) / SUN_RCONST(3.0);

B->b[0] = SUN_RCONST(1.0) / SUN_RCONST(4.0);
B->b[1] = SUN_RCONST(3.0) / SUN_RCONST(4.0);

B->d[0] = SUN_RCONST(1.0);

B->c[1] = SUN_RCONST(2.0) / SUN_RCONST(3.0);
return B;
})

ARK_BUTCHER_TABLE(ARKODE_EXPLICIT_MIDPOINT_EULER_2_1_2, { /* Explicit-Midpoint-Euler-ERK */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(2, SUNTRUE);
B->q = 2;
B->p = 1;

B->A[1][0] = SUN_RCONST(1.0) / SUN_RCONST(2.0);

B->b[1] = SUN_RCONST(1.0);

B->d[0] = SUN_RCONST(1.0);

B->c[1] = SUN_RCONST(1.0) / SUN_RCONST(2.0);
return B;
})

ARK_BUTCHER_TABLE(ARKODE_ARK2_ERK_3_1_2, { /* ARK2 Explicit Table */
ARKodeButcherTable B = ARKodeButcherTable_Alloc(3, SUNTRUE);

Expand Down
Loading
Loading