diff --git a/test/answers b/test/answers index 1ff407f621..b90293b66f 160000 --- a/test/answers +++ b/test/answers @@ -1 +1 @@ -Subproject commit 1ff407f621fd49addea544af650362bf190ff9dd +Subproject commit b90293b66ffe96c0b3842c2ba758cac4cfec1c29 diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark.cpp b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark.cpp index 6cc8f27c24..85c39ae721 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark.cpp +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark.cpp @@ -19,16 +19,16 @@ * ---------------------------------------------------------------------------*/ // Header files +#include #include #include #include #include -#include - -#include #include +#include #include #include + #include "arkode/arkode_butcher.h" #if defined(SUNDIALS_EXTENDED_PRECISION) @@ -48,14 +48,14 @@ #define TWO SUN_RCONST(2.0) // Method types -enum class prob_type +enum class mass_matrix_type { identity, - fixed_mass_matrix, - time_dependent_mass_matrix + fixed, + time_dependent }; -enum class method_type +enum class rk_type { expl, impl, @@ -71,14 +71,16 @@ enum class interp_type // Problem parameters struct ProblemData { - sunrealtype lambda_e = NEG_ONE; - sunrealtype lambda_i = NEG_ONE; - prob_type p_type = prob_type::identity; + sunrealtype lambda_e = NEG_ONE; + sunrealtype lambda_i = NEG_ONE; + mass_matrix_type m_type = mass_matrix_type::identity; }; // Problem options struct ProblemOptions { + mass_matrix_type m_type = mass_matrix_type::identity; + // Initial time sunrealtype t0 = ZERO; @@ -93,6 +95,14 @@ struct ProblemOptions // 0 = Hermite // 1 = Lagrange interp_type i_type = interp_type::hermite; + + // Predictor type + // 0 = trivial + // 1 = maximum order (dense output) + int p_type = 0; + + // Runge-Kutta type + rk_type r_type; }; // User-supplied Functions called by the solver @@ -100,7 +110,7 @@ int fe(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data); int Ji(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix J, void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3); -int MassMatrix(sunrealtype t, SUNMatrix M, void *user_data, N_Vector tmp1, +int MassMatrix(sunrealtype t, SUNMatrix M, void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3); // Private function to check function return values @@ -115,13 +125,13 @@ int get_method_properties(ARKodeButcherTable Be, ARKodeButcherTable Bi, int& stages, int& order, bool& explicit_first_stage, bool& stiffly_accurate, bool& fsal); -int expected_rhs_evals(method_type m_type, interp_type i_type, int stages, +int expected_rhs_evals(ProblemOptions& prob_opts, int stages, int order, bool explicit_first_stage, bool stiffly_accurate, bool fsal, void* arkstep_mem, long int& nfe_expected, long int& nfi_expected); -int check_rhs_evals(method_type m_type, void* arkstep_mem, - long int nfe_expected, long int nfi_expected); +int check_rhs_evals(rk_type r_type, void* arkstep_mem, long int nfe_expected, + long int nfi_expected); // ----------------------------------------------------------------------------- // Main Program @@ -138,44 +148,49 @@ int main(int argc, char* argv[]) { if (std::stoi(argv[1]) == 1) { - prob_data.p_type = prob_type::fixed_mass_matrix; + prob_data.m_type = mass_matrix_type::fixed; + prob_opts.m_type = mass_matrix_type::fixed; } else if (std::stoi(argv[1]) == 2) { - prob_data.p_type = prob_type::time_dependent_mass_matrix; + prob_data.m_type = mass_matrix_type::time_dependent; + prob_opts.m_type = mass_matrix_type::time_dependent; } else { - prob_data.p_type = prob_type::identity; + prob_data.m_type = mass_matrix_type::identity; + prob_opts.m_type = mass_matrix_type::identity; } } if (argc > 2) { - if (std::stoi(argv[2]) == 1) - { - prob_opts.i_type = interp_type::lagrange; - } - else + if (std::stoi(argv[2]) == 1) { prob_opts.i_type = interp_type::lagrange; } + else { prob_opts.i_type = interp_type::hermite; } + } + + if (argc > 3) + { + prob_opts.p_type = std::stoi(argv[3]); + if (prob_opts.p_type > 1) { - prob_opts.i_type = interp_type::hermite; + std::cerr << "ERROR: Only the trivial (0) and max order (1) " + << "predictors are supported" << std::endl; + return 1; } } // Output problem setup std::cout << "\nDahlquist ODE test problem:\n"; - if (prob_data.p_type == prob_type::identity) + if (prob_data.m_type == mass_matrix_type::identity) { std::cout << " problem type = Identity\n"; } - else if (prob_data.p_type == prob_type::fixed_mass_matrix) + else if (prob_data.m_type == mass_matrix_type::fixed) { std::cout << " problem type = Fixed mass matrix\n"; } - else - { - std::cout << " problem type = Time-dependent mass matrix\n"; - } + else { std::cout << " problem type = Time-dependent mass matrix\n"; } std::cout << " lambda expl = " << prob_data.lambda_e << "\n" << " lambda impl = " << prob_data.lambda_i << "\n" << " step size = " << prob_opts.h << "\n" @@ -185,10 +200,9 @@ int main(int argc, char* argv[]) { std::cout << " interp type = Hermite\n"; } - else - { - std::cout << " interp type = Lagrange\n"; - } + else { std::cout << " interp type = Lagrange\n"; } + if (prob_opts.p_type == 0) { std::cout << " pred type = Trivial (0)\n"; } + else { std::cout << " pred type = Max order (1)\n"; } // Create SUNDIALS context sundials::Context sunctx; @@ -236,7 +250,7 @@ int main(int argc, char* argv[]) for (int i = ARKODE_MIN_ERK_NUM; i <= ARKODE_MAX_ERK_NUM; i++) { - Be = ARKodeButcherTable_LoadERK(static_cast(i)); + Be = ARKodeButcherTable_LoadERK(static_cast(i)); flag = get_method_properties(Be, Bi, stages, order, explicit_first_stage, stiffly_accurate, fsal); if (check_flag(&flag, "get_method_properties", 1)) return 1; @@ -290,7 +304,7 @@ int main(int argc, char* argv[]) for (int i = ARKODE_MIN_DIRK_NUM; i <= ARKODE_MAX_DIRK_NUM; i++) { - Bi = ARKodeButcherTable_LoadDIRK(static_cast(i)); + Bi = ARKodeButcherTable_LoadDIRK(static_cast(i)); flag = get_method_properties(Be, Bi, stages, order, explicit_first_stage, stiffly_accurate, fsal); if (check_flag(&flag, "get_method_properties", 1)) return 1; @@ -350,26 +364,24 @@ int main(int argc, char* argv[]) Be = nullptr; Bi = nullptr; - const char* ark_methods_erk[6] = - {"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"}; - - const char* ark_methods_dirk[6] = - {"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_ERK_8_4_5", - "ARKODE_ARK548L2SAb_ERK_8_4_5"}; + const char* ark_methods_erk[6] = {"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"}; + + const char* ark_methods_dirk[6] = {"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"}; for (int i = 0; i < 6; i++) { - Be = ARKodeButcherTable_LoadERKByName(ark_methods_erk[0]); - Bi = ARKodeButcherTable_LoadDIRKByName(ark_methods_dirk[0]); + Be = ARKodeButcherTable_LoadERKByName(ark_methods_erk[i]); + Bi = ARKodeButcherTable_LoadDIRKByName(ark_methods_dirk[i]); flag = get_method_properties(Be, Bi, stages, order, explicit_first_stage, stiffly_accurate, fsal); @@ -414,10 +426,9 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, int numfails = 0; // Determine method type - method_type m_type; - if (Be && !Bi) { m_type = method_type::expl; } - else if (!Be && Bi) { m_type = method_type::impl; } - else if (Be && Bi) { m_type = method_type::imex; } + if (Be && !Bi) { prob_opts.r_type = rk_type::expl; } + else if (!Be && Bi) { prob_opts.r_type = rk_type::impl; } + else if (Be && Bi) { prob_opts.r_type = rk_type::imex; } else { std::cerr << "ERROR: Both Butcher tables are NULL" << std::endl; @@ -444,18 +455,15 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, // Create integrator based on type void* arkstep_mem = nullptr; - if (m_type == method_type::expl) + if (prob_opts.r_type == rk_type::expl) { arkstep_mem = ARKStepCreate(fe, nullptr, prob_opts.t0, y, sunctx); } - else if (m_type == method_type::impl) + else if (prob_opts.r_type == rk_type::impl) { arkstep_mem = ARKStepCreate(nullptr, fi, prob_opts.t0, y, sunctx); } - else - { - arkstep_mem = ARKStepCreate(fe, fi, prob_opts.t0, y, sunctx); - } + else { arkstep_mem = ARKStepCreate(fe, fi, prob_opts.t0, y, sunctx); } if (check_flag((void*)arkstep_mem, "ARKStepCreate", 0)) return 1; // Set user data @@ -470,7 +478,7 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, flag = ARKStepSetFixedStep(arkstep_mem, prob_opts.h); if (check_flag(&flag, "ARKStepSetFixedStep", 1)) return 1; - // Attach Butcher tables <<<<<<< correct method order? + // Attach Butcher tables (ignore actual method order) flag = ARKStepSetTables(arkstep_mem, 1, 0, Bi, Be); if (check_flag(&flag, "ARKStepSetTables", 1)) return 1; @@ -485,7 +493,7 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, SUNMatrix A = nullptr; SUNLinearSolver LS = nullptr; - if (m_type == method_type::impl || m_type == method_type::imex) + if (prob_opts.r_type == rk_type::impl || prob_opts.r_type == rk_type::imex) { // Initialize dense matrix data structures and solvers A = SUNDenseMatrix(1, 1, sunctx); @@ -504,25 +512,28 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, // Specify linearly implicit RHS, with non-time-dependent Jacobian flag = ARKStepSetLinear(arkstep_mem, 0); - if (check_flag(&flag, "ARKStepSetLinear", 1)) return 1; + if (check_flag(&flag, "ARKStepSetLinear", 1)) { return 1; } + + // Specify implicit predictor method + flag = ARKStepSetPredictorMethod(arkstep_mem, prob_opts.p_type); + if (check_flag(&flag, "ARKStepSetPredictorMethod", 1)) { return 1; } } // Create mass matrix and linear solver (if necessary) - SUNMatrix M = nullptr; + SUNMatrix M = nullptr; SUNLinearSolver MLS = nullptr; - if (prob_data.p_type == prob_type::fixed_mass_matrix || - prob_data.p_type == prob_type::time_dependent_mass_matrix) + if (prob_data.m_type == mass_matrix_type::fixed || + prob_data.m_type == mass_matrix_type::time_dependent) { M = SUNDenseMatrix(1, 1, sunctx); - if (check_flag((void *)M, "SUNDenseMatrix", 0)) return 1; + if (check_flag((void*)M, "SUNDenseMatrix", 0)) return 1; MLS = SUNLinSol_Dense(y, M, sunctx); - if (check_flag((void *)MLS, "SUNLinSol_Dense", 0)) return 1; + if (check_flag((void*)MLS, "SUNLinSol_Dense", 0)) return 1; int time_dep = 0; - if (prob_data.p_type == prob_type::time_dependent_mass_matrix) - time_dep = 1; + if (prob_data.m_type == mass_matrix_type::time_dependent) { time_dep = 1; } flag = ARKStepSetMassLinearSolver(arkstep_mem, MLS, M, time_dep); if (check_flag(&flag, "ARKStepSetMassLinearSolver", 1)) return 1; @@ -552,12 +563,13 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, t_out += prob_opts.h; // Check statistics - flag = expected_rhs_evals(m_type, prob_opts.i_type, stages, - explicit_first_stage, stiffly_accurate, fsal, - arkstep_mem,nfe_expected, nfi_expected); - if (check_flag(&flag, "expected_rhs_evals", 1)) return 1; + flag = expected_rhs_evals(prob_opts, stages, order, explicit_first_stage, + stiffly_accurate, fsal, arkstep_mem, nfe_expected, + nfi_expected); + if (check_flag(&flag, "expected_rhs_evals", 1)) { return 1; } - numfails += check_rhs_evals(m_type, arkstep_mem, nfe_expected, nfi_expected); + numfails += check_rhs_evals(prob_opts.r_type, arkstep_mem, nfe_expected, + nfi_expected); if (numfails) { @@ -587,18 +599,22 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, // Stiffly accurate (and FSAL) methods do not require an additional RHS // evaluation to get the new RHS value at the end of a step for dense - // output. However, for methods with an explicit first stage this evaluation - // can be used at the start of the next step. For methods with an implicit - // first stage that are not stiffly accurate this evaluation replaces one - // that would happen at the end of the next step (this is accounted for in - // expected_rhs_evals after the next step is taken below). + // output. Methods with an explicit first stage can use this RHS value at + // the start of the next step. + // + // If a method has an implicit first stage but is not stiffly accurate, the + // evaluation needed for interpolation replaces one that would happen at the + // end of the next step (this is accounted for in expected_rhs_evals after + // the next step is taken below). However, if the trivial predictor is used + // then the RHS evaluation can be reused across the stage solves in the + // initial evaluation of the residual. if (prob_opts.i_type == interp_type::hermite && !stiffly_accurate) { - if (m_type == method_type::expl || m_type == method_type::imex) + if (prob_opts.r_type == rk_type::expl || prob_opts.r_type == rk_type::imex) { nfe_expected++; } - if (m_type == method_type::impl || m_type == method_type::imex) + if (prob_opts.r_type == rk_type::impl || prob_opts.r_type == rk_type::imex) { nfi_expected++; } @@ -611,17 +627,17 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, int degree = (order == 1) ? 1 : order - 1; if (prob_opts.i_type == interp_type::hermite && degree > 3) { - if (m_type == method_type::expl || m_type == method_type::imex) + if (prob_opts.r_type == rk_type::expl || prob_opts.r_type == rk_type::imex) { extra_fe_evals += (degree == 4) ? 1 : 4; } - if (m_type == method_type::impl || m_type == method_type::imex) + if (prob_opts.r_type == rk_type::impl || prob_opts.r_type == rk_type::imex) { extra_fi_evals += (degree == 4) ? 1 : 4; } } - numfails += check_rhs_evals(m_type, arkstep_mem, + numfails += check_rhs_evals(prob_opts.r_type, arkstep_mem, nfe_expected + extra_fe_evals, nfi_expected + extra_fi_evals); @@ -642,12 +658,12 @@ int run_tests(ARKodeButcherTable Be, ARKodeButcherTable Bi, t_out += prob_opts.h; // Check statistics - flag = expected_rhs_evals(m_type, prob_opts.i_type, stages, - explicit_first_stage, stiffly_accurate, fsal, - arkstep_mem, nfe_expected, nfi_expected); - if (check_flag(&flag, "expected_rhs_evals", 1)) return 1; + flag = expected_rhs_evals(prob_opts, stages, order, explicit_first_stage, + stiffly_accurate, fsal, arkstep_mem, nfe_expected, + nfi_expected); + if (check_flag(&flag, "expected_rhs_evals", 1)) { return 1; } - numfails += check_rhs_evals(m_type, arkstep_mem, + numfails += check_rhs_evals(prob_opts.r_type, arkstep_mem, nfe_expected + extra_fe_evals, nfi_expected + extra_fi_evals); @@ -684,7 +700,7 @@ int get_method_properties(ARKodeButcherTable Be, ARKodeButcherTable Bi, // Built-in ARK methods have the same order for Bi and Be order = 0; if (Bi) { order = Bi->q; } - else if (Be) { order= Be->q; } + else if (Be) { order = Be->q; } else { std::cerr << "ERROR: Both Butcher tables are NULL!" << std::endl; @@ -706,17 +722,11 @@ int get_method_properties(ARKodeButcherTable Be, ARKodeButcherTable Bi, stiffly_accurate = true; if (Bi) { - if (!ARKodeButcherTable_IsStifflyAccurate(Bi)) - { - stiffly_accurate = false; - } + if (!ARKodeButcherTable_IsStifflyAccurate(Bi)) { stiffly_accurate = false; } } if (Be) { - if (!ARKodeButcherTable_IsStifflyAccurate(Be)) - { - stiffly_accurate = false; - } + if (!ARKodeButcherTable_IsStifflyAccurate(Be)) { stiffly_accurate = false; } } // Check for first same as last (FSAL) property @@ -725,40 +735,42 @@ int get_method_properties(ARKodeButcherTable Be, ARKodeButcherTable Bi, return 0; } -int expected_rhs_evals(method_type m_type, interp_type i_type, int stages, +int expected_rhs_evals(ProblemOptions& prob_opts, int stages, int order, bool explicit_first_stage, bool stiffly_accurate, - bool fsal, void* arkstep_mem, - long int& nfe_expected, long int& nfi_expected) + bool fsal, void* arkstep_mem, long int& nfe_expected, + long int& nfi_expected) { int flag = 0; // Get number of steps and nonlinear solver iterations long int nst = 0; - flag = ARKStepGetNumSteps(arkstep_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) return 1; - long int nni = 0; - if (m_type == method_type::impl || m_type == method_type::imex) + flag = ARKStepGetNumSteps(arkstep_mem, &nst); + if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return 1; } + + long int nni = 0; + long int extra_fe_evals = 0; + long int extra_fi_evals = 0; + + if (prob_opts.r_type == rk_type::impl || prob_opts.r_type == rk_type::imex) { flag = ARKStepGetNumNonlinSolvIters(arkstep_mem, &nni); if (check_flag(&flag, "ARKStepGetNumNonlinSolvIters", 1)) return 1; } // Expected number of explicit functions evaluations - nfe_expected = 0; - if (m_type == method_type::expl || m_type == method_type::imex) + nfe_expected = extra_fe_evals; + + if (prob_opts.r_type == rk_type::expl || prob_opts.r_type == rk_type::imex) { if (fsal) { // Save one function evaluation after first step - nfe_expected = stages + (stages - 1) * (nst - 1); - } - else - { - nfe_expected = stages * nst; + nfe_expected += stages + (stages - 1) * (nst - 1); } + else { nfe_expected += stages * nst; } - if (i_type == interp_type::hermite && !explicit_first_stage) + if (prob_opts.i_type == interp_type::hermite && !explicit_first_stage) { if (stiffly_accurate) { @@ -774,20 +786,18 @@ int expected_rhs_evals(method_type m_type, interp_type i_type, int stages, } // Expected number of implicit functions evaluations - nfi_expected = 0; - if (m_type == method_type::impl || m_type == method_type::imex) + nfi_expected = extra_fi_evals; + + if (prob_opts.r_type == rk_type::impl || prob_opts.r_type == rk_type::imex) { if (fsal) { // Save one function evaluation after first step - nfi_expected = stages + (stages - 1) * (nst - 1) + nni; - } - else - { - nfi_expected = stages * nst + nni; + nfi_expected += stages + (stages - 1) * (nst - 1) + nni; } + else { nfi_expected += stages * nst + nni; } - if (i_type == interp_type::hermite && !explicit_first_stage) + if (prob_opts.i_type == interp_type::hermite && !explicit_first_stage) { if (stiffly_accurate) { @@ -804,7 +814,7 @@ int expected_rhs_evals(method_type m_type, interp_type i_type, int stages, std::cout << "Steps: " << nst << std::endl; - if (m_type == method_type::impl || m_type == method_type::imex) + if (prob_opts.r_type == rk_type::impl || prob_opts.r_type == rk_type::imex) { std::cout << "NLS iters: " << nni << std::endl; } @@ -812,27 +822,26 @@ int expected_rhs_evals(method_type m_type, interp_type i_type, int stages, return 0; } -int check_rhs_evals(method_type m_type, void* arkstep_mem, - long int nfe_expected, long int nfi_expected) +int check_rhs_evals(rk_type r_type, void* arkstep_mem, long int nfe_expected, + long int nfi_expected) { int flag = 0; - long int nst = 0; - flag = ARKStepGetNumSteps(arkstep_mem, &nst); - if (check_flag(&flag, "ARKStepGetNumSteps", 1)) return 1; + long int nst; + flag = ARKStepGetNumSteps(arkstep_mem, &nst); + if (check_flag(&flag, "ARKStepGetNumSteps", 1)) { return 1; } long int nfe, nfi; flag = ARKStepGetNumRhsEvals(arkstep_mem, &nfe, &nfi); if (check_flag(&flag, "ARKStepGetNumRhsEvals", 1)) return 1; - - if (m_type == method_type::expl || m_type == method_type::imex) + if (r_type == rk_type::expl || r_type == rk_type::imex) { std::cout << "Fe RHS evals:\n" << " actual: " << nfe << "\n" << " expected: " << nfe_expected << "\n"; } - if (m_type == method_type::impl || m_type == method_type::imex) + if (r_type == rk_type::impl || r_type == rk_type::imex) { std::cout << "Fi RHS evals:\n" << " actual: " << nfi << "\n" @@ -861,11 +870,8 @@ int fe(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) yd_data[0] = prob_data->lambda_e * y_data[0]; - if (prob_data->p_type == prob_type::fixed_mass_matrix) - { - yd_data[0] *= TWO; - } - else if (prob_data->p_type == prob_type::time_dependent_mass_matrix) + if (prob_data->m_type == mass_matrix_type::fixed) { yd_data[0] *= TWO; } + else if (prob_data->m_type == mass_matrix_type::time_dependent) { yd_data[0] *= TWO + std::cos(t); } @@ -882,11 +888,8 @@ int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data) yd_data[0] = prob_data->lambda_i * y_data[0]; - if (prob_data->p_type == prob_type::fixed_mass_matrix) - { - yd_data[0] *= TWO; - } - else if (prob_data->p_type == prob_type::time_dependent_mass_matrix) + if (prob_data->m_type == mass_matrix_type::fixed) { yd_data[0] *= TWO; } + else if (prob_data->m_type == mass_matrix_type::time_dependent) { yd_data[0] *= TWO + std::cos(t); } @@ -906,20 +909,14 @@ int Ji(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix J, void* user_data, return 0; } -int MassMatrix(sunrealtype t, SUNMatrix M, void *user_data, N_Vector tmp1, +int MassMatrix(sunrealtype t, SUNMatrix M, void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3) { sunrealtype* M_data = SUNDenseMatrix_Data(M); ProblemData* prob_data = static_cast(user_data); - if (prob_data->p_type == prob_type::fixed_mass_matrix) - { - M_data[0] = TWO; - } - else - { - M_data[0] = TWO + std::cos(t); - } + if (prob_data->m_type == mass_matrix_type::fixed) { M_data[0] = TWO; } + else { M_data[0] = TWO + std::cos(t); } return 0; } @@ -944,7 +941,7 @@ int check_flag(void* flagvalue, const std::string funcname, int opt) else if (opt == 1) { errflag = (int*)flagvalue; - if (*errflag < 0) + if (*errflag != 0) { std::cerr << "\nSUNDIALS_ERROR: " << funcname << " failed with flag = " << *errflag << "\n\n"; diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_0_0.out b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_0_0.out index beedca56db..0b5e75274c 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_0_0.out +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_0_0.out @@ -7,6 +7,7 @@ Dahlquist ODE test problem: relative tol = 0.0001 absolute tol = 1e-06 interp type = Hermite + pred type = Trivial (0) ======================== Test explicit RK methods @@ -1910,272 +1911,272 @@ Fi RHS evals: ======================== IMEX Table ID 1 - stages: 3 - order: 2 + stages: 4 + order: 3 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 3 Fe RHS evals: - actual: 3 - expected: 3 + actual: 4 + expected: 4 Fi RHS evals: - actual: 5 - expected: 5 + actual: 7 + expected: 7 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 6 Fe RHS evals: - actual: 6 - expected: 6 + actual: 8 + expected: 8 Fi RHS evals: - actual: 10 - expected: 10 + actual: 14 + expected: 14 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 9 Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 13 + expected: 13 Fi RHS evals: - actual: 16 - expected: 16 + actual: 22 + expected: 22 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 12 Fe RHS evals: - actual: 12 - expected: 12 + actual: 16 + expected: 16 Fi RHS evals: - actual: 20 - expected: 20 + actual: 28 + expected: 28 -------------------- ======================== IMEX Table ID 2 - stages: 3 - order: 2 + stages: 6 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 5 Fe RHS evals: - actual: 3 - expected: 3 + actual: 6 + expected: 6 Fi RHS evals: - actual: 5 - expected: 5 + actual: 11 + expected: 11 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 10 Fe RHS evals: - actual: 6 - expected: 6 + actual: 12 + expected: 12 Fi RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 15 Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 19 + expected: 19 Fi RHS evals: - actual: 16 - expected: 16 + actual: 34 + expected: 34 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 20 Fe RHS evals: - actual: 12 - expected: 12 + actual: 24 + expected: 24 Fi RHS evals: - actual: 20 - expected: 20 + actual: 44 + expected: 44 -------------------- ======================== IMEX Table ID 3 - stages: 3 - order: 2 + stages: 7 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 6 Fe RHS evals: - actual: 3 - expected: 3 + actual: 7 + expected: 7 Fi RHS evals: - actual: 5 - expected: 5 + actual: 13 + expected: 13 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 12 Fe RHS evals: - actual: 6 - expected: 6 + actual: 14 + expected: 14 Fi RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 18 Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 Fi RHS evals: - actual: 16 - expected: 16 + actual: 40 + expected: 40 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 24 Fe RHS evals: - actual: 12 - expected: 12 + actual: 28 + expected: 28 Fi RHS evals: - actual: 20 - expected: 20 + actual: 52 + expected: 52 -------------------- ======================== IMEX Table ID 4 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 Fi RHS evals: - actual: 16 - expected: 16 + actual: 47 + expected: 47 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 33 + expected: 33 Fi RHS evals: - actual: 20 - expected: 20 + actual: 61 + expected: 61 -------------------- ======================== IMEX Table ID 5 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 Fi RHS evals: - actual: 16 - expected: 16 + actual: 47 + expected: 47 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 33 + expected: 33 Fi RHS evals: - actual: 20 - expected: 20 + actual: 61 + expected: 61 -------------------- diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_0_1.out b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_0_1.out index 215d59d55e..63acf12fd8 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_0_1.out +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_0_1.out @@ -7,6 +7,7 @@ Dahlquist ODE test problem: relative tol = 0.0001 absolute tol = 1e-06 interp type = Lagrange + pred type = Trivial (0) ======================== Test explicit RK methods @@ -1910,272 +1911,272 @@ Fi RHS evals: ======================== IMEX Table ID 1 - stages: 3 - order: 2 + stages: 4 + order: 3 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 3 Fe RHS evals: - actual: 3 - expected: 3 + actual: 4 + expected: 4 Fi RHS evals: - actual: 5 - expected: 5 + actual: 7 + expected: 7 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 6 Fe RHS evals: - actual: 6 - expected: 6 + actual: 8 + expected: 8 Fi RHS evals: - actual: 10 - expected: 10 + actual: 14 + expected: 14 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 9 Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 12 Fe RHS evals: - actual: 12 - expected: 12 + actual: 16 + expected: 16 Fi RHS evals: - actual: 20 - expected: 20 + actual: 28 + expected: 28 -------------------- ======================== IMEX Table ID 2 - stages: 3 - order: 2 + stages: 6 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 5 Fe RHS evals: - actual: 3 - expected: 3 + actual: 6 + expected: 6 Fi RHS evals: - actual: 5 - expected: 5 + actual: 11 + expected: 11 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 10 Fe RHS evals: - actual: 6 - expected: 6 + actual: 12 + expected: 12 Fi RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 15 Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 20 Fe RHS evals: - actual: 12 - expected: 12 + actual: 24 + expected: 24 Fi RHS evals: - actual: 20 - expected: 20 + actual: 44 + expected: 44 -------------------- ======================== IMEX Table ID 3 - stages: 3 - order: 2 + stages: 7 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 6 Fe RHS evals: - actual: 3 - expected: 3 + actual: 7 + expected: 7 Fi RHS evals: - actual: 5 - expected: 5 + actual: 13 + expected: 13 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 12 Fe RHS evals: - actual: 6 - expected: 6 + actual: 14 + expected: 14 Fi RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 18 Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 24 Fe RHS evals: - actual: 12 - expected: 12 + actual: 28 + expected: 28 Fi RHS evals: - actual: 20 - expected: 20 + actual: 52 + expected: 52 -------------------- ======================== IMEX Table ID 4 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 32 + expected: 32 Fi RHS evals: - actual: 20 - expected: 20 + actual: 60 + expected: 60 -------------------- ======================== IMEX Table ID 5 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 32 + expected: 32 Fi RHS evals: - actual: 20 - expected: 20 + actual: 60 + expected: 60 -------------------- diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_1_0.out b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_1_0.out index b2d194bc1e..02af9aea19 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_1_0.out +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_1_0.out @@ -7,6 +7,7 @@ Dahlquist ODE test problem: relative tol = 0.0001 absolute tol = 1e-06 interp type = Hermite + pred type = Trivial (0) ======================== Test explicit RK methods @@ -1910,272 +1911,272 @@ Fi RHS evals: ======================== IMEX Table ID 1 - stages: 3 - order: 2 + stages: 4 + order: 3 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 3 Fe RHS evals: - actual: 3 - expected: 3 + actual: 4 + expected: 4 Fi RHS evals: - actual: 5 - expected: 5 + actual: 7 + expected: 7 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 6 Fe RHS evals: - actual: 6 - expected: 6 + actual: 8 + expected: 8 Fi RHS evals: - actual: 10 - expected: 10 + actual: 14 + expected: 14 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 9 Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 13 + expected: 13 Fi RHS evals: - actual: 16 - expected: 16 + actual: 22 + expected: 22 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 12 Fe RHS evals: - actual: 12 - expected: 12 + actual: 16 + expected: 16 Fi RHS evals: - actual: 20 - expected: 20 + actual: 28 + expected: 28 -------------------- ======================== IMEX Table ID 2 - stages: 3 - order: 2 + stages: 6 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 5 Fe RHS evals: - actual: 3 - expected: 3 + actual: 6 + expected: 6 Fi RHS evals: - actual: 5 - expected: 5 + actual: 11 + expected: 11 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 10 Fe RHS evals: - actual: 6 - expected: 6 + actual: 12 + expected: 12 Fi RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 15 Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 19 + expected: 19 Fi RHS evals: - actual: 16 - expected: 16 + actual: 34 + expected: 34 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 20 Fe RHS evals: - actual: 12 - expected: 12 + actual: 24 + expected: 24 Fi RHS evals: - actual: 20 - expected: 20 + actual: 44 + expected: 44 -------------------- ======================== IMEX Table ID 3 - stages: 3 - order: 2 + stages: 7 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 6 Fe RHS evals: - actual: 3 - expected: 3 + actual: 7 + expected: 7 Fi RHS evals: - actual: 5 - expected: 5 + actual: 13 + expected: 13 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 12 Fe RHS evals: - actual: 6 - expected: 6 + actual: 14 + expected: 14 Fi RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 18 Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 Fi RHS evals: - actual: 16 - expected: 16 + actual: 40 + expected: 40 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 24 Fe RHS evals: - actual: 12 - expected: 12 + actual: 28 + expected: 28 Fi RHS evals: - actual: 20 - expected: 20 + actual: 52 + expected: 52 -------------------- ======================== IMEX Table ID 4 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 Fi RHS evals: - actual: 16 - expected: 16 + actual: 47 + expected: 47 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 33 + expected: 33 Fi RHS evals: - actual: 20 - expected: 20 + actual: 61 + expected: 61 -------------------- ======================== IMEX Table ID 5 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 Fi RHS evals: - actual: 16 - expected: 16 + actual: 47 + expected: 47 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 33 + expected: 33 Fi RHS evals: - actual: 20 - expected: 20 + actual: 61 + expected: 61 -------------------- diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_1_1.out b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_1_1.out index 0f7bb5584a..8e54df6754 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_1_1.out +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_1_1.out @@ -7,6 +7,7 @@ Dahlquist ODE test problem: relative tol = 0.0001 absolute tol = 1e-06 interp type = Lagrange + pred type = Trivial (0) ======================== Test explicit RK methods @@ -1910,272 +1911,272 @@ Fi RHS evals: ======================== IMEX Table ID 1 - stages: 3 - order: 2 + stages: 4 + order: 3 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 3 Fe RHS evals: - actual: 3 - expected: 3 + actual: 4 + expected: 4 Fi RHS evals: - actual: 5 - expected: 5 + actual: 7 + expected: 7 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 6 Fe RHS evals: - actual: 6 - expected: 6 + actual: 8 + expected: 8 Fi RHS evals: - actual: 10 - expected: 10 + actual: 14 + expected: 14 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 9 Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 12 Fe RHS evals: - actual: 12 - expected: 12 + actual: 16 + expected: 16 Fi RHS evals: - actual: 20 - expected: 20 + actual: 28 + expected: 28 -------------------- ======================== IMEX Table ID 2 - stages: 3 - order: 2 + stages: 6 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 5 Fe RHS evals: - actual: 3 - expected: 3 + actual: 6 + expected: 6 Fi RHS evals: - actual: 5 - expected: 5 + actual: 11 + expected: 11 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 10 Fe RHS evals: - actual: 6 - expected: 6 + actual: 12 + expected: 12 Fi RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 15 Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 20 Fe RHS evals: - actual: 12 - expected: 12 + actual: 24 + expected: 24 Fi RHS evals: - actual: 20 - expected: 20 + actual: 44 + expected: 44 -------------------- ======================== IMEX Table ID 3 - stages: 3 - order: 2 + stages: 7 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 6 Fe RHS evals: - actual: 3 - expected: 3 + actual: 7 + expected: 7 Fi RHS evals: - actual: 5 - expected: 5 + actual: 13 + expected: 13 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 12 Fe RHS evals: - actual: 6 - expected: 6 + actual: 14 + expected: 14 Fi RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 18 Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 24 Fe RHS evals: - actual: 12 - expected: 12 + actual: 28 + expected: 28 Fi RHS evals: - actual: 20 - expected: 20 + actual: 52 + expected: 52 -------------------- ======================== IMEX Table ID 4 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 32 + expected: 32 Fi RHS evals: - actual: 20 - expected: 20 + actual: 60 + expected: 60 -------------------- ======================== IMEX Table ID 5 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 32 + expected: 32 Fi RHS evals: - actual: 20 - expected: 20 + actual: 60 + expected: 60 -------------------- diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_2_0.out b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_2_0.out index 0d00667042..363b66b2ac 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_2_0.out +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_2_0.out @@ -7,6 +7,7 @@ Dahlquist ODE test problem: relative tol = 0.0001 absolute tol = 1e-06 interp type = Hermite + pred type = Trivial (0) ======================== Test explicit RK methods @@ -1910,272 +1911,272 @@ Fi RHS evals: ======================== IMEX Table ID 1 - stages: 3 - order: 2 + stages: 4 + order: 3 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 3 Fe RHS evals: - actual: 3 - expected: 3 + actual: 4 + expected: 4 Fi RHS evals: - actual: 5 - expected: 5 + actual: 7 + expected: 7 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 6 Fe RHS evals: - actual: 6 - expected: 6 + actual: 8 + expected: 8 Fi RHS evals: - actual: 10 - expected: 10 + actual: 14 + expected: 14 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 9 Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 13 + expected: 13 Fi RHS evals: - actual: 16 - expected: 16 + actual: 22 + expected: 22 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 12 Fe RHS evals: - actual: 12 - expected: 12 + actual: 16 + expected: 16 Fi RHS evals: - actual: 20 - expected: 20 + actual: 28 + expected: 28 -------------------- ======================== IMEX Table ID 2 - stages: 3 - order: 2 + stages: 6 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 5 Fe RHS evals: - actual: 3 - expected: 3 + actual: 6 + expected: 6 Fi RHS evals: - actual: 5 - expected: 5 + actual: 11 + expected: 11 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 10 Fe RHS evals: - actual: 6 - expected: 6 + actual: 12 + expected: 12 Fi RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 15 Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 19 + expected: 19 Fi RHS evals: - actual: 16 - expected: 16 + actual: 34 + expected: 34 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 20 Fe RHS evals: - actual: 12 - expected: 12 + actual: 24 + expected: 24 Fi RHS evals: - actual: 20 - expected: 20 + actual: 44 + expected: 44 -------------------- ======================== IMEX Table ID 3 - stages: 3 - order: 2 + stages: 7 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 6 Fe RHS evals: - actual: 3 - expected: 3 + actual: 7 + expected: 7 Fi RHS evals: - actual: 5 - expected: 5 + actual: 13 + expected: 13 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 12 Fe RHS evals: - actual: 6 - expected: 6 + actual: 14 + expected: 14 Fi RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 18 Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 Fi RHS evals: - actual: 16 - expected: 16 + actual: 40 + expected: 40 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 24 Fe RHS evals: - actual: 12 - expected: 12 + actual: 28 + expected: 28 Fi RHS evals: - actual: 20 - expected: 20 + actual: 52 + expected: 52 -------------------- ======================== IMEX Table ID 4 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 Fi RHS evals: - actual: 16 - expected: 16 + actual: 47 + expected: 47 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 33 + expected: 33 Fi RHS evals: - actual: 20 - expected: 20 + actual: 61 + expected: 61 -------------------- ======================== IMEX Table ID 5 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 Fi RHS evals: - actual: 16 - expected: 16 + actual: 47 + expected: 47 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 33 + expected: 33 Fi RHS evals: - actual: 20 - expected: 20 + actual: 61 + expected: 61 -------------------- diff --git a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_2_1.out b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_2_1.out index b48ee0df1d..bf8edcf74b 100644 --- a/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_2_1.out +++ b/test/unit_tests/arkode/CXX_serial/ark_test_dahlquist_ark_2_1.out @@ -7,6 +7,7 @@ Dahlquist ODE test problem: relative tol = 0.0001 absolute tol = 1e-06 interp type = Lagrange + pred type = Trivial (0) ======================== Test explicit RK methods @@ -1910,272 +1911,272 @@ Fi RHS evals: ======================== IMEX Table ID 1 - stages: 3 - order: 2 + stages: 4 + order: 3 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 3 Fe RHS evals: - actual: 3 - expected: 3 + actual: 4 + expected: 4 Fi RHS evals: - actual: 5 - expected: 5 + actual: 7 + expected: 7 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 6 Fe RHS evals: - actual: 6 - expected: 6 + actual: 8 + expected: 8 Fi RHS evals: - actual: 10 - expected: 10 + actual: 14 + expected: 14 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 9 Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 12 + expected: 12 Fi RHS evals: - actual: 15 - expected: 15 + actual: 21 + expected: 21 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 12 Fe RHS evals: - actual: 12 - expected: 12 + actual: 16 + expected: 16 Fi RHS evals: - actual: 20 - expected: 20 + actual: 28 + expected: 28 -------------------- ======================== IMEX Table ID 2 - stages: 3 - order: 2 + stages: 6 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 5 Fe RHS evals: - actual: 3 - expected: 3 + actual: 6 + expected: 6 Fi RHS evals: - actual: 5 - expected: 5 + actual: 11 + expected: 11 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 10 Fe RHS evals: - actual: 6 - expected: 6 + actual: 12 + expected: 12 Fi RHS evals: - actual: 10 - expected: 10 + actual: 22 + expected: 22 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 15 Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 18 + expected: 18 Fi RHS evals: - actual: 15 - expected: 15 + actual: 33 + expected: 33 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 20 Fe RHS evals: - actual: 12 - expected: 12 + actual: 24 + expected: 24 Fi RHS evals: - actual: 20 - expected: 20 + actual: 44 + expected: 44 -------------------- ======================== IMEX Table ID 3 - stages: 3 - order: 2 + stages: 7 + order: 4 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 6 Fe RHS evals: - actual: 3 - expected: 3 + actual: 7 + expected: 7 Fi RHS evals: - actual: 5 - expected: 5 + actual: 13 + expected: 13 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 12 Fe RHS evals: - actual: 6 - expected: 6 + actual: 14 + expected: 14 Fi RHS evals: - actual: 10 - expected: 10 + actual: 26 + expected: 26 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 18 Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 21 + expected: 21 Fi RHS evals: - actual: 15 - expected: 15 + actual: 39 + expected: 39 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 24 Fe RHS evals: - actual: 12 - expected: 12 + actual: 28 + expected: 28 Fi RHS evals: - actual: 20 - expected: 20 + actual: 52 + expected: 52 -------------------- ======================== IMEX Table ID 4 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 32 + expected: 32 Fi RHS evals: - actual: 20 - expected: 20 + actual: 60 + expected: 60 -------------------- ======================== IMEX Table ID 5 - stages: 3 - order: 2 + stages: 8 + order: 5 explicit 1st stage: 1 stiffly accurate: 0 first same as last: 0 ======================== -------------------- Steps: 1 -NLS iters: 2 +NLS iters: 7 Fe RHS evals: - actual: 3 - expected: 3 + actual: 8 + expected: 8 Fi RHS evals: - actual: 5 - expected: 5 + actual: 15 + expected: 15 -------------------- Steps: 2 -NLS iters: 4 +NLS iters: 14 Fe RHS evals: - actual: 6 - expected: 6 + actual: 16 + expected: 16 Fi RHS evals: - actual: 10 - expected: 10 + actual: 30 + expected: 30 -------------------- Steps: 3 -NLS iters: 6 +NLS iters: 21 Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Dense Output Fe RHS evals: - actual: 9 - expected: 9 + actual: 24 + expected: 24 Fi RHS evals: - actual: 15 - expected: 15 + actual: 45 + expected: 45 -------------------- Steps: 4 -NLS iters: 8 +NLS iters: 28 Fe RHS evals: - actual: 12 - expected: 12 + actual: 32 + expected: 32 Fi RHS evals: - actual: 20 - expected: 20 + actual: 60 + expected: 60 --------------------