9 #include "Teuchos_UnitTestHarness.hpp"
10 #include "Teuchos_XMLParameterListHelpers.hpp"
11 #include "Teuchos_TimeMonitor.hpp"
12 #include "Teuchos_DefaultComm.hpp"
14 #include "Tempus_config.hpp"
15 #include "Tempus_IntegratorBasic.hpp"
16 #include "Tempus_StepperBackwardEuler.hpp"
18 #include "../TestModels/SinCosModel.hpp"
19 #include "../TestModels/CDR_Model.hpp"
20 #include "../TestModels/VanDerPolModel.hpp"
21 #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp"
23 #include "Stratimikos_DefaultLinearSolverBuilder.hpp"
24 #include "Thyra_LinearOpWithSolveFactoryHelpers.hpp"
26 #ifdef Tempus_ENABLE_MPI
27 #include "Epetra_MpiComm.h"
29 #include "Epetra_SerialComm.h"
40 using Teuchos::ParameterList;
41 using Teuchos::sublist;
42 using Teuchos::getParametersFromXmlFile;
49 #define TEST_PARAMETERLIST
50 #define TEST_CONSTRUCTING_FROM_DEFAULTS
53 #define TEST_VANDERPOL
54 #define TEST_OPT_INTERFACE
57 #ifdef TEST_PARAMETERLIST
63 RCP<ParameterList> pList =
64 getParametersFromXmlFile(
"Tempus_BackwardEuler_SinCos.xml");
67 RCP<ParameterList> scm_pl = sublist(pList,
"SinCosModel",
true);
68 RCP<SinCosModel<double> > model =
71 RCP<ParameterList> tempusPL = sublist(pList,
"Tempus",
true);
75 RCP<Tempus::IntegratorBasic<double> > integrator =
76 Tempus::integratorBasic<double>(tempusPL, model);
78 RCP<ParameterList> stepperPL = sublist(tempusPL,
"Default Stepper",
true);
80 stepperPL->remove(
"Predictor Name");
81 stepperPL->remove(
"Default Predictor");
82 RCP<ParameterList> defaultPL =
83 integrator->getStepper()->getDefaultParameters();
84 TEST_ASSERT(haveSameValues(*stepperPL, *defaultPL,
true))
89 RCP<Tempus::IntegratorBasic<double> > integrator =
90 Tempus::integratorBasic<double>(model,
"Backward Euler");
92 RCP<ParameterList> stepperPL = sublist(tempusPL,
"Default Stepper",
true);
93 RCP<ParameterList> defaultPL =
94 integrator->getStepper()->getDefaultParameters();
96 TEST_ASSERT(haveSameValues(*stepperPL, *defaultPL,
true))
99 #endif // TEST_PARAMETERLIST
102 #ifdef TEST_CONSTRUCTING_FROM_DEFAULTS
110 RCP<ParameterList> pList =
111 getParametersFromXmlFile(
"Tempus_BackwardEuler_SinCos.xml");
112 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
115 RCP<ParameterList> scm_pl = sublist(pList,
"SinCosModel",
true);
117 RCP<SinCosModel<double> > model =
121 RCP<Tempus::StepperBackwardEuler<double> > stepper =
133 RCP<Tempus::TimeStepControl<double> > timeStepControl =
135 ParameterList tscPL = pl->sublist(
"Default Integrator")
136 .sublist(
"Time Step Control");
137 timeStepControl->setStepType (tscPL.get<std::string>(
"Integrator Step Type"));
138 timeStepControl->setInitIndex(tscPL.get<
int> (
"Initial Time Index"));
139 timeStepControl->setInitTime (tscPL.get<
double>(
"Initial Time"));
140 timeStepControl->setFinalTime(tscPL.get<
double>(
"Final Time"));
141 timeStepControl->setInitTimeStep(dt);
142 timeStepControl->initialize();
145 Thyra::ModelEvaluatorBase::InArgs<double> inArgsIC =
146 stepper->getModel()->getNominalValues();
147 RCP<Thyra::VectorBase<double> > icSolution =
148 Teuchos::rcp_const_cast<Thyra::VectorBase<double> > (inArgsIC.get_x());
149 RCP<Tempus::SolutionState<double> > icState =
151 icState->setTime (timeStepControl->getInitTime());
152 icState->setIndex (timeStepControl->getInitIndex());
153 icState->setTimeStep(0.0);
154 icState->setOrder (stepper->getOrder());
166 RCP<Tempus::IntegratorBasic<double> > integrator =
167 Tempus::integratorBasic<double>();
168 integrator->setStepperWStepper(stepper);
169 integrator->setTimeStepControl(timeStepControl);
172 integrator->initialize();
176 bool integratorStatus = integrator->advanceTime();
177 TEST_ASSERT(integratorStatus)
181 double time = integrator->getTime();
182 double timeFinal =pl->sublist(
"Default Integrator")
183 .sublist(
"Time Step Control").get<
double>(
"Final Time");
184 TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
187 RCP<Thyra::VectorBase<double> > x = integrator->getX();
188 RCP<const Thyra::VectorBase<double> > x_exact =
189 model->getExactSolution(time).get_x();
192 RCP<Thyra::VectorBase<double> > xdiff = x->clone_v();
193 Thyra::V_StVpStV(xdiff.ptr(), 1.0, *x_exact, -1.0, *(x));
196 std::cout <<
" Stepper = BackwardEuler" << std::endl;
197 std::cout <<
" =========================" << std::endl;
198 std::cout <<
" Exact solution : " << get_ele(*(x_exact), 0) <<
" "
199 << get_ele(*(x_exact), 1) << std::endl;
200 std::cout <<
" Computed solution: " << get_ele(*(x ), 0) <<
" "
201 << get_ele(*(x ), 1) << std::endl;
202 std::cout <<
" Difference : " << get_ele(*(xdiff ), 0) <<
" "
203 << get_ele(*(xdiff ), 1) << std::endl;
204 std::cout <<
" =========================" << std::endl;
205 TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.798923, 1.0e-4 );
206 TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.516729, 1.0e-4 );
208 #endif // TEST_CONSTRUCTING_FROM_DEFAULTS
216 RCP<Tempus::IntegratorBasic<double> > integrator;
217 std::vector<RCP<Thyra::VectorBase<double>>> solutions;
218 std::vector<RCP<Thyra::VectorBase<double>>> solutionsDot;
219 std::vector<double> StepSize;
220 std::vector<double> xErrorNorm;
221 std::vector<double> xDotErrorNorm;
222 const int nTimeStepSizes = 7;
225 for (
int n=0; n<nTimeStepSizes; n++) {
228 RCP<ParameterList> pList =
229 getParametersFromXmlFile(
"Tempus_BackwardEuler_SinCos.xml");
236 RCP<ParameterList> scm_pl = sublist(pList,
"SinCosModel",
true);
238 RCP<SinCosModel<double> > model =
244 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
245 pl->sublist(
"Default Integrator")
246 .sublist(
"Time Step Control").set(
"Initial Time Step", dt);
247 integrator = Tempus::integratorBasic<double>(pl, model);
253 RCP<Thyra::VectorBase<double> > x0 =
254 model->getNominalValues().get_x()->clone_v();
255 integrator->setInitialState(0.0, x0);
258 bool integratorStatus = integrator->advanceTime();
259 TEST_ASSERT(integratorStatus)
262 time = integrator->getTime();
263 double timeFinal =pl->sublist(
"Default Integrator")
264 .sublist(
"Time Step Control").get<
double>(
"Final Time");
265 TEST_FLOATING_EQUALITY(time, timeFinal, 1.0e-14);
270 integrator->getSolutionHistory();
273 RCP<Tempus::SolutionHistory<double> > solnHistExact =
276 double time = (*solutionHistory)[i]->getTime();
277 RCP<Tempus::SolutionState<double> > state =
279 model->getExactSolution(time).get_x(),
280 model->getExactSolution(time).get_x_dot()));
282 solnHistExact->addState(state);
284 writeSolution(
"Tempus_BackwardEuler_SinCos-Ref.dat", solnHistExact);
288 StepSize.push_back(dt);
289 auto solution = Thyra::createMember(model->get_x_space());
290 Thyra::copy(*(integrator->getX()),solution.ptr());
291 solutions.push_back(solution);
292 auto solutionDot = Thyra::createMember(model->get_x_space());
293 Thyra::copy(*(integrator->getXdot()),solutionDot.ptr());
294 solutionsDot.push_back(solutionDot);
295 if (n == nTimeStepSizes-1) {
296 StepSize.push_back(0.0);
297 auto solution = Thyra::createMember(model->get_x_space());
298 Thyra::copy(*(model->getExactSolution(time).get_x()),solution.ptr());
299 solutions.push_back(solution);
300 auto solutionDot = Thyra::createMember(model->get_x_space());
301 Thyra::copy(*(model->getExactSolution(time).get_x_dot()),
303 solutionsDot.push_back(solutionDot);
309 double xDotSlope = 0.0;
310 RCP<Tempus::Stepper<double> > stepper = integrator->getStepper();
311 double order = stepper->getOrder();
314 solutions, xErrorNorm, xSlope,
315 solutionsDot, xDotErrorNorm, xDotSlope);
317 TEST_FLOATING_EQUALITY( xSlope, order, 0.01 );
318 TEST_FLOATING_EQUALITY( xErrorNorm[0], 0.0486418, 1.0e-4 );
319 TEST_FLOATING_EQUALITY( xDotSlope, order, 0.01 );
320 TEST_FLOATING_EQUALITY( xDotErrorNorm[0], 0.0486418, 1.0e-4 );
322 Teuchos::TimeMonitor::summarize();
324 #endif // TEST_SINCOS
333 RCP<Epetra_Comm> comm;
334 #ifdef Tempus_ENABLE_MPI
335 comm = Teuchos::rcp(
new Epetra_MpiComm(MPI_COMM_WORLD));
337 comm = Teuchos::rcp(
new Epetra_SerialComm);
340 RCP<Tempus::IntegratorBasic<double> > integrator;
341 std::vector<RCP<Thyra::VectorBase<double>>> solutions;
342 std::vector<RCP<Thyra::VectorBase<double>>> solutionsDot;
343 std::vector<double> StepSize;
344 std::vector<double> xErrorNorm;
345 std::vector<double> xDotErrorNorm;
346 const int nTimeStepSizes = 5;
348 for (
int n=0; n<nTimeStepSizes; n++) {
351 RCP<ParameterList> pList =
352 getParametersFromXmlFile(
"Tempus_BackwardEuler_CDR.xml");
355 RCP<ParameterList> model_pl = sublist(pList,
"CDR Model",
true);
356 const int num_elements = model_pl->get<
int>(
"num elements");
357 const double left_end = model_pl->get<
double>(
"left end");
358 const double right_end = model_pl->get<
double>(
"right end");
359 const double a_convection = model_pl->get<
double>(
"a (convection)");
360 const double k_source = model_pl->get<
double>(
"k (source)");
362 RCP<Tempus_Test::CDR_Model<double>> model =
371 ::Stratimikos::DefaultLinearSolverBuilder builder;
373 Teuchos::RCP<Teuchos::ParameterList> p =
374 Teuchos::rcp(
new Teuchos::ParameterList);
375 p->set(
"Linear Solver Type",
"Belos");
376 p->set(
"Preconditioner Type",
"None");
377 builder.setParameterList(p);
379 Teuchos::RCP< ::Thyra::LinearOpWithSolveFactoryBase<double> >
380 lowsFactory = builder.createLinearSolveStrategy(
"");
382 model->set_W_factory(lowsFactory);
388 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
389 pl->sublist(
"Demo Integrator")
390 .sublist(
"Time Step Control").set(
"Initial Time Step", dt);
391 integrator = Tempus::integratorBasic<double>(pl, model);
394 bool integratorStatus = integrator->advanceTime();
395 TEST_ASSERT(integratorStatus)
398 double time = integrator->getTime();
399 double timeFinal =pl->sublist(
"Demo Integrator")
400 .sublist(
"Time Step Control").get<
double>(
"Final Time");
401 double tol = 100.0 * std::numeric_limits<double>::epsilon();
402 TEST_FLOATING_EQUALITY(time, timeFinal, tol);
405 StepSize.push_back(dt);
406 auto solution = Thyra::createMember(model->get_x_space());
407 Thyra::copy(*(integrator->getX()),solution.ptr());
408 solutions.push_back(solution);
409 auto solutionDot = Thyra::createMember(model->get_x_space());
410 Thyra::copy(*(integrator->getXdot()),solutionDot.ptr());
411 solutionsDot.push_back(solutionDot);
415 if ((n == nTimeStepSizes-1) && (comm->NumProc() == 1)) {
416 std::ofstream ftmp(
"Tempus_BackwardEuler_CDR.dat");
417 ftmp <<
"TITLE=\"Backward Euler Solution to CDR\"\n"
418 <<
"VARIABLES=\"z\",\"T\"\n";
419 const double dx = std::fabs(left_end-right_end) /
420 static_cast<double>(num_elements);
422 integrator->getSolutionHistory();
424 for (
int i=0; i<nStates; i++) {
425 RCP<const SolutionState<double> > solutionState = (*solutionHistory)[i];
426 RCP<const Thyra::VectorBase<double> > x = solutionState->getX();
427 double ttime = solutionState->getTime();
428 ftmp <<
"ZONE T=\"Time="<<ttime<<
"\", I="
429 <<num_elements+1<<
", F=BLOCK\n";
430 for (
int j = 0; j < num_elements+1; j++) {
431 const double x_coord = left_end + static_cast<double>(j) * dx;
432 ftmp << x_coord <<
" ";
435 for (
int j=0; j<num_elements+1; j++) ftmp << get_ele(*x, j) <<
" ";
444 double xDotSlope = 0.0;
445 RCP<Tempus::Stepper<double> > stepper = integrator->getStepper();
448 solutions, xErrorNorm, xSlope,
449 solutionsDot, xDotErrorNorm, xDotSlope);
451 TEST_FLOATING_EQUALITY( xSlope, 1.32213, 0.01 );
452 TEST_FLOATING_EQUALITY( xErrorNorm[0], 0.116919, 1.0e-4 );
453 TEST_FLOATING_EQUALITY( xDotSlope, 1.32052, 0.01 );
454 TEST_FLOATING_EQUALITY( xDotErrorNorm[0], 0.449888, 1.0e-4 );
462 if (comm->NumProc() == 1) {
463 RCP<ParameterList> pList =
464 getParametersFromXmlFile(
"Tempus_BackwardEuler_CDR.xml");
465 RCP<ParameterList> model_pl = sublist(pList,
"CDR Model",
true);
466 const int num_elements = model_pl->get<
int>(
"num elements");
467 const double left_end = model_pl->get<
double>(
"left end");
468 const double right_end = model_pl->get<
double>(
"right end");
470 const Thyra::VectorBase<double>& x = *(solutions[solutions.size()-1]);
472 std::ofstream ftmp(
"Tempus_BackwardEuler_CDR-Solution.dat");
473 for (
int n = 0; n < num_elements+1; n++) {
474 const double dx = std::fabs(left_end-right_end) /
475 static_cast<double>(num_elements);
476 const double x_coord = left_end + static_cast<double>(n) * dx;
477 ftmp << x_coord <<
" " << Thyra::get_ele(x,n) << std::endl;
482 Teuchos::TimeMonitor::summarize();
487 #ifdef TEST_VANDERPOL
492 RCP<Tempus::IntegratorBasic<double> > integrator;
493 std::vector<RCP<Thyra::VectorBase<double>>> solutions;
494 std::vector<RCP<Thyra::VectorBase<double>>> solutionsDot;
495 std::vector<double> StepSize;
496 std::vector<double> xErrorNorm;
497 std::vector<double> xDotErrorNorm;
498 const int nTimeStepSizes = 4;
500 for (
int n=0; n<nTimeStepSizes; n++) {
503 RCP<ParameterList> pList =
504 getParametersFromXmlFile(
"Tempus_BackwardEuler_VanDerPol.xml");
507 RCP<ParameterList> vdpm_pl = sublist(pList,
"VanDerPolModel",
true);
508 RCP<VanDerPolModel<double> > model =
513 if (n == nTimeStepSizes-1) dt /= 10.0;
516 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
517 pl->sublist(
"Demo Integrator")
518 .sublist(
"Time Step Control").set(
"Initial Time Step", dt);
519 integrator = Tempus::integratorBasic<double>(pl, model);
522 bool integratorStatus = integrator->advanceTime();
523 TEST_ASSERT(integratorStatus)
526 double time = integrator->getTime();
527 double timeFinal =pl->sublist(
"Demo Integrator")
528 .sublist(
"Time Step Control").get<
double>(
"Final Time");
529 double tol = 100.0 * std::numeric_limits<double>::epsilon();
530 TEST_FLOATING_EQUALITY(time, timeFinal, tol);
533 StepSize.push_back(dt);
534 auto solution = Thyra::createMember(model->get_x_space());
535 Thyra::copy(*(integrator->getX()),solution.ptr());
536 solutions.push_back(solution);
537 auto solutionDot = Thyra::createMember(model->get_x_space());
538 Thyra::copy(*(integrator->getXdot()),solutionDot.ptr());
539 solutionsDot.push_back(solutionDot);
543 if ((n == 0) or (n == nTimeStepSizes-1)) {
544 std::string fname =
"Tempus_BackwardEuler_VanDerPol-Ref.dat";
545 if (n == 0) fname =
"Tempus_BackwardEuler_VanDerPol.dat";
547 integrator->getSolutionHistory();
554 double xDotSlope = 0.0;
555 RCP<Tempus::Stepper<double> > stepper = integrator->getStepper();
556 double order = stepper->getOrder();
559 solutions, xErrorNorm, xSlope,
560 solutionsDot, xDotErrorNorm, xDotSlope);
562 TEST_FLOATING_EQUALITY( xSlope, order, 0.10 );
563 TEST_FLOATING_EQUALITY( xErrorNorm[0], 0.571031, 1.0e-4 );
564 TEST_FLOATING_EQUALITY( xDotSlope, 1.74898, 0.10 );
565 TEST_FLOATING_EQUALITY( xDotErrorNorm[0], 1.0038, 1.0e-4 );
569 Teuchos::TimeMonitor::summarize();
571 #endif // TEST_VANDERPOL
573 #ifdef TEST_OPT_INTERFACE
579 RCP<ParameterList> pList =
580 getParametersFromXmlFile(
"Tempus_BackwardEuler_SinCos.xml");
583 RCP<ParameterList> scm_pl = sublist(pList,
"SinCosModel",
true);
584 RCP<SinCosModel<double> > model =
588 RCP<ParameterList> pl = sublist(pList,
"Tempus",
true);
589 RCP<Tempus::IntegratorBasic<double> >integrator =
590 Tempus::integratorBasic<double>(pl, model);
593 bool integratorStatus = integrator->advanceTime();
594 TEST_ASSERT(integratorStatus);
598 integrator->getSolutionHistory();
601 RCP<Tempus::Stepper<double> > stepper = integrator->getStepper();
602 RCP<Tempus::StepperOptimizationInterface<double> > opt_stepper =
607 TEST_EQUALITY( opt_stepper->stencilLength(), 2);
610 Teuchos::Array< RCP<const Thyra::VectorBase<double> > > x(2);
611 Teuchos::Array<double> t(2);
612 RCP< const Thyra::VectorBase<double> > p =
613 model->getNominalValues().get_p(0);
614 RCP< Thyra::VectorBase<double> > x_dot =
615 Thyra::createMember(model->get_x_space());
616 RCP< Thyra::VectorBase<double> > f =
617 Thyra::createMember(model->get_f_space());
618 RCP< Thyra::VectorBase<double> > f2 =
619 Thyra::createMember(model->get_f_space());
620 RCP< Thyra::LinearOpBase<double> > dfdx =
621 model->create_W_op();
622 RCP< Thyra::LinearOpBase<double> > dfdx2 =
623 model->create_W_op();
624 RCP< Thyra::MultiVectorBase<double> > dfdx_mv =
625 Teuchos::rcp_dynamic_cast< Thyra::MultiVectorBase<double> >(dfdx,
true);
626 RCP< Thyra::MultiVectorBase<double> > dfdx_mv2 =
627 Teuchos::rcp_dynamic_cast< Thyra::MultiVectorBase<double> >(dfdx2,
true);
628 const int num_p = p->range()->dim();
629 RCP< Thyra::MultiVectorBase<double> > dfdp =
630 Thyra::createMembers(model->get_f_space(), num_p);
631 RCP< Thyra::MultiVectorBase<double> > dfdp2 =
632 Thyra::createMembers(model->get_f_space(), num_p);
633 RCP< Thyra::LinearOpWithSolveBase<double> > W =
635 RCP< Thyra::LinearOpWithSolveBase<double> > W2 =
637 RCP< Thyra::MultiVectorBase<double> > tmp =
638 Thyra::createMembers(model->get_x_space(), num_p);
639 RCP< Thyra::MultiVectorBase<double> > tmp2 =
640 Thyra::createMembers(model->get_x_space(), num_p);
641 std::vector<double> nrms(num_p);
646 for (
int i=1; i<n; ++i) {
647 RCP<const SolutionState<double> > state = (*solutionHistory)[i];
648 RCP<const SolutionState<double> > prev_state = (*solutionHistory)[i-1];
651 x[0] = state->getX();
652 x[1] = prev_state->getX();
653 t[0] = state->getTime();
654 t[1] = prev_state->getTime();
657 const double dt = t[0]-t[1];
658 Thyra::V_StVpStV(x_dot.ptr(), 1.0/dt, *(x[0]), -1.0/dt, *(x[1]));
661 typedef Thyra::ModelEvaluatorBase MEB;
662 MEB::InArgs<double> in_args = model->createInArgs();
663 MEB::OutArgs<double> out_args = model->createOutArgs();
665 in_args.set_x_dot(x_dot);
669 const double tol = 1.0e-14;
672 opt_stepper->computeStepResidual(*f, x, t, *p, 0);
674 model->evalModel(in_args, out_args);
675 out_args.set_f(Teuchos::null);
676 Thyra::V_VmV(f.ptr(), *f, *f2);
677 err = Thyra::norm(*f);
678 TEST_FLOATING_EQUALITY(err, 0.0, tol);
682 opt_stepper->computeStepJacobian(*dfdx, x, t, *p, 0, 0);
683 out_args.set_W_op(dfdx2);
684 in_args.set_alpha(1.0/dt);
685 in_args.set_beta(1.0);
686 model->evalModel(in_args, out_args);
687 out_args.set_W_op(Teuchos::null);
688 Thyra::V_VmV(dfdx_mv.ptr(), *dfdx_mv, *dfdx_mv2);
689 Thyra::norms(*dfdx_mv, Teuchos::arrayViewFromVector(nrms));
691 for (
auto nrm : nrms) err += nrm;
692 TEST_FLOATING_EQUALITY(err, 0.0, tol);
696 opt_stepper->computeStepJacobian(*dfdx, x, t, *p, 0, 1);
697 out_args.set_W_op(dfdx2);
698 in_args.set_alpha(-1.0/dt);
699 in_args.set_beta(0.0);
700 model->evalModel(in_args, out_args);
701 out_args.set_W_op(Teuchos::null);
702 Thyra::V_VmV(dfdx_mv.ptr(), *dfdx_mv, *dfdx_mv2);
703 Thyra::norms(*dfdx_mv, Teuchos::arrayViewFromVector(nrms));
705 for (
auto nrm : nrms) err += nrm;
706 TEST_FLOATING_EQUALITY(err, 0.0, tol);
709 opt_stepper->computeStepParamDeriv(*dfdp, x, t, *p, 0);
711 0, MEB::Derivative<double>(dfdp2, MEB::DERIV_MV_JACOBIAN_FORM));
712 model->evalModel(in_args, out_args);
713 out_args.set_DfDp(0, MEB::Derivative<double>());
714 Thyra::V_VmV(dfdp.ptr(), *dfdp, *dfdp2);
715 Thyra::norms(*dfdp, Teuchos::arrayViewFromVector(nrms));
717 for (
auto nrm : nrms) err += nrm;
718 TEST_FLOATING_EQUALITY(err, 0.0, tol);
721 opt_stepper->computeStepSolver(*W, x, t, *p, 0);
723 in_args.set_alpha(1.0/dt);
724 in_args.set_beta(1.0);
725 model->evalModel(in_args, out_args);
726 out_args.set_W(Teuchos::null);
728 Thyra::solve(*W, Thyra::NOTRANS, *dfdp2, tmp.ptr());
729 Thyra::solve(*W2, Thyra::NOTRANS, *dfdp2, tmp2.ptr());
730 Thyra::V_VmV(tmp.ptr(), *tmp, *tmp2);
731 Thyra::norms(*tmp, Teuchos::arrayViewFromVector(nrms));
733 for (
auto nrm : nrms) err += nrm;
734 TEST_FLOATING_EQUALITY(err, 0.0, tol);
737 Teuchos::TimeMonitor::summarize();
739 #endif // TEST_OPT_INTERFACE