49 Teuchos::FancyOStream &out,
bool &success,
50 const bool use_row_sum_scaling =
false)
53 RCP<ParameterList> pList =
54 getParametersFromXmlFile(
"Tempus_BackwardEuler_SteadyQuadratic.xml");
57 RCP<ParameterList> scm_pl = sublist(pList,
"SteadyQuadraticModel",
true);
58 scm_pl->set(
"Use DfDp as Tangent", use_dfdp_as_tangent);
59 RCP<SteadyQuadraticModel<double> > model =
63 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
64 ParameterList &sens_pl = pl->sublist(
"Sensitivities");
65 sens_pl.set(
"Use DfDp as Tangent", use_dfdp_as_tangent);
67 sens_pl.set(
"Reuse State Linear Solver", !use_row_sum_scaling);
68 sens_pl.set(
"Force W Update",
true);
73 RCP<Tempus::IntegratorPseudoTransientForwardSensitivity<double> > integrator =
78 bool integratorStatus = integrator->advanceTime();
79 TEST_ASSERT(integratorStatus);
82 double time = integrator->getTime();
83 double timeFinal = pl->sublist(
"Default Integrator")
84 .sublist(
"Time Step Control")
85 .get<
double>(
"Final Time");
86 TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
89 RCP<const Thyra::VectorBase<double> > x_vec = integrator->getX();
90 RCP<const Thyra::MultiVectorBase<double> > DxDp_vec = integrator->getDxDp();
91 const double x = Thyra::get_ele(*x_vec, 0);
92 const double dxdb = Thyra::get_ele(*(DxDp_vec->col(0)), 0);
93 const double x_exact = model->getSteadyStateSolution();
94 const double dxdb_exact = model->getSteadyStateSolutionSensitivity();
96 TEST_FLOATING_EQUALITY(x, x_exact, 1.0e-6);
97 TEST_FLOATING_EQUALITY(dxdb, dxdb_exact, 1.0e-6);
122 const bool use_row_sum_scaling =
false)
125 RCP<ParameterList> pList =
126 getParametersFromXmlFile(
"Tempus_BackwardEuler_SteadyQuadratic.xml");
129 RCP<ParameterList> scm_pl = sublist(pList,
"SteadyQuadraticModel",
true);
130 RCP<SteadyQuadraticModel<double> > model =
134 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
141 RCP<Tempus::IntegratorPseudoTransientAdjointSensitivity<double> > integrator =
149 bool integratorStatus = integrator->advanceTime();
150 TEST_ASSERT(integratorStatus);
153 double time = integrator->getTime();
154 double timeFinal = pl->sublist(
"Default Integrator")
155 .sublist(
"Time Step Control")
156 .get<
double>(
"Final Time");
157 TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
160 RCP<const Thyra::VectorBase<double> > x_vec = integrator->getX();
161 RCP<const Thyra::MultiVectorBase<double> > DxDp_vec = integrator->getDgDp();
162 const double x = Thyra::get_ele(*x_vec, 0);
163 const double dxdb = Thyra::get_ele(*(DxDp_vec->col(0)), 0);
164 const double x_exact = model->getSteadyStateSolution();
165 const double dxdb_exact = model->getSteadyStateSolutionSensitivity();
167 TEST_FLOATING_EQUALITY(x, x_exact, 1.0e-6);
168 TEST_FLOATING_EQUALITY(dxdb, dxdb_exact, 1.0e-6);