Tempus  Version of the Day
Time Integration
Tempus_UnitTest_DIRK_1StageTheta.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #include "Teuchos_UnitTestHarness.hpp"
10 #include "Teuchos_XMLParameterListHelpers.hpp"
11 #include "Teuchos_TimeMonitor.hpp"
12 #include "Teuchos_DefaultComm.hpp"
13 
14 #include "Thyra_VectorStdOps.hpp"
15 
17 
18 #include "../TestModels/SinCosModel.hpp"
19 #include "../TestModels/VanDerPolModel.hpp"
20 #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp"
21 
22 #include <fstream>
23 #include <vector>
24 
25 namespace Tempus_Unit_Test {
26 
27 using Teuchos::RCP;
28 using Teuchos::rcp;
29 using Teuchos::rcp_const_cast;
30 using Teuchos::rcp_dynamic_cast;
31 using Teuchos::ParameterList;
32 using Teuchos::sublist;
33 using Teuchos::getParametersFromXmlFile;
34 
35 
36 // ************************************************************
37 // ************************************************************
38 TEUCHOS_UNIT_TEST(DIRK_1StageTheta, Default_Construction)
39 {
40  auto stepper = rcp(new Tempus::StepperDIRK_1StageTheta<double>());
42 
43  // Test stepper properties.
44  TEUCHOS_ASSERT(stepper->getOrder() == 2);
45  double theta = 0.5;
46  TEUCHOS_ASSERT(stepper->getTheta() == theta);
47  stepper->setTheta(theta); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
48 
49 }
50 
51 
52 // ************************************************************
53 // ************************************************************
54 TEUCHOS_UNIT_TEST(DIRK_1StageTheta, StepperFactory_Construction)
55 {
56  auto model = rcp(new Tempus_Test::SinCosModel<double>());
57  testFactoryConstruction("DIRK 1 Stage Theta Method", model);
58 }
59 
60 
61 // ************************************************************
62 // ************************************************************
63 TEUCHOS_UNIT_TEST(DIRK_1StageTheta, AppAction)
64 {
65  auto stepper = rcp(new Tempus::StepperDIRK_1StageTheta<double>());
66  auto model = rcp(new Tempus_Test::SinCosModel<double>());
67  testRKAppAction(stepper, model, out, success);
68 }
69 
70 
71 } // namespace Tempus_Test
void testRKAppAction(const Teuchos::RCP< Tempus::StepperRKBase< double > > &stepper, const Teuchos::RCP< const Thyra::ModelEvaluator< double > > &model, Teuchos::FancyOStream &out, bool &success)
Unit test utility for Stepper RK AppAction.
void testFactoryConstruction(std::string stepperType, const Teuchos::RCP< const Thyra::ModelEvaluator< double > > &model)
Unit test utility for Stepper construction through StepperFactory.
Sine-Cosine model problem from Rythmos. This is a canonical Sine-Cosine differential equation with a...
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
void testDIRKAccessorsFullConstruction(const RCP< Tempus::StepperDIRK< double > > &stepper)
Unit test utility for ExplicitRK Stepper construction and accessors.