39 Teuchos::FancyOStream &out,
bool &success)
42 RCP<ParameterList> pList =
43 getParametersFromXmlFile(
"Tempus_BackwardEuler_SteadyQuadratic.xml");
46 RCP<ParameterList> scm_pl = sublist(pList,
"SteadyQuadraticModel",
true);
47 scm_pl->set(
"Use DfDp as Tangent", use_dfdp_as_tangent);
48 RCP<SteadyQuadraticModel<double> > model =
52 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
53 ParameterList &sens_pl = pl->sublist(
"Sensitivities");
54 sens_pl.set(
"Use DfDp as Tangent", use_dfdp_as_tangent);
55 sens_pl.set(
"Reuse State Linear Solver",
true);
56 sens_pl.set(
"Force W Update",
true);
60 RCP<Tempus::IntegratorPseudoTransientForwardSensitivity<double> > integrator =
61 Tempus::createIntegratorPseudoTransientForwardSensitivity<double>(pl,
65 bool integratorStatus = integrator->advanceTime();
66 TEST_ASSERT(integratorStatus);
69 double time = integrator->getTime();
70 double timeFinal = pl->sublist(
"Default Integrator")
71 .sublist(
"Time Step Control")
72 .get<
double>(
"Final Time");
73 TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
76 RCP<const Thyra::VectorBase<double> > x_vec = integrator->getX();
77 RCP<const Thyra::MultiVectorBase<double> > DxDp_vec = integrator->getDxDp();
78 const double x = Thyra::get_ele(*x_vec, 0);
79 const double dxdb = Thyra::get_ele(*(DxDp_vec->col(0)), 0);
80 const double x_exact = model->getSteadyStateSolution();
81 const double dxdb_exact = model->getSteadyStateSolutionSensitivity();
83 TEST_FLOATING_EQUALITY(x, x_exact, 1.0e-6);
84 TEST_FLOATING_EQUALITY(dxdb, dxdb_exact, 1.0e-6);
102 RCP<ParameterList> pList =
103 getParametersFromXmlFile(
"Tempus_BackwardEuler_SteadyQuadratic.xml");
106 RCP<ParameterList> scm_pl = sublist(pList,
"SteadyQuadraticModel",
true);
107 RCP<SteadyQuadraticModel<double> > model =
111 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
115 RCP<Tempus::IntegratorPseudoTransientAdjointSensitivity<double> > integrator =
116 Tempus::integratorPseudoTransientAdjointSensitivity<double>(pl, model);
119 bool integratorStatus = integrator->advanceTime();
120 TEST_ASSERT(integratorStatus);
123 double time = integrator->getTime();
124 double timeFinal = pl->sublist(
"Default Integrator")
125 .sublist(
"Time Step Control")
126 .get<
double>(
"Final Time");
127 TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
130 RCP<const Thyra::VectorBase<double> > x_vec = integrator->getX();
131 RCP<const Thyra::MultiVectorBase<double> > DxDp_vec = integrator->getDgDp();
132 const double x = Thyra::get_ele(*x_vec, 0);
133 const double dxdb = Thyra::get_ele(*(DxDp_vec->col(0)), 0);
134 const double x_exact = model->getSteadyStateSolution();
135 const double dxdb_exact = model->getSteadyStateSolutionSensitivity();
137 TEST_FLOATING_EQUALITY(x, x_exact, 1.0e-6);
138 TEST_FLOATING_EQUALITY(dxdb, dxdb_exact, 1.0e-6);