From 602d081e8e6f137d600f0d020d9fe8c7a4015c27 Mon Sep 17 00:00:00 2001 From: Reid Gomillion Date: Mon, 16 Dec 2024 20:14:04 -0500 Subject: [PATCH 1/4] Fixed IDA Interface Final Copy --- Examples/ScaleMicrogrid/ScaleMicrogrid.cpp | 3 +-- Examples/ScaleMicrogrid/SolutionKeys.hpp | 9 +++++---- Solver/Dynamic/Ida.cpp | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Examples/ScaleMicrogrid/ScaleMicrogrid.cpp b/Examples/ScaleMicrogrid/ScaleMicrogrid.cpp index 55b5c5a..2371ff4 100644 --- a/Examples/ScaleMicrogrid/ScaleMicrogrid.cpp +++ b/Examples/ScaleMicrogrid/ScaleMicrogrid.cpp @@ -66,7 +66,6 @@ int test(index_type Nsize, real_type error_tol, bool debug_output, bool use_DAE_ { using namespace ModelLib; - index_type max_step_number = 3000; bool usejac = true; real_type t_init = 0.0; @@ -79,7 +78,7 @@ int test(index_type Nsize, real_type error_tol, bool debug_output, bool use_DAE_ auto* sysmodel = new PowerElectronicsModel(reltol, abstol, usejac, - max_step_number); + SCALE_MICROGRID_MAX_STEPS); const std::vector* true_vec = use_DAE_keys ? &answer_key_N8_DAE : &answer_key_N8; diff --git a/Examples/ScaleMicrogrid/SolutionKeys.hpp b/Examples/ScaleMicrogrid/SolutionKeys.hpp index 56f8f40..8476a1a 100644 --- a/Examples/ScaleMicrogrid/SolutionKeys.hpp +++ b/Examples/ScaleMicrogrid/SolutionKeys.hpp @@ -29,10 +29,11 @@ * * ODE Keys gives similar results. */ -constexpr real_type SCALE_MICROGRID_ERROR_TOL = 8.0e-5; -constexpr real_type SCALE_MICROGRID_REL_TOL = 1.0e-7; -constexpr real_type SCALE_MICROGRID_ABS_TOL = 1.0e-7; -const bool USE_DAE_KEYS = true; +constexpr real_type SCALE_MICROGRID_ERROR_TOL = 1.0e-6; +constexpr real_type SCALE_MICROGRID_REL_TOL = 1.0e-8; +constexpr real_type SCALE_MICROGRID_ABS_TOL = 1.0e-8; +constexpr index_type SCALE_MICROGRID_MAX_STEPS = 10000; +const bool USE_DAE_KEYS = false; const std::vector answer_key_N2 = {22975.4182636905, diff --git a/Solver/Dynamic/Ida.cpp b/Solver/Dynamic/Ida.cpp index 95e15b1..c58ae8b 100644 --- a/Solver/Dynamic/Ida.cpp +++ b/Solver/Dynamic/Ida.cpp @@ -286,6 +286,11 @@ namespace Sundials tout += dt; } } + + model_->updateTime(tf, 0.0); + copyVec(yy_, model_->y()); + copyVec(yp_, model_->yp()); + //std::cout << "\n"; return retval; } From c4eac32a24bd80e20e847b1104122af576119b6a Mon Sep 17 00:00:00 2001 From: Reid Gomillion Date: Tue, 17 Dec 2024 10:42:24 -0500 Subject: [PATCH 2/4] Updated some Comments --- Examples/ScaleMicrogrid/SolutionKeys.hpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Examples/ScaleMicrogrid/SolutionKeys.hpp b/Examples/ScaleMicrogrid/SolutionKeys.hpp index 8476a1a..a6be3cb 100644 --- a/Examples/ScaleMicrogrid/SolutionKeys.hpp +++ b/Examples/ScaleMicrogrid/SolutionKeys.hpp @@ -19,15 +19,14 @@ /// /** - * The SCALE_MICROGRID_ERROR_TOL is slightly above best error obtained on the N=8 microgrid. The error "bottoms out" so any decrease in relative error yields no improvements (or increased error). - * REL_TOL and ABS_TOL determine the amount of error the problem produces. The tolerances given produce reasonable error results for N=8. + * The SCALE_MICROGRID_ERROR_TOL is a metric to determine if the error is good enough to pass the test. + * REL_TOL and ABS_TOL determine the amount of error the problem produces. As the tolerance decrease so does the error. * - * For DAE References keys on N=8: - * Abs/Rel tolerance = 1e-6 gives 2-Norm Relative Error: 4.38299e-05 - * Abs/Rel tolerance = 1e-7 gives 2-Norm Relative Error: 1.72282e-05 - * Abs/Rel tolerance = 1e-8 gives 2-Norm Relative Error: 4.98493e-05 + * For ODE References keys on N=8: + * 2-Norm Relative Error: 2.33318e-07 (rel/abs tol = 1e-6) + * 2-Norm Relative Error: 8.65796e-08 (rel/abs tol = 1e-7) + * 2-Norm Relative Error: 1.1618e-08 (rel/abs tol = 1e-8) * - * ODE Keys gives similar results. */ constexpr real_type SCALE_MICROGRID_ERROR_TOL = 1.0e-6; constexpr real_type SCALE_MICROGRID_REL_TOL = 1.0e-8; From cf3cb32e447f988fa173eb681b7dfe312efb0150 Mon Sep 17 00:00:00 2001 From: Reid Gomillion Date: Wed, 18 Dec 2024 14:43:55 -0500 Subject: [PATCH 3/4] Reenabled Scale Microgrid Testing - Removed DAE Keys - Updated Formatting --- Examples/ScaleMicrogrid/CMakeLists.txt | 2 +- Examples/ScaleMicrogrid/ScaleMicrogrid.cpp | 16 +- Examples/ScaleMicrogrid/SolutionKeys.hpp | 1516 +++++++------------- 3 files changed, 515 insertions(+), 1019 deletions(-) diff --git a/Examples/ScaleMicrogrid/CMakeLists.txt b/Examples/ScaleMicrogrid/CMakeLists.txt index 0ac8101..d1822c5 100644 --- a/Examples/ScaleMicrogrid/CMakeLists.txt +++ b/Examples/ScaleMicrogrid/CMakeLists.txt @@ -9,5 +9,5 @@ target_link_libraries(scalemicrogrid GRIDKIT::powerelec_disgen GRIDKIT::solvers_dyn GRIDKIT::powerelec_mircobusdq) -#add_test(NAME ScaleMicrogrid COMMAND $) +add_test(NAME ScaleMicrogrid COMMAND $) install(TARGETS scalemicrogrid RUNTIME DESTINATION bin) diff --git a/Examples/ScaleMicrogrid/ScaleMicrogrid.cpp b/Examples/ScaleMicrogrid/ScaleMicrogrid.cpp index 2371ff4..3b645f1 100644 --- a/Examples/ScaleMicrogrid/ScaleMicrogrid.cpp +++ b/Examples/ScaleMicrogrid/ScaleMicrogrid.cpp @@ -24,7 +24,7 @@ using real_type = double; #include "SolutionKeys.hpp" -static int test(index_type Nsize, real_type test_tolerance, bool error_tol = false, bool use_DAE_keys = false); +static int test(index_type Nsize, real_type test_tolerance, bool error_tol = false); /** * @brief Run Scale Microgrid test cases of N = (2,4,8) and check for correctness. @@ -39,9 +39,9 @@ int main(int argc, char const *argv[]) bool debug_out = false; real_type tol = SCALE_MICROGRID_ERROR_TOL; - retval += test(2, tol, debug_out, USE_DAE_KEYS); - retval += test(4, tol, debug_out, USE_DAE_KEYS); - retval += test(8, tol, debug_out, USE_DAE_KEYS); + retval += test(2, tol, debug_out); + retval += test(4, tol, debug_out); + retval += test(8, tol, debug_out); if (retval > 0) { std::cout << "Some tests fail!!\n"; @@ -62,7 +62,7 @@ int main(int argc, char const *argv[]) * @param use_DAE_keys - Choice between using DAE or ODE keys * @return int returns 0 if successful, >0 otherwise */ -int test(index_type Nsize, real_type error_tol, bool debug_output, bool use_DAE_keys) +int test(index_type Nsize, real_type error_tol, bool debug_output) { using namespace ModelLib; @@ -80,15 +80,15 @@ int test(index_type Nsize, real_type error_tol, bool debug_output, bool use_DAE_ usejac, SCALE_MICROGRID_MAX_STEPS); - const std::vector* true_vec = use_DAE_keys ? &answer_key_N8_DAE : &answer_key_N8; + const std::vector* true_vec = &answer_key_N8; switch (Nsize) { case 2: - true_vec = use_DAE_keys ? &answer_key_N2_DAE : &answer_key_N2; + true_vec = &answer_key_N2; break; case 4: - true_vec = use_DAE_keys ? &answer_key_N4_DAE : &answer_key_N4; + true_vec = &answer_key_N4; break; case 8: // true_vec = &answer_key_N8; diff --git a/Examples/ScaleMicrogrid/SolutionKeys.hpp b/Examples/ScaleMicrogrid/SolutionKeys.hpp index a6be3cb..1d0ca8e 100644 --- a/Examples/ScaleMicrogrid/SolutionKeys.hpp +++ b/Examples/ScaleMicrogrid/SolutionKeys.hpp @@ -5,10 +5,8 @@ * @brief Answer keys for Scaled Microgrid test with Nsize = 2, 4, 8 * * Data generated with Matlab ode23tb solver with tolerances set to - * abstol = 1e-12 and reltol = 1e-12 for the ODE derivation. - * - * DAE keys are generated with Matlab IDA interface with tolerances set to - * abstol = 1e-10 and reltol = 1e-10 for the DAE derivation. + * abstol = 1e-12 and reltol = 1e-12 for the ODE derivation of the model. + * No index reduction was preformed to get to the ODE model. * * @note This file is only to be included in ScaleMicrogrid.cpp. It has no * use anywhere else. @@ -22,7 +20,7 @@ * The SCALE_MICROGRID_ERROR_TOL is a metric to determine if the error is good enough to pass the test. * REL_TOL and ABS_TOL determine the amount of error the problem produces. As the tolerance decrease so does the error. * - * For ODE References keys on N=8: + * For References keys on N=8: * 2-Norm Relative Error: 2.33318e-07 (rel/abs tol = 1e-6) * 2-Norm Relative Error: 8.65796e-08 (rel/abs tol = 1e-7) * 2-Norm Relative Error: 1.1618e-08 (rel/abs tol = 1e-8) @@ -32,1015 +30,513 @@ constexpr real_type SCALE_MICROGRID_ERROR_TOL = 1.0e-6; constexpr real_type SCALE_MICROGRID_REL_TOL = 1.0e-8; constexpr real_type SCALE_MICROGRID_ABS_TOL = 1.0e-8; constexpr index_type SCALE_MICROGRID_MAX_STEPS = 10000; -const bool USE_DAE_KEYS = false; - - -const std::vector answer_key_N2 = {22975.4182636905, - 12753.1173017451, - 0.0376305671131306, - -0.0209815421114537, - 0.0184828563235406, - -0.00015632917065729, - 63.2193617412383, - -29.4226556659582, - 363.420924977355, - -3.01001804456668e-06, - 63.2193618667302, - -35.0920143829141, - -0.00755583999797958, - 22975.8457840701, - 8742.0172166684, - 0.0371009878165673, - -0.0142112776774797, - 0.0187407972932474, - -9.8913852531819e-05, - 62.3296548917654, - -17.9650261562766, - 368.635407345931, - 3.79041261513032e-05, - 62.3296560841534, - -23.7157298601546, - -0.0827401584095097, - 17277.712521392, - 16493.7578328327, - 0.0311645357391787, - -0.0298601153771274, - 0.0225001003469904, - -0.000264388302121386, - 48.6166482764357, - -40.8862612232969, - 355.25957014696, - -0.000167008045114112, - 48.6166481095298, - -46.4283022775928, - -0.0844566209033113, - 17277.2493364959, - 9182.29479881977, - 0.0302503981389185, - -0.0161722538457184, - 0.023180586071601, - -0.000129590157483103, - 47.1906392248137, - -19.3574255862892, - 366.226354188735, - 0.000121054462396047, - 47.19063792117, - -25.0705499054599, - -18.8125403122072, - 21.1471334522508, - 43.2997340692497, - -3.03798323340816, - -44.8715356440453, - 28.9585224749495, - 81.99613295014, - -56.2385627562355, - 132.749774614687, - -82.280664729262, - 311.999576042192, - 357.692287974629, - -5.85078929333349, - 364.119335219897, - -8.84631033126304, - 347.214535767435, - -32.7241067379802, - 360.411028950125, - -34.9283280833745}; - -const std::vector answer_key_N4 = {27828.3291148094, - 10602.3611530864, - 0.0452452394028709, - -0.0173410584955486, - 0.018686818367312, - -0.000129595027000909, - 76.0120809944985, - -23.2367034227098, - 366.216582730654, - -0.000167782960864797, - 76.0120710728117, - -28.9413214479885, - -0.0154989336357971, - 27832.0772154743, - 7838.80352597054, - 0.0448129806183038, - -0.0127296381144373, - 0.0188642014642206, - -9.04502393904097e-05, - 75.2859236720964, - -15.4316980534341, - 369.809174828127, - -5.17440472732025e-05, - 75.285919083362, - -21.1922719962368, - -0.142596248886844, - 20950.1519748442, - 16334.3924580166, - 0.0377787488551238, - -0.0295717781600636, - 0.0225780601074885, - -0.000265567743682681, - 58.9348270364006, - -40.4081583028089, - 355.498460539903, - -8.66167274613643e-05, - 58.9348242715342, - -45.9457664944992, - -0.164628885385433, - 20956.2846481359, - 12345.7855779785, - 0.0371673110634281, - -0.0220171188824754, - 0.0229486760225139, - -0.000191111142238558, - 57.9810673844105, - -28.5265491599081, - 361.481100853144, - 8.24481547667206e-05, - 57.9810719040216, - -34.1573355283559, - -0.245126576498858, - 20978.9206932923, - 17875.6825958711, - 0.0380785081131898, - -0.0325621468970297, - 0.0224354615928625, - -0.000295085318936756, - 59.4025243779293, - -45.1101946009202, - 353.186117339098, - 5.52721744209165e-05, - 59.4025238741703, - -50.6117204294148, - -0.253672269778405, - 20990.6142554844, - 11779.5685373245, - 0.0371243965775962, - -0.0209716906203726, - 0.0230016494389548, - -0.000180846578022512, - 57.9140614794815, - -26.8817831662193, - 362.331254349606, - 0.000209247259473183, - 57.9140782926947, - -32.5257339504705, - -0.288747285297145, - 21004.5418902462, - 16686.981801999, - 0.0379131316203435, - -0.0302602142538338, - 0.0225460339603269, - -0.000272422675391038, - 59.1444740212228, - -41.4902940591195, - 354.969993387113, - 8.14114753778542e-05, - 59.1444846638236, - -47.0195494892644, - -0.285876486857154, - 21005.895228757, - 8274.13913126834, - 0.0366267978764156, - -0.0145584209340773, - 0.0233276948336748, - -0.000117627382397687, - 57.1378568500881, - -16.7923279871216, - 367.58883605301, - 0.000263351556352378, - 57.1378679159653, - -22.518140603782, - -6.57009481597077, - 28.1053117219546, - 68.341829672125, - 5.75010361666728, - -7.27398138223966, - 42.3413009908014, - 44.2901915856089, - -0.850144510998897, - -26.9214526328474, - 37.7939474726438, - 20.9421230166698, - -8.2155394685309, - -48.4341275019927, - 37.706248875936, - 82.5460878639016, - -57.0458911301263, - 127.388509162578, - -90.4406093871607, - 116.522583626035, - -102.149734009655, - 112.650118587972, - -107.825883544914, - 311.543402422187, - 360.780248808368, - -7.42039816792328, - 365.078323407317, - -13.2331839185884, - 344.46378568747, - -54.5546252592288, - 350.335287885457, - -63.572021962256, - 334.342198258035, - -88.749585714325, - 344.281369936645, - -94.7726681838823, - 332.2248206198, - -103.942854393111, - 347.103721199815, - -107.812479611979}; -const std::vector answer_key_N8 = {29266.6517718661, - 9842.93617289812, - 0.0475360674334622, - -0.0160323945316821, - 0.0187557247105805, - -0.000119821248231538, - 79.8612117213119, - -21.0144010498971, - 367.201497494684, - -0.00135963018489767, - 79.8611351716573, - -26.7318789917162, - -0.018074876389402, - 29296.9645459408, - 7415.51099954903, - 0.0471789367393934, - -0.0120180219897291, - 0.0189117902285582, - -8.57914733703415e-05, - 79.2614266664798, - -14.2194852461262, - 370.357116139458, - -0.00065261697325357, - 79.261388452934, - -19.9860446882469, - -0.161178046356866, - 22178.7337755581, - 15750.48869542, - 0.0399575496599213, - -0.028431003000158, - 0.0226540351215628, - -0.000255811047442045, - 62.3338080750298, - -38.6061338491152, - 356.372404460464, - -0.000888421043595241, - 62.3337589017493, - -44.1546192236143, - -0.191206982234175, - 22245.3587939821, - 12476.0312983393, - 0.0395296431152022, - -0.0222832972915751, - 0.0229591349358969, - -0.000195357283522886, - 61.6667253463805, - -28.9363062720176, - 361.284131747149, - 0.000606091049765824, - 61.6667589580497, - -34.5611135316627, - -0.300475535038271, - 22471.354929649, - 17410.9400696732, - 0.0407475331761201, - -0.0316496339533813, - 0.0225047347006168, - -0.000287941144857336, - 63.5662158978541, - -43.6654709736205, - 353.882194971394, - -0.00050508442766251, - 63.5661867600733, - -49.1745383652835, - -0.321406735230742, - 22562.1063953332, - 12532.040739496, - 0.0400730650460856, - -0.0224103188019356, - 0.0229590093469276, - -0.000197040279593967, - 62.5145400797163, - -29.1337602252211, - 361.200953962968, - 0.00123813270414561, - 62.5146115608051, - -34.7565572443792, - -0.398765881347133, - 22822.9625175864, - 17526.9123376124, - 0.0413769691613727, - -0.0318846988884131, - 0.0224996948233429, - -0.000290724959665147, - 64.5480523645119, - -44.0326735095454, - 353.709220392926, - -0.000255137918253834, - 64.548036917491, - -49.5382706457328, - -0.409294621792759, - 22917.4640781459, - 11700.1980576741, - 0.0405370737861658, - -0.0208717910251266, - 0.0230419643488667, - -0.000182321342412399, - 63.2383663569188, - -26.7111380754575, - 362.449323338104, - 0.00143605100750772, - 63.2384503029344, - -32.3525635247183, - -0.460038982115987, - 23175.0870418607, - 17429.0372806116, - 0.0419717095772374, - -0.0317010913432995, - 0.0225145433123769, - -0.000289381352876061, - 65.4757968347883, - -43.7415548084125, - 353.856643943042, - -0.000116590766441278, - 65.4757901489451, - -49.2486679790579, - -0.461848591689221, - 23264.6732405303, - 10919.0360806903, - 0.0409947737541995, - -0.0194331296392293, - 0.0231200668519233, - -0.000168575863901554, - 63.9522672718067, - -24.4455560147541, - 363.621937642842, - 0.00154556746783549, - 63.9523565934322, - -30.1044436917781, - -0.491529580804623, - 23488.6137650364, - 17313.8654584652, - 0.0424952351974662, - -0.0314883547842804, - 0.0225303364455447, - -0.000287714847080755, - 66.2924442955506, - -43.4048501801219, - 354.030311475628, - 0.000169934086992562, - 66.2924545883603, - -48.9139721676174, - -0.486548093474613, - 23557.6136117665, - 10241.0790360359, - 0.0413774884672506, - -0.0181860120867723, - 0.0231877453638413, - -0.000156639599075328, - 64.5492156984859, - -22.4816084883194, - 364.639179755733, - 0.00142420279185394, - 64.5492984953198, - -28.1556597465189, - -0.499726325044563, - 23722.4168131373, - 16958.7765974266, - 0.0428487548646152, - -0.0308090857078185, - 0.0225672437721518, - -0.000281355782039133, - 66.8440182379463, - -42.3350991467661, - 354.562942832682, - 0.000573219240561573, - 66.844044569212, - -47.8519918014414, - -0.490219448053285, - 23769.8747006891, - 9267.5206785042, - 0.0415639300026818, - -0.0164109903099032, - 0.0232814268213158, - -0.000139385907988285, - 64.8399200066663, - -19.6874999818575, - 366.100410278813, - 0.00128332197988872, - 64.8400012051758, - -25.3838027935624, - -0.491586583798841, - 23854.0240861864, - 15160.7060140903, - 0.0427385845553072, - -0.0273659210853948, - 0.0227360281885303, - -0.00024756822257102, - 66.6722121992594, - -36.9193366680176, - 357.260483774461, - 0.000734666517031364, - 66.6722602990682, - -42.4779079553274, - -0.482907936930927, - 23870.5548740189, - 6166.60742794455, - 0.0412253604361869, - -0.0108406830677542, - 0.0235710268609798, - -8.45378382385454e-05, - 64.3117067426907, - -10.9219886629635, - 370.751596332923, - 0.00130490570318174, - 64.3117765573399, - -16.6904284244068, - -2.9267653635869, - 30.5878043390112, - 75.9238910016987, - 9.17392754248112, - 4.3701560041079, - 48.7765765968327, - 58.3101300775815, - 3.13323809951331, - -6.37573932293514, - 46.1701408549949, - 41.9244199648313, - -6.5432868117422, - -17.3691293511209, - 41.8611610718482, - 27.7383173553277, - -12.9709065074016, - -27.5322418670623, - 38.9032728624808, - 16.2733736528389, - -16.5280348065045, - -36.4800564569504, - 37.0627808819117, - 7.38198504755967, - -17.9899033675727, - -44.0731708800056, - 36.9539474625741, - 1.14781892918688, - -15.9507601441003, - -49.1751072411967, - 44.6278268007059, - 82.7517114852138, - -57.3188928805757, - 125.959171148664, - -93.1822145893453, - 110.816672146529, - -108.811406393296, - 99.5107131550674, - -119.104827911048, - 92.0427992280762, - -125.056967118294, - 88.0811872722293, - -127.985464658329, - 87.1649116220972, - -128.957730829954, - 89.0189233593932, - -129.480383815729, - 311.408200092424, - 361.890500304156, - -7.90450151715305, - 365.594288034004, - -14.6504114199963, - 344.278948204657, - -61.517809887448, - 348.104769580715, - -73.1715704285651, - 329.472137794467, - -107.797643650827, - 335.509251816504, - -117.787067889008, - 317.044841017058, - -139.602945170765, - 325.182412285621, - -147.51178633583, - 307.989533967543, - -158.91998673915, - 318.171184823086, - -165.141414351062, - 302.951769665185, - -168.712626964975, - 315.009688292198, - -173.624287308414, - 302.070219389208, - -171.572667424371, - 315.86470341008, - -175.706947618597, - 306.288884765777, - -170.785573848562, - 322.018589824395, - -176.179397251772}; - - -const std::vector answer_key_N2_DAE = { - 2.297541719041679e+04, - 1.275311765147108e+04, - 3.763057157040971e-02, - -2.098154154261139e-02, - 1.848285635148731e-02, - -1.563291642906142e-04, - 6.321936930625224e+01, - -2.942265471303313e+01, - 3.634209242914501e+02, - -3.045684824495465e-06, - 6.321936942863077e+01, - -3.509201342129595e+01, - -7.555848031514452e-03, - 2.297585236966169e+04, - 8.742019990171168e+03, - 3.710098161476642e-02, - -1.421128505917718e-02, - 1.874079698999637e-02, - -9.891389376181939e-05, - 6.232964406399454e+01, - -1.796503842393993e+01, - 3.686354049318991e+02, - 3.751873449745017e-05, - 6.232964525578942e+01, - -2.371574207794292e+01, - -8.274016162319756e-02, - 1.727767404885989e+04, - 1.649375969003496e+04, - 3.116449676565603e-02, - -2.986008173529230e-02, - 2.250010019594372e-02, - -2.643878737865742e-04, - 4.861658815717433e+01, - -4.088620896281158e+01, - 3.552595607627522e+02, - -1.680455555650307e-04, - 4.861658792543699e+01, - -4.642824996160168e+01, - -8.445661563538766e-02, - 1.727728179371241e+04, - 9.182290044254985e+03, - 3.025043688374412e-02, - -1.617227844011643e-02, - 2.318058658515232e-02, - -1.295905135671149e-04, - 4.719069915986526e+01, - -1.935746376598984e+01, - 3.662263666084187e+02, - 1.224189321509073e-04, - 4.719069792100806e+01, - -2.507058820016623e+01, - -1.881253238067851e+01, - 2.114713445464166e+01, - 4.329973088638799e+01, - -3.037994865718278e+00, - -4.487159235127143e+01, - 2.895856545774092e+01, - 8.199613258060604e+01, - -5.623856279691694e+01, - 1.327497723234738e+02, - -8.228066237702261e+01, - 3.119995761430801e+02, - 3.576922870324011e+02, - -5.850790206644863e+00, - 3.641193324349034e+02, - -8.846312286666922e+00, - 3.472145304070430e+02, - -3.272410408548523e+01, - 3.604110381897520e+02, - -3.492833019335006e+01 +const std::vector answer_key_N2 = { + 22975.4182636905, + 12753.1173017451, + 0.0376305671131306, + -0.0209815421114537, + 0.0184828563235406, + -0.00015632917065729, + 63.2193617412383, + -29.4226556659582, + 363.420924977355, + -3.01001804456668e-06, + 63.2193618667302, + -35.0920143829141, + -0.00755583999797958, + 22975.8457840701, + 8742.0172166684, + 0.0371009878165673, + -0.0142112776774797, + 0.0187407972932474, + -9.8913852531819e-05, + 62.3296548917654, + -17.9650261562766, + 368.635407345931, + 3.79041261513032e-05, + 62.3296560841534, + -23.7157298601546, + -0.0827401584095097, + 17277.712521392, + 16493.7578328327, + 0.0311645357391787, + -0.0298601153771274, + 0.0225001003469904, + -0.000264388302121386, + 48.6166482764357, + -40.8862612232969, + 355.25957014696, + -0.000167008045114112, + 48.6166481095298, + -46.4283022775928, + -0.0844566209033113, + 17277.2493364959, + 9182.29479881977, + 0.0302503981389185, + -0.0161722538457184, + 0.023180586071601, + -0.000129590157483103, + 47.1906392248137, + -19.3574255862892, + 366.226354188735, + 0.000121054462396047, + 47.19063792117, + -25.0705499054599, + -18.8125403122072, + 21.1471334522508, + 43.2997340692497, + -3.03798323340816, + -44.8715356440453, + 28.9585224749495, + 81.99613295014, + -56.2385627562355, + 132.749774614687, + -82.280664729262, + 311.999576042192, + 357.692287974629, + -5.85078929333349, + 364.119335219897, + -8.84631033126304, + 347.214535767435, + -32.7241067379802, + 360.411028950125, + -34.9283280833745 }; -const std::vector answer_key_N4_DAE = { - 2.782838076021223e+04, - 1.060233951161282e+04, - 4.524530627720715e-02, - -1.734102614495181e-02, - 1.868682034372371e-02, - -1.295947997844333e-04, - 7.601219338981612e+01, - -2.323664837438791e+01, - 3.662166108301150e+02, - -1.677293667160457e-04, - 7.601218347399282e+01, - -2.894126674867152e+01, - -1.549900141751356e-02, - 2.783213397357297e+04, - 7.838793196628567e+03, - 4.481305404000931e-02, - -1.272962831329438e-02, - 1.886420268937792e-02, - -9.045021061413462e-05, - 7.528604666257070e+01, - -1.543168109995027e+01, - 3.698091894030975e+02, - -5.163473458846622e-05, - 7.528604208453102e+01, - -2.119225517047163e+01, - -1.425968088122309e-01, - 2.095015801120476e+04, - 1.633438798886211e+04, - 3.777873836318970e-02, - -2.957176107937700e-02, - 2.257806050570516e-02, - -2.655675374442015e-04, - 5.893481080746364e+01, - -4.040813143198271e+01, - 3.554984658208013e+02, - -8.721789032409604e-05, - 5.893480802571856e+01, - -4.594573969360955e+01, - -1.646295921535254e-01, - 2.095630178468731e+04, - 1.234579420974032e+04, - 3.716735449634696e-02, - -2.201713484983202e-02, - 2.294867558029812e-02, - -1.911113609461604e-04, - 5.798113501424770e+01, - -2.852657424339155e+01, - 3.614810886524317e+02, - 8.303403839983571e-05, - 5.798113953996359e+01, - -3.415736038324161e+01, - -2.451278278293810e-01, - 2.097892915885819e+04, - 1.787568047314206e+04, - 3.807857926198746e-02, - -3.256215817376613e-02, - 2.243546234360414e-02, - -2.950855638729749e-04, - 5.940263513012273e+01, - -4.511021231437263e+01, - 3.531861230210558e+02, - 5.692889710962193e-05, - 5.940263466199058e+01, - -5.061173821147194e+01, - -2.536738044324753e-01, - 2.099057363418842e+04, - 1.177960223516588e+04, - 3.712427732802263e-02, - -2.097173030344690e-02, - 2.300164521765086e-02, - -1.808467724733043e-04, - 5.791387556073722e+01, - -2.688184585893707e+01, - 3.623312016516096e+02, - 2.071603718205303e-04, - 5.791389232201876e+01, - -3.252579591519814e+01, - -2.887491535152235e-01, - 2.100448062317164e+04, - 1.668700328371400e+04, - 3.791304206607053e-02, - -3.026022927406730e-02, - 2.254603131689775e-02, - -2.724226812406486e-04, - 5.914433469246447e+01, - -4.149031828328946e+01, - 3.549699571782559e+02, - 8.024636154644922e-05, - 5.914434528412491e+01, - -4.701957328785109e+01, - -2.858783887653725e-01, - 2.100587984476439e+04, - 8.274159039827327e+03, - 3.662678942079982e-02, - -1.455847242251028e-02, - 2.332769268863063e-02, - -1.176279429534711e-04, - 5.713784331324587e+01, - -1.679240901763864e+01, - 3.675888093653627e+02, - 2.643730389313655e-04, - 5.713785441301483e+01, - -2.251822125132894e+01, - -6.569988274095073e+00, - 2.810537404177077e+01, - 6.834205794457183e+01, - 5.750175777631025e+00, - -7.273748074969905e+00, - 4.234144609668736e+01, - 4.429045701630546e+01, - -8.500714521981804e-01, - -2.692103368736664e+01, - 3.779406922548627e+01, - 2.094227578847542e+01, - -8.215504482988427e+00, - -4.843402009357128e+01, - 3.770641456116947e+01, - 8.254609372013499e+01, - -5.704589874925730e+01, - 1.273884617031668e+02, - -9.044068248318843e+01, - 1.165224538053178e+02, - -1.021498835382052e+02, - 1.126499079178531e+02, - -1.078260782164124e+02, - 3.115433975675194e+02, - 3.607802795292270e+02, - -7.420411849785007e+00, - 3.650783357319377e+02, - -1.323322247433883e+01, - 3.444637629912073e+02, - -5.455481920406162e+01, - 3.503352257412420e+02, - -6.357227246654439e+01, - 3.343420867821492e+02, - -8.875001322555080e+01, - 3.442811758628609e+02, - -9.477316449561945e+01, - 3.322245950069099e+02, - -1.039434511705126e+02, - 3.471034856790234e+02, - -1.078131251565851e+02 +const std::vector answer_key_N4 = { + 27828.3291148094, + 10602.3611530864, + 0.0452452394028709, + -0.0173410584955486, + 0.018686818367312, + -0.000129595027000909, + 76.0120809944985, + -23.2367034227098, + 366.216582730654, + -0.000167782960864797, + 76.0120710728117, + -28.9413214479885, + -0.0154989336357971, + 27832.0772154743, + 7838.80352597054, + 0.0448129806183038, + -0.0127296381144373, + 0.0188642014642206, + -9.04502393904097e-05, + 75.2859236720964, + -15.4316980534341, + 369.809174828127, + -5.17440472732025e-05, + 75.285919083362, + -21.1922719962368, + -0.142596248886844, + 20950.1519748442, + 16334.3924580166, + 0.0377787488551238, + -0.0295717781600636, + 0.0225780601074885, + -0.000265567743682681, + 58.9348270364006, + -40.4081583028089, + 355.498460539903, + -8.66167274613643e-05, + 58.9348242715342, + -45.9457664944992, + -0.164628885385433, + 20956.2846481359, + 12345.7855779785, + 0.0371673110634281, + -0.0220171188824754, + 0.0229486760225139, + -0.000191111142238558, + 57.9810673844105, + -28.5265491599081, + 361.481100853144, + 8.24481547667206e-05, + 57.9810719040216, + -34.1573355283559, + -0.245126576498858, + 20978.9206932923, + 17875.6825958711, + 0.0380785081131898, + -0.0325621468970297, + 0.0224354615928625, + -0.000295085318936756, + 59.4025243779293, + -45.1101946009202, + 353.186117339098, + 5.52721744209165e-05, + 59.4025238741703, + -50.6117204294148, + -0.253672269778405, + 20990.6142554844, + 11779.5685373245, + 0.0371243965775962, + -0.0209716906203726, + 0.0230016494389548, + -0.000180846578022512, + 57.9140614794815, + -26.8817831662193, + 362.331254349606, + 0.000209247259473183, + 57.9140782926947, + -32.5257339504705, + -0.288747285297145, + 21004.5418902462, + 16686.981801999, + 0.0379131316203435, + -0.0302602142538338, + 0.0225460339603269, + -0.000272422675391038, + 59.1444740212228, + -41.4902940591195, + 354.969993387113, + 8.14114753778542e-05, + 59.1444846638236, + -47.0195494892644, + -0.285876486857154, + 21005.895228757, + 8274.13913126834, + 0.0366267978764156, + -0.0145584209340773, + 0.0233276948336748, + -0.000117627382397687, + 57.1378568500881, + -16.7923279871216, + 367.58883605301, + 0.000263351556352378, + 57.1378679159653, + -22.518140603782, + -6.57009481597077, + 28.1053117219546, + 68.341829672125, + 5.75010361666728, + -7.27398138223966, + 42.3413009908014, + 44.2901915856089, + -0.850144510998897, + -26.9214526328474, + 37.7939474726438, + 20.9421230166698, + -8.2155394685309, + -48.4341275019927, + 37.706248875936, + 82.5460878639016, + -57.0458911301263, + 127.388509162578, + -90.4406093871607, + 116.522583626035, + -102.149734009655, + 112.650118587972, + -107.825883544914, + 311.543402422187, + 360.780248808368, + -7.42039816792328, + 365.078323407317, + -13.2331839185884, + 344.46378568747, + -54.5546252592288, + 350.335287885457, + -63.572021962256, + 334.342198258035, + -88.749585714325, + 344.281369936645, + -94.7726681838823, + 332.2248206198, + -103.942854393111, + 347.103721199815, + -107.812479611979 }; -const std::vector answer_key_N8_DAE = { - 2.926699797233736e+04, - 9.842776100014813e+03, - 4.753657309866977e-02, - -1.603213839330022e-02, - 1.875573937917211e-02, - -1.198194203275944e-04, - 7.986206115008950e+01, - -2.101396568018687e+01, - 3.672017060835176e+02, - -1.359366983288321e-03, - 7.986198461872281e+01, - -2.673144627243678e+01, - -1.807541282254975e-02, - 2.929730850485274e+04, - 7.415430584712431e+03, - 4.717944946622241e-02, - -1.201789919289676e-02, - 1.891179970842348e-02, - -8.579077203145384e-05, - 7.926228768159646e+01, - -1.421927553438715e+01, - 3.703572218737672e+02, - -6.523852558686899e-04, - 7.926224948238620e+01, - -1.998583602384812e+01, - -1.611820548393522e-01, - 2.217894245327611e+04, - 1.575039968580818e+04, - 3.995789998533841e-02, - -2.843083548032809e-02, - 2.265404689508083e-02, - -2.558096657596397e-04, - 6.233435468616655e+01, - -3.860586900044017e+01, - 3.563725374428990e+02, - -8.882781945982499e-04, - 6.233430551734479e+01, - -4.415435598146087e+01, - -1.912125594673128e-01, - 2.224555906199617e+04, - 1.247609282034064e+04, - 3.952998598517615e-02, - -2.228341165626430e-02, - 2.295913233285630e-02, - -1.953586522949026e-04, - 6.166726002169175e+01, - -2.893648478832565e+01, - 3.612840406095702e+02, - 6.060353080003564e-04, - 6.166729363137420e+01, - -3.456129017645432e+01, - -3.004864315879961e-01, - 2.247149472343561e+04, - 1.741088690697623e+04, - 4.074779758635367e-02, - -3.164953903633897e-02, - 2.250474221343758e-02, - -2.879404472588933e-04, - 6.356662837493591e+01, - -4.366532080763493e+01, - 3.538822752236204e+02, - -5.042936904932296e-04, - 6.356659925494284e+01, - -4.917438913946131e+01, - -3.214197704174538e-01, - 2.256221318539542e+04, - 1.253217203703263e+04, - 4.007324808449095e-02, - -2.241055226326166e-02, - 2.295899870177965e-02, - -1.970426574054279e-04, - 6.251482553344960e+01, - -2.913412675200203e+01, - 3.612007567577731e+02, - 1.237312572340744e-03, - 6.251489698944278e+01, - -3.475692046022827e+01, - -3.987850542328848e-01, - 2.282301125598250e+04, - 1.752688437801180e+04, - 4.137704519576484e-02, - -3.188465171269757e-02, - 2.249969813714937e-02, - -2.907245604968035e-04, - 6.454817091950278e+01, - -4.403259891661548e+01, - 3.537092631427385e+02, - -2.550706683880104e-04, - 6.454815548340814e+01, - -4.953819660955092e+01, - -4.093160161075935e-01, - 2.291748253009551e+04, - 1.170035218553600e+04, - 4.053714546276718e-02, - -2.087206114216698e-02, - 2.304195052599745e-02, - -1.823240161916938e-04, - 6.323847814446663e+01, - -2.671156302229748e+01, - 3.624490913057226e+02, - 1.435733283603445e-03, - 6.323856206355018e+01, - -3.235298481916873e+01, - -4.600664344122619e-01, - 2.317505125533737e+04, - 1.742902511000877e+04, - 4.197167276661121e-02, - -3.170106971852925e-02, - 2.251454412738915e-02, - -2.893811326613136e-04, - 6.547573944258409e+01, - -4.374152109196792e+01, - 3.538566621516007e+02, - -1.161136124628945e-04, - 6.547573276342189e+01, - -4.924863462531396e+01, - -4.618781518606117e-01, - 2.326461212459939e+04, - 1.091920006656587e+04, - 4.099467927706028e-02, - -1.943342079277382e-02, - 2.312005045088675e-02, - -1.685786023670374e-04, - 6.395211979208625e+01, - -2.444601447761172e+01, - 3.636216915815392e+02, - 1.544773926008948e-03, - 6.395220909058020e+01, - -3.010489846370650e+01, - -4.915644027924785e-01, - 2.348850039242425e+04, - 1.731388447701314e+04, - 4.249502488263058e-02, - -3.148838689004981e-02, - 2.253033268806512e-02, - -2.877149735453275e-04, - 6.629211627157959e+01, - -4.340490140432800e+01, - 3.540302822545799e+02, - 1.694055018156499e-04, - 6.629212655419119e+01, - -4.891402318787917e+01, - -4.865845347735535e-01, - 2.355749297923074e+04, - 1.024123046229217e+04, - 4.137733988847727e-02, - -1.818627990114220e-02, - 2.318772967330223e-02, - -1.566421231267557e-04, - 6.454898391829876e+01, - -2.248203084295367e+01, - 3.646389520186942e+02, - 1.424613160282677e-03, - 6.454906670529206e+01, - -2.815607883302576e+01, - -4.997666382442207e-01, - 2.372228827125380e+04, - 1.695882269550620e+04, - 4.284854748065416e-02, - -3.080919491213940e-02, - 2.256723721963188e-02, - -2.813567603799753e-04, - 6.684369430196503e+01, - -4.233527160179404e+01, - 3.545628776168925e+02, - 5.743234652490330e-04, - 6.684372067320237e+01, - -4.785216352362217e+01, - -4.902608754204331e-01, - 2.376968456711146e+04, - 9.267671818975758e+03, - 4.156361032743425e-02, - -1.641123006228697e-02, - 2.328140968147170e-02, - -1.393879001465629e-04, - 6.483942158123202e+01, - -1.968787871591943e+01, - 3.661001796948924e+02, - 1.281463006001113e-03, - 6.483950271165202e+01, - -2.538417837785955e+01, - -4.916299832993986e-01, - 2.385381863007118e+04, - 1.516079434992884e+04, - 4.273829759884446e-02, - -2.736605740836048e-02, - 2.273601742215342e-02, - -2.475692782514338e-04, - 6.667176504095556e+01, - -3.691955282775560e+01, - 3.572603462412491e+02, - 7.341502270927528e-04, - 6.667181308638112e+01, - -4.247812243806216e+01, - -4.829517300156808e-01, - 2.387039743627662e+04, - 6.166734376088851e+03, - 4.122507535384341e-02, - -1.084093005433709e-02, - 2.357101185138735e-02, - -8.454008034999769e-05, - 6.431126156502609e+01, - -1.092237813592314e+01, - 3.707514102221397e+02, - 1.305250710772067e-03, - 6.431133141968996e+01, - -1.669081536204972e+01, - -2.925958932461452e+00, - 3.058829465985164e+01, - 7.592555059580999e+01, - 9.174568642985248e+00, - 4.372515280978372e+00, - 4.877773621247920e+01, - 5.831272616078080e+01, - 3.133821843080968e+00, - -6.372252454206794e+00, - 4.617149043100642e+01, - 4.192737579030375e+01, - -6.543001624257857e+00, - -1.736511766788342e+01, - 4.186262566258948e+01, - 2.774109082042081e+01, - -1.297083792963494e+01, - -2.752808839970377e+01, - 3.890492103503294e+01, - 1.627555385971739e+01, - -1.652802291463522e+01, - -3.647632685520306e+01, - 3.706472125661017e+01, - 7.383307594459773e+00, - -1.798982341998010e+01, - -4.406999273610545e+01, - 3.695606968026299e+01, - 1.148188729308321e+00, - -1.595060791080081e+01, - -4.917257890148264e+01, - 4.463011626570488e+01, - 8.275175447806753e+01, - -5.731895047171311e+01, - 1.259588384563805e+02, - -9.318277907193300e+01, - 1.108155028170786e+02, - -1.088126544341839e+02, - 9.950843976640869e+01, - -1.191067561893786e+02, - 9.203937356458735e+01, - -1.250595008020826e+02, - 8.807673401161988e+01, - -1.279885134284349e+02, - 8.715970568956295e+01, - -1.289612081234490e+02, - 8.901327899419510e+01, - -1.294841783489734e+02, - 3.114081675495796e+02, - 3.618907311673066e+02, - -7.904605753155529e+00, - 3.655943819467947e+02, - -1.465070823232753e+01, - 3.442788344095122e+02, - -6.151927907004892e+01, - 3.481042282853829e+02, - -7.317353959591048e+01, - 3.294710299236752e+02, - -1.078013045043385e+02, - 3.355074769549145e+02, - -1.177913838978443e+02, - 3.170422026390223e+02, - -1.396090561030924e+02, - 3.251789978591540e+02, - -1.475186312173834e+02, - 3.079851947694905e+02, - -1.589284468440318e+02, - 3.181660549113798e+02, - -1.651506643116976e+02, - 3.029458890853256e+02, - -1.687231323399445e+02, - 3.150031428833777e+02, - -1.736356080586935e+02, - 3.020632590356075e+02, - -1.715847733944154e+02, - 3.158572249521520e+02, - -1.757198561909239e+02, - 3.062813650746419e+02, - -1.707987479996116e+02, - 3.220107136834399e+02, - -1.761933472176073e+02 +const std::vector answer_key_N8 = { + 29266.6517718661, + 9842.93617289812, + 0.0475360674334622, + -0.0160323945316821, + 0.0187557247105805, + -0.000119821248231538, + 79.8612117213119, + -21.0144010498971, + 367.201497494684, + -0.00135963018489767, + 79.8611351716573, + -26.7318789917162, + -0.018074876389402, + 29296.9645459408, + 7415.51099954903, + 0.0471789367393934, + -0.0120180219897291, + 0.0189117902285582, + -8.57914733703415e-05, + 79.2614266664798, + -14.2194852461262, + 370.357116139458, + -0.00065261697325357, + 79.261388452934, + -19.9860446882469, + -0.161178046356866, + 22178.7337755581, + 15750.48869542, + 0.0399575496599213, + -0.028431003000158, + 0.0226540351215628, + -0.000255811047442045, + 62.3338080750298, + -38.6061338491152, + 356.372404460464, + -0.000888421043595241, + 62.3337589017493, + -44.1546192236143, + -0.191206982234175, + 22245.3587939821, + 12476.0312983393, + 0.0395296431152022, + -0.0222832972915751, + 0.0229591349358969, + -0.000195357283522886, + 61.6667253463805, + -28.9363062720176, + 361.284131747149, + 0.000606091049765824, + 61.6667589580497, + -34.5611135316627, + -0.300475535038271, + 22471.354929649, + 17410.9400696732, + 0.0407475331761201, + -0.0316496339533813, + 0.0225047347006168, + -0.000287941144857336, + 63.5662158978541, + -43.6654709736205, + 353.882194971394, + -0.00050508442766251, + 63.5661867600733, + -49.1745383652835, + -0.321406735230742, + 22562.1063953332, + 12532.040739496, + 0.0400730650460856, + -0.0224103188019356, + 0.0229590093469276, + -0.000197040279593967, + 62.5145400797163, + -29.1337602252211, + 361.200953962968, + 0.00123813270414561, + 62.5146115608051, + -34.7565572443792, + -0.398765881347133, + 22822.9625175864, + 17526.9123376124, + 0.0413769691613727, + -0.0318846988884131, + 0.0224996948233429, + -0.000290724959665147, + 64.5480523645119, + -44.0326735095454, + 353.709220392926, + -0.000255137918253834, + 64.548036917491, + -49.5382706457328, + -0.409294621792759, + 22917.4640781459, + 11700.1980576741, + 0.0405370737861658, + -0.0208717910251266, + 0.0230419643488667, + -0.000182321342412399, + 63.2383663569188, + -26.7111380754575, + 362.449323338104, + 0.00143605100750772, + 63.2384503029344, + -32.3525635247183, + -0.460038982115987, + 23175.0870418607, + 17429.0372806116, + 0.0419717095772374, + -0.0317010913432995, + 0.0225145433123769, + -0.000289381352876061, + 65.4757968347883, + -43.7415548084125, + 353.856643943042, + -0.000116590766441278, + 65.4757901489451, + -49.2486679790579, + -0.461848591689221, + 23264.6732405303, + 10919.0360806903, + 0.0409947737541995, + -0.0194331296392293, + 0.0231200668519233, + -0.000168575863901554, + 63.9522672718067, + -24.4455560147541, + 363.621937642842, + 0.00154556746783549, + 63.9523565934322, + -30.1044436917781, + -0.491529580804623, + 23488.6137650364, + 17313.8654584652, + 0.0424952351974662, + -0.0314883547842804, + 0.0225303364455447, + -0.000287714847080755, + 66.2924442955506, + -43.4048501801219, + 354.030311475628, + 0.000169934086992562, + 66.2924545883603, + -48.9139721676174, + -0.486548093474613, + 23557.6136117665, + 10241.0790360359, + 0.0413774884672506, + -0.0181860120867723, + 0.0231877453638413, + -0.000156639599075328, + 64.5492156984859, + -22.4816084883194, + 364.639179755733, + 0.00142420279185394, + 64.5492984953198, + -28.1556597465189, + -0.499726325044563, + 23722.4168131373, + 16958.7765974266, + 0.0428487548646152, + -0.0308090857078185, + 0.0225672437721518, + -0.000281355782039133, + 66.8440182379463, + -42.3350991467661, + 354.562942832682, + 0.000573219240561573, + 66.844044569212, + -47.8519918014414, + -0.490219448053285, + 23769.8747006891, + 9267.5206785042, + 0.0415639300026818, + -0.0164109903099032, + 0.0232814268213158, + -0.000139385907988285, + 64.8399200066663, + -19.6874999818575, + 366.100410278813, + 0.00128332197988872, + 64.8400012051758, + -25.3838027935624, + -0.491586583798841, + 23854.0240861864, + 15160.7060140903, + 0.0427385845553072, + -0.0273659210853948, + 0.0227360281885303, + -0.00024756822257102, + 66.6722121992594, + -36.9193366680176, + 357.260483774461, + 0.000734666517031364, + 66.6722602990682, + -42.4779079553274, + -0.482907936930927, + 23870.5548740189, + 6166.60742794455, + 0.0412253604361869, + -0.0108406830677542, + 0.0235710268609798, + -8.45378382385454e-05, + 64.3117067426907, + -10.9219886629635, + 370.751596332923, + 0.00130490570318174, + 64.3117765573399, + -16.6904284244068, + -2.9267653635869, + 30.5878043390112, + 75.9238910016987, + 9.17392754248112, + 4.3701560041079, + 48.7765765968327, + 58.3101300775815, + 3.13323809951331, + -6.37573932293514, + 46.1701408549949, + 41.9244199648313, + -6.5432868117422, + -17.3691293511209, + 41.8611610718482, + 27.7383173553277, + -12.9709065074016, + -27.5322418670623, + 38.9032728624808, + 16.2733736528389, + -16.5280348065045, + -36.4800564569504, + 37.0627808819117, + 7.38198504755967, + -17.9899033675727, + -44.0731708800056, + 36.9539474625741, + 1.14781892918688, + -15.9507601441003, + -49.1751072411967, + 44.6278268007059, + 82.7517114852138, + -57.3188928805757, + 125.959171148664, + -93.1822145893453, + 110.816672146529, + -108.811406393296, + 99.5107131550674, + -119.104827911048, + 92.0427992280762, + -125.056967118294, + 88.0811872722293, + -127.985464658329, + 87.1649116220972, + -128.957730829954, + 89.0189233593932, + -129.480383815729, + 311.408200092424, + 361.890500304156, + -7.90450151715305, + 365.594288034004, + -14.6504114199963, + 344.278948204657, + -61.517809887448, + 348.104769580715, + -73.1715704285651, + 329.472137794467, + -107.797643650827, + 335.509251816504, + -117.787067889008, + 317.044841017058, + -139.602945170765, + 325.182412285621, + -147.51178633583, + 307.989533967543, + -158.91998673915, + 318.171184823086, + -165.141414351062, + 302.951769665185, + -168.712626964975, + 315.009688292198, + -173.624287308414, + 302.070219389208, + -171.572667424371, + 315.86470341008, + -175.706947618597, + 306.288884765777, + -170.785573848562, + 322.018589824395, + -176.179397251772 }; + + From a62975646a4fa6b85ec296bc0158283808885821 Mon Sep 17 00:00:00 2001 From: Reid Gomillion Date: Wed, 18 Dec 2024 15:17:01 -0500 Subject: [PATCH 4/4] Added Final Copies to other Functionalities --- Solver/Dynamic/Ida.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Solver/Dynamic/Ida.cpp b/Solver/Dynamic/Ida.cpp index c58ae8b..2c7df1d 100644 --- a/Solver/Dynamic/Ida.cpp +++ b/Solver/Dynamic/Ida.cpp @@ -257,6 +257,9 @@ namespace Sundials retval = IDACalcIC(solver_, initType, 0.1); checkOutput(retval, "IDACalcIC"); + + copyVec(yy_, model_->y()); + copyVec(yp_, model_->yp()); } return retval; @@ -268,7 +271,7 @@ namespace Sundials int retval = 0; int iout = 0; real_type tret; - real_type dt = tf/nout; + real_type dt = tf / static_cast(nout); real_type tout = dt; /* In loop, call IDASolve, print results, and test for error. @@ -287,6 +290,7 @@ namespace Sundials } } + //Final copy out. No gaurentee last residual evaluation is final step. model_->updateTime(tf, 0.0); copyVec(yy_, model_->y()); copyVec(yp_, model_->yp()); @@ -359,7 +363,7 @@ namespace Sundials //std::cout << "Forward integration for initial value problem ... \n"; - real_type dt = tf/nout; + real_type dt = tf / static_cast(nout); real_type tout = dt; //printOutput(0.0); //printSpecial(0.0, yy_); @@ -378,6 +382,11 @@ namespace Sundials retval = IDAGetQuad(solver_, &tret, q_); checkOutput(retval, "IDAGetQuad"); } + + //Final copy out. No gaurentee last residual evaluation is final step. + model_->updateTime(tf, 0.0); + copyVec(yy_, model_->y()); + copyVec(yp_, model_->yp()); return retval; } @@ -508,7 +517,7 @@ namespace Sundials //std::cout << "Forward integration for adjoint analysis ... \n"; - real_type dt = tf/nout; + real_type dt = tf / static_cast(nout); real_type tout = dt; for(int i = 0; i < nout; ++i) { @@ -523,6 +532,11 @@ namespace Sundials retval = IDAGetQuad(solver_, &time, q_); checkOutput(retval, "IDASolve"); } + + //Final copy out. No gaurentee last residual evaluation is final step. + model_->updateTime(tf, 0.0); + copyVec(yy_, model_->y()); + copyVec(yp_, model_->yp()); return retval; } @@ -545,6 +559,10 @@ namespace Sundials retval = IDAGetB(solver_, backwardID_, &time, yyB_, ypB_); checkOutput(retval, "IDAGetB"); + //Copy back into model + copyVec(yyB_, model_->yB()); + copyVec(ypB_, model_->ypB()); + retval = IDAGetQuadB(solver_, backwardID_, &time, qB_); checkOutput(retval, "IDAGetQuadB");