Tempus  Version of the Day
Time Integration
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 
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(SDIRK_2Stage3rdOrder, Default_Construction)
39 {
40  auto stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder<double>());
42 
43  // Test stepper properties.
44  TEUCHOS_ASSERT(stepper->getOrder() == 3);
45  std::string gammaType = "3rd Order A-stable";
46  TEUCHOS_ASSERT(stepper->getGammaType() == gammaType);
47  double gamma = 0.7886751345948128;
48  TEUCHOS_ASSERT(stepper->getGamma() == gamma);
49  stepper->setGammaType(gammaType); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
50  stepper->setGamma(gamma); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
51 
52 }
53 
54 
55 // ************************************************************
56 // ************************************************************
57 TEUCHOS_UNIT_TEST(SDIRK_2Stage3rdOrder, StepperFactory_Construction)
58 {
59  auto model = rcp(new Tempus_Test::SinCosModel<double>());
60  testFactoryConstruction("SDIRK 2 Stage 3rd order", model);
61 }
62 
63 
64 // ************************************************************
65 // ************************************************************
66 TEUCHOS_UNIT_TEST(SDIRK_2Stage3rdOrder, AppAction)
67 {
68  auto stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder<double>());
69  auto model = rcp(new Tempus_Test::SinCosModel<double>());
70  testRKAppAction(stepper, model, out, success);
71 }
72 
73 
74 } // 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.