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

Loop over all Butcher tables to test order #488

Merged
merged 6 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
95 changes: 32 additions & 63 deletions test/unit_tests/arkode/CXX_serial/ark_test_butcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,76 +21,43 @@
#include <arkode/arkode_butcher_erk.h>
#include <iostream>
#include <ostream>
#include <string>
#include <sundials/sundials_types.h>
#include <vector>

struct ARK_Table
{
const char* const name;
const char* const erk_table;
const char* const dirk_table;
};

// Main Program
int main()
{
// set vectors of individual tables to test
std::vector<std::string> Tables_ERK =
{"ARKODE_HEUN_EULER_2_1_2", "ARKODE_ARK2_ERK_3_1_2",
"ARKODE_BOGACKI_SHAMPINE_4_2_3", "ARKODE_ARK324L2SA_ERK_4_2_3",
"ARKODE_ZONNEVELD_5_3_4", "ARKODE_ARK436L2SA_ERK_6_3_4",
"ARKODE_SAYFY_ABURUB_6_3_4", "ARKODE_CASH_KARP_6_4_5",
"ARKODE_FEHLBERG_6_4_5", "ARKODE_DORMAND_PRINCE_7_4_5",
"ARKODE_ARK548L2SA_ERK_8_4_5", "ARKODE_VERNER_8_5_6",
"ARKODE_FEHLBERG_13_7_8", "ARKODE_ARK437L2SA_ERK_7_3_4",
"ARKODE_ARK548L2SAb_ERK_8_4_5", "ARKODE_SOFRONIOU_SPALETTA_5_3_4",
"ARKODE_SHU_OSHER_3_2_3", "ARKODE_VERNER_9_5_6",
"ARKODE_VERNER_10_6_7", "ARKODE_VERNER_13_7_8",
"ARKODE_VERNER_16_8_9"};
std::vector<std::string> Tables_DIRK = {"ARKODE_SDIRK_2_1_2",
"ARKODE_ARK2_DIRK_3_1_2",
"ARKODE_BILLINGTON_3_3_2",
"ARKODE_TRBDF2_3_3_2",
"ARKODE_KVAERNO_4_2_3",
"ARKODE_ARK324L2SA_DIRK_4_2_3",
"ARKODE_CASH_5_2_4",
"ARKODE_CASH_5_3_4",
"ARKODE_SDIRK_5_3_4",
"ARKODE_KVAERNO_5_3_4",
"ARKODE_ARK436L2SA_DIRK_6_3_4",
"ARKODE_KVAERNO_7_4_5",
"ARKODE_ARK548L2SA_DIRK_8_4_5",
"ARKODE_ARK437L2SA_DIRK_7_3_4",
"ARKODE_ARK548L2SAb_DIRK_8_4_5",
"ARKODE_ESDIRK324L2SA_4_2_3",
"ARKODE_ESDIRK325L2SA_5_2_3",
"ARKODE_ESDIRK32I5L2SA_5_2_3",
"ARKODE_ESDIRK436L2SA_6_3_4",
"ARKODE_ESDIRK43I6L2SA_6_3_4",
"ARKODE_QESDIRK436L2SA_6_3_4",
"ARKODE_ESDIRK437L2SA_7_3_4",
"ARKODE_ESDIRK547L2SA_7_4_5",
"ARKODE_ESDIRK547L2SA2_7_4_5"};
std::vector<ARKODE_ERKTableID> Tables_ARK_ERK = {ARKODE_ARK2_ERK_3_1_2,
ARKODE_ARK324L2SA_ERK_4_2_3,
ARKODE_ARK436L2SA_ERK_6_3_4,
ARKODE_ARK437L2SA_ERK_7_3_4,
ARKODE_ARK548L2SA_ERK_8_4_5,
ARKODE_ARK548L2SAb_ERK_8_4_5};
std::vector<ARKODE_DIRKTableID> Tables_ARK_DIRK =
{ARKODE_ARK2_DIRK_3_1_2, ARKODE_ARK324L2SA_DIRK_4_2_3,
ARKODE_ARK436L2SA_DIRK_6_3_4, ARKODE_ARK437L2SA_DIRK_7_3_4,
ARKODE_ARK548L2SA_DIRK_8_4_5, ARKODE_ARK548L2SAb_DIRK_8_4_5};
std::vector<std::string> STables_ARK = {"ARKODE_ARK2_3_1_2",
"ARKODE_ARK324L2SA_4_2_3",
"ARKODE_ARK436L2SA_6_3_4",
"ARKODE_ARK437L2SA_7_3_4",
"ARKODE_ARK548L2SA_8_4_5",
"ARKODE_ARK548L2SAb_8_4_5"};
int numfails = 0;
std::vector<ARK_Table> ark_tables =
{{"ARKODE_ARK2_3_1_2", "ARKODE_ARK2_ERK_3_1_2", "ARKODE_ARK2_DIRK_3_1_2"},
{"ARKODE_ARK324L2SA_4_2_3", "ARKODE_ARK324L2SA_ERK_4_2_3",
"ARKODE_ARK324L2SA_DIRK_4_2_3"},
{"ARKODE_ARK436L2SA_6_3_4", "ARKODE_ARK436L2SA_ERK_6_3_4",
"ARKODE_ARK436L2SA_DIRK_6_3_4"},
{"ARKODE_ARK437L2SA_7_3_4", "ARKODE_ARK437L2SA_ERK_7_3_4",
"ARKODE_ARK437L2SA_DIRK_7_3_4"},
{"ARKODE_ARK548L2SA_8_4_5", "ARKODE_ARK548L2SA_ERK_8_4_5",
"ARKODE_ARK548L2SA_DIRK_8_4_5"},
{"ARKODE_ARK548L2SAb_8_4_5", "ARKODE_ARK548L2SAb_ERK_8_4_5",
"ARKODE_ARK548L2SAb_DIRK_8_4_5"}};
drreynolds marked this conversation as resolved.
Show resolved Hide resolved

int numfails = 0;

// loop over individual ERK tables
std::cout << "\nTesting individual ERK methods:\n\n";
for (std::string table : Tables_ERK)
for (int table = ARKODE_MIN_ERK_NUM; table <= ARKODE_MAX_ERK_NUM; table++)
{
std::cout << "Testing method " << table << ":";

// load Butcher table
ARKodeButcherTable B = ARKodeButcherTable_LoadERKByName(table.c_str());
ARKodeButcherTable B =
ARKodeButcherTable_LoadERK(static_cast<ARKODE_ERKTableID>(table));
if (B == NULL)
{
std::cout << " error retrieving table, aborting\n";
Expand Down Expand Up @@ -123,12 +90,13 @@ int main()

// loop over individual DIRK tables
std::cout << "\nTesting individual DIRK methods:\n\n";
for (std::string table : Tables_DIRK)
for (int table = ARKODE_MIN_DIRK_NUM; table <= ARKODE_MAX_DIRK_NUM; table++)
{
std::cout << "Testing method " << table << ":";
balos1 marked this conversation as resolved.
Show resolved Hide resolved

// load Butcher table
ARKodeButcherTable B = ARKodeButcherTable_LoadDIRKByName(table.c_str());
ARKodeButcherTable B =
ARKodeButcherTable_LoadDIRK(static_cast<ARKODE_DIRKTableID>(table));
if (B == NULL)
{
std::cout << " error retrieving table, aborting\n";
Expand Down Expand Up @@ -161,18 +129,19 @@ int main()

// loop over ARK pairs
std::cout << "\nTesting ARK pairs:\n\n";
for (size_t i = 0; i < Tables_ARK_ERK.size(); i++)
for (ARK_Table& ark_table : ark_tables)
{
std::cout << "Testing method " << STables_ARK[i] << ":";
std::cout << "Testing method " << ark_table.name << ":";

// load Butcher tables
ARKodeButcherTable Be = ARKodeButcherTable_LoadERK(Tables_ARK_ERK[i]);
ARKodeButcherTable Be = ARKodeButcherTable_LoadERKByName(ark_table.erk_table);
if (Be == NULL)
{
std::cout << " error retrieving explicit table, aborting\n";
return 1;
}
ARKodeButcherTable Bi = ARKodeButcherTable_LoadDIRK(Tables_ARK_DIRK[i]);
ARKodeButcherTable Bi =
ARKodeButcherTable_LoadDIRKByName(ark_table.dirk_table);
if (Bi == NULL)
{
std::cout << " error retrieving implicit table, aborting";
Expand Down
97 changes: 52 additions & 45 deletions test/unit_tests/arkode/CXX_serial/ark_test_butcher.out
Original file line number Diff line number Diff line change
@@ -1,78 +1,85 @@

Testing individual ERK methods:

Testing method ARKODE_HEUN_EULER_2_1_2: table matches predicted method/embedding orders of 2/1
Testing method ARKODE_ARK2_ERK_3_1_2: table matches predicted method/embedding orders of 2/1
Testing method ARKODE_BOGACKI_SHAMPINE_4_2_3: table matches predicted method/embedding orders of 3/2
Testing method ARKODE_ARK324L2SA_ERK_4_2_3: table matches predicted method/embedding orders of 3/2
Testing method ARKODE_ZONNEVELD_5_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_ARK436L2SA_ERK_6_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_SAYFY_ABURUB_6_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_CASH_KARP_6_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_FEHLBERG_6_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_DORMAND_PRINCE_7_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_ARK548L2SA_ERK_8_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_VERNER_8_5_6: table matches predicted method/embedding orders of 6/5
Testing method ARKODE_FEHLBERG_13_7_8: WARNING:
Testing method 0: table matches predicted method/embedding orders of 2/1
Testing method 1: table matches predicted method/embedding orders of 3/2
Testing method 2: table matches predicted method/embedding orders of 3/2
Testing method 3: table matches predicted method/embedding orders of 4/3
Testing method 4: table matches predicted method/embedding orders of 4/3
Testing method 5: table matches predicted method/embedding orders of 4/3
Testing method 6: table matches predicted method/embedding orders of 5/4
Testing method 7: table matches predicted method/embedding orders of 5/4
Testing method 8: table matches predicted method/embedding orders of 5/4
Testing method 9: table matches predicted method/embedding orders of 5/4
Testing method 10: table matches predicted method/embedding orders of 6/5
Testing method 11: WARNING:
ARKodeButcherTable_CheckOrder:
method order >= 6; reverting to simplifying assumptions
method order = 6

embedding order >= 6; reverting to simplifying assumptions
embedding order = 6
Testing method ARKODE_ARK437L2SA_ERK_7_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_ARK548L2SAb_ERK_8_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_SOFRONIOU_SPALETTA_5_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_SHU_OSHER_3_2_3: table matches predicted method/embedding orders of 3/2
Testing method ARKODE_VERNER_9_5_6: table matches predicted method/embedding orders of 6/5
Testing method ARKODE_VERNER_10_6_7: WARNING:
Testing method 12: table matches predicted method/embedding orders of 3/0
Testing method 13: table matches predicted method/embedding orders of 4/3
Testing method 14: table matches predicted method/embedding orders of 5/4
Testing method 15: table matches predicted method/embedding orders of 2/1
Testing method 16: table matches predicted method/embedding orders of 4/3
Testing method 17: table matches predicted method/embedding orders of 3/2
Testing method 18: table matches predicted method/embedding orders of 6/5
Testing method 19: WARNING:
ARKodeButcherTable_CheckOrder:
method order >= 6; reverting to simplifying assumptions
method order = 6

embedding order >= 6; reverting to simplifying assumptions
embedding order = 6
Testing method ARKODE_VERNER_13_7_8: WARNING:
Testing method 20: WARNING:
ARKodeButcherTable_CheckOrder:
method order >= 6; reverting to simplifying assumptions
method order = 6

embedding order >= 6; reverting to simplifying assumptions
embedding order = 6
Testing method ARKODE_VERNER_16_8_9: WARNING:
Testing method 21: WARNING:
ARKodeButcherTable_CheckOrder:
method order >= 6; reverting to simplifying assumptions
method order = 6

embedding order >= 6; reverting to simplifying assumptions
embedding order = 6
Testing method 22: table matches predicted method/embedding orders of 1/0
Testing method 23: table matches predicted method/embedding orders of 2/1
Testing method 24: table matches predicted method/embedding orders of 2/1

Testing individual DIRK methods:

Testing method ARKODE_SDIRK_2_1_2: table matches predicted method/embedding orders of 2/1
Testing method ARKODE_ARK2_DIRK_3_1_2: table matches predicted method/embedding orders of 2/1
Testing method ARKODE_BILLINGTON_3_3_2: table matches predicted method/embedding orders of 2/3
Testing method ARKODE_TRBDF2_3_3_2: table matches predicted method/embedding orders of 2/3
Testing method ARKODE_KVAERNO_4_2_3: table matches predicted method/embedding orders of 3/2
Testing method ARKODE_ARK324L2SA_DIRK_4_2_3: table matches predicted method/embedding orders of 3/2
Testing method ARKODE_CASH_5_2_4: table matches predicted method/embedding orders of 4/2
Testing method ARKODE_CASH_5_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_SDIRK_5_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_KVAERNO_5_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_ARK436L2SA_DIRK_6_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_KVAERNO_7_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_ARK548L2SA_DIRK_8_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_ARK437L2SA_DIRK_7_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_ARK548L2SAb_DIRK_8_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_ESDIRK324L2SA_4_2_3: table matches predicted method/embedding orders of 3/2
Testing method ARKODE_ESDIRK325L2SA_5_2_3: table matches predicted method/embedding orders of 3/2
Testing method ARKODE_ESDIRK32I5L2SA_5_2_3: table matches predicted method/embedding orders of 3/2
Testing method ARKODE_ESDIRK436L2SA_6_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_ESDIRK43I6L2SA_6_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_QESDIRK436L2SA_6_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_ESDIRK437L2SA_7_3_4: table matches predicted method/embedding orders of 4/3
Testing method ARKODE_ESDIRK547L2SA_7_4_5: table matches predicted method/embedding orders of 5/4
Testing method ARKODE_ESDIRK547L2SA2_7_4_5: table matches predicted method/embedding orders of 5/4
Testing method 100: table matches predicted method/embedding orders of 2/1
Testing method 101: table matches predicted method/embedding orders of 2/3
Testing method 102: table matches predicted method/embedding orders of 2/3
Testing method 103: table matches predicted method/embedding orders of 3/2
Testing method 104: table matches predicted method/embedding orders of 3/2
Testing method 105: table matches predicted method/embedding orders of 4/2
Testing method 106: table matches predicted method/embedding orders of 4/3
Testing method 107: table matches predicted method/embedding orders of 4/3
Testing method 108: table matches predicted method/embedding orders of 4/3
Testing method 109: table matches predicted method/embedding orders of 4/3
Testing method 110: table matches predicted method/embedding orders of 5/4
Testing method 111: table matches predicted method/embedding orders of 5/4
Testing method 112: table matches predicted method/embedding orders of 4/3
Testing method 113: table matches predicted method/embedding orders of 5/4
Testing method 114: table matches predicted method/embedding orders of 3/2
Testing method 115: table matches predicted method/embedding orders of 3/2
Testing method 116: table matches predicted method/embedding orders of 3/2
Testing method 117: table matches predicted method/embedding orders of 4/3
Testing method 118: table matches predicted method/embedding orders of 4/3
Testing method 119: table matches predicted method/embedding orders of 4/3
Testing method 120: table matches predicted method/embedding orders of 4/3
Testing method 121: table matches predicted method/embedding orders of 5/4
Testing method 122: table matches predicted method/embedding orders of 5/4
Testing method 123: table matches predicted method/embedding orders of 2/1
Testing method 124: table matches predicted method/embedding orders of 1/0
Testing method 125: table matches predicted method/embedding orders of 2/0
Testing method 126: table matches predicted method/embedding orders of 2/0

Testing ARK pairs:

Expand Down
Loading