Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_UnitTest_SDIRK_2Stage3rdOrder.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 
18 
19 #include "../TestModels/SinCosModel.hpp"
20 #include "../TestModels/VanDerPolModel.hpp"
21 #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp"
22 
23 #include <fstream>
24 #include <vector>
25 
26 namespace Tempus_Unit_Test {
27 
28 using Teuchos::RCP;
29 using Teuchos::rcp;
30 using Teuchos::rcp_const_cast;
31 using Teuchos::rcp_dynamic_cast;
32 using Teuchos::ParameterList;
33 using Teuchos::sublist;
34 using Teuchos::getParametersFromXmlFile;
35 
37 
38 
39 // ************************************************************
40 // ************************************************************
41 TEUCHOS_UNIT_TEST(SDIRK_2Stage3rdOrder, Default_Construction)
42 {
43  auto stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder<double>());
45 
46  // Test stepper properties.
47  TEUCHOS_ASSERT(stepper->getOrder() == 3);
48  std::string gammaType = "3rd Order A-stable";
49  TEUCHOS_ASSERT(stepper->getGammaType() == gammaType);
50  double gamma = 0.7886751345948128;
51  TEUCHOS_ASSERT(stepper->getGamma() == gamma);
52  stepper->setGammaType(gammaType); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
53  stepper->setGamma(gamma); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
54 
55 }
56 
57 
58 // ************************************************************
59 // ************************************************************
60 TEUCHOS_UNIT_TEST(SDIRK_2Stage3rdOrder, StepperFactory_Construction)
61 {
62  auto model = rcp(new Tempus_Test::SinCosModel<double>());
63  testFactoryConstruction("SDIRK 2 Stage 3rd order", model);
64 }
65 
66 
67 // ************************************************************
68 // ************************************************************
69 TEUCHOS_UNIT_TEST(SDIRK_2Stage3rdOrder, AppAction)
70 {
71  auto stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder<double>());
72  auto model = rcp(new Tempus_Test::SinCosModel<double>());
73  testRKAppAction(stepper, model, out, success);
74 }
75 
76 
77 } // 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.