9 #include "Teuchos_UnitTestHarness.hpp"
10 #include "Teuchos_XMLParameterListHelpers.hpp"
11 #include "Teuchos_TimeMonitor.hpp"
12 #include "Teuchos_DefaultComm.hpp"
14 #include "Thyra_VectorStdOps.hpp"
16 #include "Tempus_TimeStepControl.hpp"
18 #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp"
23 namespace Tempus_Unit_Test {
27 using Teuchos::rcp_const_cast;
28 using Teuchos::rcp_dynamic_cast;
29 using Teuchos::ParameterList;
30 using Teuchos::sublist;
31 using Teuchos::getParametersFromXmlFile;
43 std::vector<double> times_in;
45 times_in.push_back(0.0000000000000000e-11);
46 times_in.push_back(0.1001384570000000e-11);
47 times_in.push_back(0.2002769140000000e-11);
48 times_in.push_back(0.3004153710000000e-11);
49 times_in.push_back(0.4005538280000000e-11);
50 times_in.push_back(0.5006922850000000e-11);
51 times_in.push_back(0.6008307420000000e-11);
52 times_in.push_back(0.7009691990000000e-11);
53 times_in.push_back(0.8011076560000000e-11);
54 times_in.push_back(0.9012461130000000e-11);
55 times_in.push_back(1.0013845700000000e-11);
57 tsc->setOutputTimes(times_in);
59 auto times_out = tsc->getOutputTimes();
63 for (
size_t i=0; i < times_in.size(); ++i) {
67 maxDiff = std::max(std::abs(times_in[i] - times_out[i]), maxDiff);
71 TEST_COMPARE(maxDiff, <, 1.0e-25);
76 times_in.push_back(0.00000000000000000000000000000000);
77 times_in.push_back(0.00000000000100138457000000009381);
78 times_in.push_back(0.00000000000200276914000000018762);
79 times_in.push_back(0.00000000000300415371000000007949);
80 times_in.push_back(0.00000000000400553828000000037525);
81 times_in.push_back(0.00000000000500692284999999986321);
82 times_in.push_back(0.00000000000600830742000000015898);
83 times_in.push_back(0.00000000000700969198999999964694);
84 times_in.push_back(0.00000000000801107656000000075050);
85 times_in.push_back(0.00000000000901246112999999943067);
86 times_in.push_back(0.00000000001001384569999999972643);
88 tsc->setOutputTimes(times_in);
90 times_out = tsc->getOutputTimes();
94 for (
size_t i=0; i < times_in.size(); ++i) {
98 maxDiff = std::max(std::abs(times_in[i] - times_out[i]), maxDiff);
102 TEST_COMPARE(maxDiff, <, 1.0e-25);
113 int setOutputTimeIndex = 17;
114 double setOutputTimeInterval = 1.101001000100001e-7;
116 tsc->setOutputIndexInterval(setOutputTimeIndex);
117 tsc->setOutputTimeInterval(setOutputTimeInterval);
119 int getOutputTimeIndex = tsc->getOutputIndexInterval();
120 double getOutputTimeInterval = tsc->getOutputTimeInterval();
121 TEST_COMPARE(getOutputTimeInterval, ==, setOutputTimeInterval);
122 TEST_COMPARE(getOutputTimeIndex, ==, setOutputTimeIndex);
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
TimeStepControl manages the time step size. There several mechanicisms that effect the time step size...