Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs Pages
Rythmos_ExplicitTaylorPolynomialStepper.hpp
1 //@HEADER
2 // ***********************************************************************
3 //
4 // Rythmos Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
25 //
26 // ***********************************************************************
27 //@HEADER
28 
29 #ifndef RYTHMOS_EXPLICIT_TAYLOR_POLYNOMIAL_STEPPER_H
30 #define RYTHMOS_EXPLICIT_TAYLOR_POLYNOMIAL_STEPPER_H
31 
32 #include "Rythmos_StepperBase.hpp"
33 #include "Rythmos_StepperHelpers.hpp"
34 #include "Teuchos_RCP.hpp"
35 #include "Teuchos_ParameterList.hpp"
36 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
37 #include "Thyra_VectorBase.hpp"
38 #include "Thyra_ModelEvaluator.hpp"
39 #include "Thyra_ModelEvaluatorHelpers.hpp"
40 #include "Thyra_PolynomialVectorTraits.hpp"
41 #include "RTOpPack_RTOpTHelpers.hpp"
42 
43 namespace Rythmos {
44 
46 
53 RTOP_ROP_1_REDUCT_SCALAR( ROpLogNormInf,
54  typename ScalarTraits<Scalar>::magnitudeType, // Reduction object type
55  RTOpPack::REDUCT_TYPE_MAX // Reduction object reduction
56  )
57 {
58  using Teuchos::as;
59  typedef ScalarTraits<Scalar> ST;
60  typedef typename ST::magnitudeType ScalarMag;
61  const ScalarMag mag = std::log(as<ScalarMag>(1e-100) + ST::magnitude(v0));
62  reduct = TEUCHOS_MAX( mag, reduct );
63 }
64 
162 template<class Scalar>
163 class ExplicitTaylorPolynomialStepper : virtual public StepperBase<Scalar>
164 {
165 public:
166 
168  typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
169 
172 
175 
177  RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
178 
180  void setModel(const RCP<const Thyra::ModelEvaluator<Scalar> >& model);
181 
183  void setNonconstModel(const RCP<Thyra::ModelEvaluator<Scalar> >& model);
184 
186  RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const;
187 
189  RCP<Thyra::ModelEvaluator<Scalar> > getNonconstModel();
190 
192  void setInitialCondition(
193  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition
194  );
195 
197  Thyra::ModelEvaluatorBase::InArgs<Scalar> getInitialCondition() const;
198 
200  Scalar takeStep(Scalar dt, StepSizeType flag);
201 
203  const StepStatus<Scalar> getStepStatus() const;
204 
206 
207  void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
208 
210  RCP<Teuchos::ParameterList> getNonconstParameterList();
211 
213  RCP<Teuchos::ParameterList> unsetParameterList();
214 
216  RCP<const Teuchos::ParameterList> getValidParameters() const;
217 
219  std::string description() const;
220 
222  void describe(
223  Teuchos::FancyOStream &out,
224  const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default
225  ) const;
226 
229  void addPoints(
230  const Array<Scalar>& time_vec
231  ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& x_vec
232  ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec
233  );
234 
236  void getPoints(
237  const Array<Scalar>& time_vec
238  ,Array<RCP<const Thyra::VectorBase<Scalar> > >* x_vec
239  ,Array<RCP<const Thyra::VectorBase<Scalar> > >* xdot_vec
240  ,Array<ScalarMag>* accuracy_vec) const;
241 
243  void setRange(
244  const TimeRange<Scalar>& range,
246  );
247 
250 
252  void getNodes(Array<Scalar>* time_vec) const;
253 
255  void removeNodes(Array<Scalar>& time_vec);
256 
258  int getOrder() const;
259 
260 private:
261 
263  void defaultInitializAll_();
264 
266  void computeTaylorSeriesSolution_();
267 
272  ScalarMag estimateLogRadius_();
273 
275  RCP<const Thyra::ModelEvaluator<Scalar> > model_;
276 
278  RCP<Teuchos::ParameterList> parameterList_;
279 
281  RCP<Thyra::VectorBase<Scalar> > x_vector_;
282 
284  RCP<Thyra::VectorBase<Scalar> > x_vector_old_;
285 
287  RCP<Thyra::VectorBase<Scalar> > x_dot_vector_;
288 
290  RCP<Thyra::VectorBase<Scalar> > x_dot_vector_old_;
291 
293  RCP<Thyra::VectorBase<Scalar> > f_vector_;
294 
296  RCP<Teuchos::Polynomial<Thyra::VectorBase<Scalar> > > x_poly_;
297 
299  RCP<Teuchos::Polynomial<Thyra::VectorBase<Scalar> > > f_poly_;
300 
302  Thyra::ModelEvaluatorBase::InArgs<Scalar> basePoint_;
303 
305  bool haveInitialCondition_;
306 
308  int numSteps_;
309 
311  Scalar t_;
312 
314  Scalar dt_;
315 
317  Scalar t_initial_;
318 
320  Scalar t_final_;
321 
323  ScalarMag local_error_tolerance_;
324 
326  Scalar min_step_size_;
327 
329  Scalar max_step_size_;
330 
332  unsigned int degree_;
333 
335  Scalar linc_;
336 };
337 
338 
340 template <typename Scalar>
341 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
342 log_norm_inf(const Thyra::VectorBase<Scalar>& x)
343 {
344  ROpLogNormInf<Scalar> log_norm_inf_op;
345  RCP<RTOpPack::ReductTarget> log_norm_inf_targ =
346  log_norm_inf_op.reduct_obj_create();
347  Thyra::applyOp<Scalar>(log_norm_inf_op,
348  Teuchos::tuple(Teuchos::ptrFromRef(x))(), Teuchos::null,
349  log_norm_inf_targ.ptr());
350  return log_norm_inf_op(*log_norm_inf_targ);
351 }
352 
353 
354 // Non-member constructor
355 template<class Scalar>
356 RCP<ExplicitTaylorPolynomialStepper<Scalar> > explicitTaylorPolynomialStepper()
357 {
358  RCP<ExplicitTaylorPolynomialStepper<Scalar> > stepper = rcp(new ExplicitTaylorPolynomialStepper<Scalar>());
359  return stepper;
360 }
361 
362 
363 template<class Scalar>
365 {
366  this->defaultInitializAll_();
367  numSteps_ = 0;
368 }
369 
370 
371 template<class Scalar>
373 {
374 }
375 
376 
377 template<class Scalar>
379 {
380  typedef Teuchos::ScalarTraits<Scalar> ST;
381  Scalar nan = ST::nan();
382  model_ = Teuchos::null;
383  parameterList_ = Teuchos::null;
384  x_vector_ = Teuchos::null;
385  x_vector_old_ = Teuchos::null;
386  x_dot_vector_ = Teuchos::null;
387  x_dot_vector_old_ = Teuchos::null;
388  f_vector_ = Teuchos::null;
389  x_poly_ = Teuchos::null;
390  f_poly_ = Teuchos::null;
391  haveInitialCondition_ = false;
392  numSteps_ = -1;
393  t_ = nan;
394  dt_ = nan;
395  t_initial_ = nan;
396  t_final_ = nan;
397  local_error_tolerance_ = nan;
398  min_step_size_ = nan;
399  max_step_size_ = nan;
400  degree_ = 0;
401  linc_ = nan;
402 }
403 
404 
405 template<class Scalar>
407  const RCP<const Thyra::ModelEvaluator<Scalar> >& model
408  )
409 {
410  TEUCHOS_TEST_FOR_EXCEPT( is_null(model) );
411  assertValidModel( *this, *model );
412 
413  model_ = model;
414  f_vector_ = Thyra::createMember(model_->get_f_space());
415 }
416 
417 
418 template<class Scalar>
420  const RCP<Thyra::ModelEvaluator<Scalar> >& model
421  )
422 {
423  this->setModel(model); // TODO 09/09/09 tscoffe: use ConstNonconstObjectContainer!
424 }
425 
426 
427 template<class Scalar>
428 RCP<const Thyra::ModelEvaluator<Scalar> >
430 {
431  return model_;
432 }
433 
434 
435 template<class Scalar>
436 RCP<Thyra::ModelEvaluator<Scalar> >
438 {
439  return Teuchos::null;
440 }
441 
442 
443 template<class Scalar>
445  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition
446  )
447 {
448  typedef Teuchos::ScalarTraits<Scalar> ST;
449  typedef Thyra::ModelEvaluatorBase MEB;
450  basePoint_ = initialCondition;
451  if (initialCondition.supports(MEB::IN_ARG_t)) {
452  t_ = initialCondition.get_t();
453  } else {
454  t_ = ST::zero();
455  }
456  dt_ = ST::zero();
457  x_vector_ = initialCondition.get_x()->clone_v();
458  x_dot_vector_ = x_vector_->clone_v();
459  x_vector_old_ = x_vector_->clone_v();
460  x_dot_vector_old_ = x_dot_vector_->clone_v();
461  haveInitialCondition_ = true;
462 }
463 
464 
465 template<class Scalar>
466 Thyra::ModelEvaluatorBase::InArgs<Scalar>
468 {
469  return basePoint_;
470 }
471 
472 
473 template<class Scalar>
474 Scalar
476 {
477  typedef Teuchos::ScalarTraits<Scalar> ST;
478  TEUCHOS_ASSERT( haveInitialCondition_ );
479  TEUCHOS_ASSERT( !is_null(model_) );
480  TEUCHOS_ASSERT( !is_null(parameterList_) ); // parameters are nan otherwise
481 
482  V_V(outArg(*x_vector_old_),*x_vector_); // x_vector_old = x_vector
483  V_V(outArg(*x_dot_vector_old_),*x_dot_vector_); // x_dot_vector_old = x_dot_vector
484 
485  if (x_poly_ == Teuchos::null) {
486  x_poly_ = Teuchos::rcp(new Teuchos::Polynomial<Thyra::VectorBase<Scalar> >(0,*x_vector_,degree_));
487  }
488 
489  if (f_poly_ == Teuchos::null) {
490  f_poly_ = Teuchos::rcp(new Teuchos::Polynomial<Thyra::VectorBase<Scalar> >(0, *f_vector_, degree_));
491  }
492  if (flag == STEP_TYPE_VARIABLE) {
493  // If t_ > t_final_, we're done
494  if (t_ > t_final_) {
495  dt_ = ST::zero();
496  return dt_;
497  }
498 
499  // Compute a local truncated Taylor series solution to system
500  computeTaylorSeriesSolution_();
501 
502  // Estimate log of radius of convergence of Taylor series
503  Scalar rho = estimateLogRadius_();
504 
505  // Set step size
506  Scalar shadowed_dt = std::exp(linc_ - rho);
507 
508  // If step size is too big, reduce
509  if (shadowed_dt > max_step_size_) {
510  shadowed_dt = max_step_size_;
511  }
512 
513  // If step goes past t_final_, reduce
514  if (t_+shadowed_dt > t_final_) {
515  shadowed_dt = t_final_-t_;
516  }
517 
518  ScalarMag local_error;
519 
520  do {
521 
522  // compute x(t_+shadowed_dt), xdot(t_+shadowed_dt)
523  x_poly_->evaluate(shadowed_dt, x_vector_.get(), x_dot_vector_.get());
524 
525  // compute f( x(t_+shadowed_dt), t_+shadowed_dt )
526  eval_model_explicit<Scalar>(*model_,basePoint_,*x_vector_,t_+shadowed_dt,Teuchos::outArg(*f_vector_));
527 
528  // compute || xdot(t_+shadowed_dt) - f( x(t_+shadowed_dt), t_+shadowed_dt ) ||
529  Thyra::Vp_StV(x_dot_vector_.ptr(), -ST::one(),
530  *f_vector_);
531  local_error = norm_inf(*x_dot_vector_);
532 
533  if (local_error > local_error_tolerance_) {
534  shadowed_dt *= 0.7;
535  }
536 
537  } while (local_error > local_error_tolerance_ && shadowed_dt > min_step_size_);
538 
539  // Check if minimum step size was reached
540  TEUCHOS_TEST_FOR_EXCEPTION(shadowed_dt < min_step_size_,
541  std::runtime_error,
542  "ExplicitTaylorPolynomialStepper<Scalar>::takeStep(): "
543  << "Step size reached minimum step size "
544  << min_step_size_ << ". Failing step." );
545 
546  // Increment t_
547  t_ += shadowed_dt;
548 
549  numSteps_++;
550 
551  dt_ = shadowed_dt;
552 
553  return shadowed_dt;
554 
555  } else {
556 
557  // If t_ > t_final_, we're done
558  if (t_ > t_final_) {
559  dt_ = Teuchos::ScalarTraits<Scalar>::zero();
560  return dt_;
561  }
562 
563  // Compute a local truncated Taylor series solution to system
564  computeTaylorSeriesSolution_();
565 
566  // If step size is too big, reduce
567  if (dt > max_step_size_) {
568  dt = max_step_size_;
569  }
570 
571  // If step goes past t_final_, reduce
572  if (t_+dt > t_final_) {
573  dt = t_final_-t_;
574  }
575 
576  // compute x(t_+dt)
577  x_poly_->evaluate(dt, x_vector_.get());
578 
579  // Increment t_
580  t_ += dt;
581 
582  numSteps_++;
583 
584  dt_ = dt;
585 
586  return dt;
587  }
588 }
589 
590 
591 template<class Scalar>
592 const StepStatus<Scalar>
594 {
595  // typedef Teuchos::ScalarTraits<Scalar> ST; // unused
596  StepStatus<Scalar> stepStatus;
597 
598  if (!haveInitialCondition_) {
599  stepStatus.stepStatus = STEP_STATUS_UNINITIALIZED;
600  }
601  else if (numSteps_ == 0) {
602  stepStatus.stepStatus = STEP_STATUS_UNKNOWN;
603  stepStatus.stepSize = dt_;
604  stepStatus.order = this->getOrder();
605  stepStatus.time = t_;
606  stepStatus.solution = x_vector_;
607  stepStatus.solutionDot = x_dot_vector_;
608  if (!is_null(model_)) {
609  stepStatus.residual = f_vector_;
610  }
611  }
612  else {
613  stepStatus.stepStatus = STEP_STATUS_CONVERGED;
614  stepStatus.stepSize = dt_;
615  stepStatus.order = this->getOrder();
616  stepStatus.time = t_;
617  stepStatus.solution = x_vector_;
618  stepStatus.solutionDot = x_dot_vector_;
619  stepStatus.residual = f_vector_;
620  }
621  return(stepStatus);
622 }
623 
624 
625 template<class Scalar>
626 void ExplicitTaylorPolynomialStepper<Scalar>::setParameterList(RCP<Teuchos::ParameterList> const& paramList)
627 {
628  typedef Teuchos::ScalarTraits<Scalar> ST;
629 
630  TEUCHOS_TEST_FOR_EXCEPT(is_null(paramList));
631  paramList->validateParameters(*this->getValidParameters());
632  parameterList_ = paramList;
633  Teuchos::readVerboseObjectSublist(&*parameterList_,this);
634 
635  // Get initial time
636  t_initial_ = parameterList_->get("Initial Time", ST::zero());
637 
638  // Get final time
639  t_final_ = parameterList_->get("Final Time", ST::one());
640 
641  // Get local error tolerance
642  local_error_tolerance_ =
643  parameterList_->get("Local Error Tolerance", ScalarMag(1.0e-10));
644 
645  // Get minimum step size
646  min_step_size_ = parameterList_->get("Minimum Step Size", Scalar(1.0e-10));
647 
648  // Get maximum step size
649  max_step_size_ = parameterList_->get("Maximum Step Size", Scalar(1.0));
650 
651  // Get degree_ of Taylor polynomial expansion
652  degree_ = parameterList_->get("Taylor Polynomial Degree", Teuchos::as<unsigned int>(40));
653 
654  linc_ = Scalar(-16.0*std::log(10.0)/degree_);
655  t_ = t_initial_;
656 }
657 
658 
659 template<class Scalar>
660 RCP<Teuchos::ParameterList>
662 {
663  return parameterList_;
664 }
665 
666 
667 template<class Scalar>
668 RCP<Teuchos::ParameterList>
670 {
671  RCP<Teuchos::ParameterList> temp_param_list = parameterList_;
672  parameterList_ = Teuchos::null;
673  return temp_param_list;
674 }
675 
676 
677 template<class Scalar>
678 RCP<const Teuchos::ParameterList>
680 {
681  typedef ScalarTraits<Scalar> ST;
682  static RCP<const ParameterList> validPL;
683  if (is_null(validPL)) {
684  RCP<ParameterList> pl = Teuchos::parameterList();
685 
686  pl->set<Scalar>("Initial Time", ST::zero());
687  pl->set<Scalar>("Final Time", ST::one());
688  pl->set<ScalarMag>("Local Error Tolerance", ScalarMag(1.0e-10));
689  pl->set<Scalar>("Minimum Step Size", Scalar(1.0e-10));
690  pl->set<Scalar>("Maximum Step Size", Scalar(1.0));
691  pl->set<unsigned int>("Taylor Polynomial Degree", 40);
692 
693  Teuchos::setupVerboseObjectSublist(&*pl);
694  validPL = pl;
695  }
696  return validPL;
697 }
698 
699 
700 template<class Scalar>
702 {
703  std::string name = "Rythmos::ExplicitTaylorPolynomialStepper";
704  return name;
705 }
706 
707 
708 template<class Scalar>
710  Teuchos::FancyOStream &out,
711  const Teuchos::EVerbosityLevel verbLevel
712  ) const
713 {
714  if (verbLevel == Teuchos::VERB_EXTREME) {
715  out << description() << "::describe" << std::endl;
716  out << "model_ = " << std::endl;
717  out << Teuchos::describe(*model_, verbLevel) << std::endl;
718  out << "x_vector_ = " << std::endl;
719  out << Teuchos::describe(*x_vector_, verbLevel) << std::endl;
720  out << "x_dot_vector_ = " << std::endl;
721  out << Teuchos::describe(*x_dot_vector_, verbLevel) << std::endl;
722  out << "f_vector_ = " << std::endl;
723  out << Teuchos::describe(*f_vector_, verbLevel) << std::endl;
724  out << "x_poly_ = " << std::endl;
725  out << Teuchos::describe(*x_poly_, verbLevel) << std::endl;
726  out << "f_poly_ = " << std::endl;
727  out << Teuchos::describe(*f_poly_, verbLevel) << std::endl;
728  out << "t_ = " << t_ << std::endl;
729  out << "t_initial_ = " << t_initial_ << std::endl;
730  out << "t_final_ = " << t_final_ << std::endl;
731  out << "local_error_tolerance_ = " << local_error_tolerance_ << std::endl;
732  out << "min_step_size_ = " << min_step_size_ << std::endl;
733  out << "max_step_size_ = " << max_step_size_ << std::endl;
734  out << "degree_ = " << degree_ << std::endl;
735  out << "linc_ = " << linc_ << std::endl;
736  }
737 }
738 
739 
740 template<class Scalar>
742  const Array<Scalar>& /* time_vec */
743  ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& /* x_vec */
744  ,const Array<RCP<const Thyra::VectorBase<Scalar> > >& /* xdot_vec */
745  )
746 {
747  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,"Error, addPoints is not implemented for the ExplicitTaylorPolynomialStepper.\n");
748 }
749 
750 
751 template<class Scalar>
753  const Array<Scalar>& time_vec
754  ,Array<RCP<const Thyra::VectorBase<Scalar> > >* x_vec
755  ,Array<RCP<const Thyra::VectorBase<Scalar> > >* xdot_vec
756  ,Array<ScalarMag>* accuracy_vec) const
757 {
758  TEUCHOS_ASSERT( haveInitialCondition_ );
759  using Teuchos::constOptInArg;
760  using Teuchos::null;
761  defaultGetPoints<Scalar>(
762  t_-dt_,constOptInArg(*x_vector_old_),constOptInArg(*x_dot_vector_old_),
763  t_,constOptInArg(*x_vector_),constOptInArg(*x_dot_vector_),
764  time_vec,ptr(x_vec),ptr(xdot_vec),ptr(accuracy_vec),
765  Ptr<InterpolatorBase<Scalar> >(null)
766  );
767 }
768 
769 
770 template<class Scalar>
772 {
773  if (!haveInitialCondition_) {
774  return invalidTimeRange<Scalar>();
775  } else {
776  return(TimeRange<Scalar>(t_-dt_,t_));
777  }
778 }
779 
780 
781 template<class Scalar>
782 void ExplicitTaylorPolynomialStepper<Scalar>::getNodes(Array<Scalar>* time_vec) const
783 {
784  TEUCHOS_ASSERT( time_vec != NULL );
785  time_vec->clear();
786  if (!haveInitialCondition_) {
787  return;
788  } else {
789  time_vec->push_back(t_);
790  }
791  if (numSteps_ > 0) {
792  time_vec->push_back(t_-dt_);
793  }
794 }
795 
796 
797 template<class Scalar>
798 void ExplicitTaylorPolynomialStepper<Scalar>::removeNodes(Array<Scalar>& /* time_vec */)
799 {
800  TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error,"Error, removeNodes is not implemented for the ExplicitTaylorPolynomialStepper.\n");
801 }
802 
803 
804 template<class Scalar>
806 {
807  return degree_;
808 }
809 
810 
811 //
812 // Definitions of protected methods
813 //
814 
815 
816 template<class Scalar>
817 void
819 {
820  RCP<Thyra::VectorBase<Scalar> > tmp;
821 
822  // Set degree_ of polynomials to 0
823  x_poly_->setDegree(0);
824  f_poly_->setDegree(0);
825 
826  // Set degree_ 0 coefficient
827  x_poly_->setCoefficient(0, *x_vector_);
828 
829  for (unsigned int k=1; k<=degree_; k++) {
830 
831  // compute [f] = f([x])
832  eval_model_explicit_poly(*model_, basePoint_, *x_poly_, t_, Teuchos::outArg(*f_poly_));
833 
834  x_poly_->setDegree(k);
835  f_poly_->setDegree(k);
836 
837  // x[k] = f[k-1] / k
838  tmp = x_poly_->getCoefficient(k);
839  copy(*(f_poly_->getCoefficient(k-1)), tmp.ptr());
840  scale(Scalar(1.0)/Scalar(k), tmp.ptr());
841  }
842 
843 }
844 
845 
846 template<class Scalar>
847 typename ExplicitTaylorPolynomialStepper<Scalar>::ScalarMag
848 ExplicitTaylorPolynomialStepper<Scalar>::estimateLogRadius_()
849 {
850  ScalarMag rho = 0;
851  ScalarMag tmp;
852  for (unsigned int k=degree_/2; k<=degree_; k++) {
853  tmp = log_norm_inf(*(x_poly_->getCoefficient(k))) / k;
854  if (tmp > rho) {
855  rho = tmp;
856  }
857  }
858  return rho;
859 }
860 
861 
862 template<class Scalar>
863 RCP<const Thyra::VectorSpaceBase<Scalar> > ExplicitTaylorPolynomialStepper<Scalar>::get_x_space() const
864 {
865  if (haveInitialCondition_) {
866  return(x_vector_->space());
867  } else {
868  return Teuchos::null;
869  }
870 }
871 
872 
873 } // namespace Rythmos
874 
875 #endif // RYTHMOS_EXPLICIT_TAYLOR_POLYNOMIAL_STEPPER_H
void getNodes(Array< Scalar > *time_vec) const
Get interpolation nodes.
Base class for defining stepper functionality.
Thyra::ModelEvaluatorBase::InArgs< Scalar > getInitialCondition() const
void addPoints(const Array< Scalar > &time_vec, const Array< RCP< const Thyra::VectorBase< Scalar > > > &x_vec, const Array< RCP< const Thyra::VectorBase< Scalar > > > &xdot_vec)
void setInitialCondition(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &initialCondition)
RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Return the space for x and x_dot
void removeNodes(Array< Scalar > &time_vec)
Remove interpolation nodes.
void setModel(const RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Set model.
RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
void setNonconstModel(const RCP< Thyra::ModelEvaluator< Scalar > > &model)
Set model.
void setParameterList(RCP< Teuchos::ParameterList > const &paramList)
Redefined from Teuchos::ParameterListAcceptor.
RCP< const Thyra::VectorBase< Scalar > > residual
RCP< const Thyra::VectorBase< Scalar > > solutionDot
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
Typename of magnitude of scalars.
Base class for an interpolation buffer.
void getPoints(const Array< Scalar > &time_vec, Array< RCP< const Thyra::VectorBase< Scalar > > > *x_vec, Array< RCP< const Thyra::VectorBase< Scalar > > > *xdot_vec, Array< ScalarMag > *accuracy_vec) const
Get values from buffer.
Scalar takeStep(Scalar dt, StepSizeType flag)
Take a time step of magnitude dt.
Implementation of Rythmos::Stepper for explicit Taylor polynomial time integration of ODEs...
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
void setRange(const TimeRange< Scalar > &range, const InterpolationBufferBase< Scalar > &IB)
Fill data in from another interpolation buffer.
RCP< const Thyra::VectorBase< Scalar > > solution
RCP< const Teuchos::ParameterList > getValidParameters() const