Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_IntegratorObserverSubcycling_impl.hpp
Go to the documentation of this file.
1 //@HEADER
2 // *****************************************************************************
3 // Tempus: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
10 #ifndef Tempus_IntegratorObserverSubcycling_impl_hpp
11 #define Tempus_IntegratorObserverSubcycling_impl_hpp
12 
13 #include "Tempus_Stepper.hpp"
14 
15 namespace Tempus {
16 
17 template <class Scalar>
19 {
20 }
21 
22 template <class Scalar>
24 {
25 }
26 
27 template <class Scalar>
29  const Integrator<Scalar>& integrator)
30 {
31  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
32  out->setOutputToRootOnly(0);
33  Teuchos::OSTab ostab(out, 0, "ScreenOutput");
34  *out << "\n Begin Subcycling "
35  "-------------------------------------------------------\n";
36  // << " Step Time dt Abs Error Rel Error Order nFail
37  // dCompTime"
38  // << std::endl;
39 }
40 
41 template <class Scalar>
43  const Integrator<Scalar>& /* integrator */)
44 {
45 }
46 
47 template <class Scalar>
49  const Integrator<Scalar>& /* integrator */)
50 {
51 }
52 
53 template <class Scalar>
55  const Integrator<Scalar>& /* integrator */)
56 {
57 }
58 
59 template <class Scalar>
61  const Integrator<Scalar>& /* integrator */)
62 {
63 }
64 
65 template <class Scalar>
67  const Integrator<Scalar>& /* integrator */)
68 {
69 }
70 
71 template <class Scalar>
73  const Integrator<Scalar>& integrator)
74 {
75  using Teuchos::RCP;
76  auto cs = integrator.getSolutionHistory()->getCurrentState();
77 
78  if ((cs->getOutputScreen() == true) || (cs->getOutput() == true) ||
79  (cs->getTime() == integrator.getTimeStepControl()->getFinalTime())) {
80  const Scalar steppertime = integrator.getStepperTimer()->totalElapsedTime();
81  // reset the stepper timer
82  integrator.getStepperTimer()->reset();
83 
84  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
85  out->setOutputToRootOnly(0);
86  Teuchos::OSTab ostab(out, 0, "ScreenOutput");
87  *out << std::scientific << std::setw(6) << std::setprecision(3)
88  << cs->getIndex() << std::setw(11) << std::setprecision(3)
89  << cs->getTime() << std::setw(11) << std::setprecision(3)
90  << cs->getTimeStep() << std::setw(11) << std::setprecision(3)
91  << cs->getErrorAbs() << std::setw(11) << std::setprecision(3)
92  << cs->getErrorRel() << std::fixed << std::setw(7)
93  << std::setprecision(1) << cs->getOrder() << std::scientific
94  << std::setw(7) << std::setprecision(3) << cs->getNFailures()
95  << std::setw(11) << std::setprecision(3) << steppertime << std::endl;
96  }
97 }
98 
99 template <class Scalar>
101  const Integrator<Scalar>& integrator)
102 {
103  const Teuchos::RCP<Teuchos::FancyOStream> out = integrator.getOStream();
104  out->setOutputToRootOnly(0);
105  Teuchos::OSTab ostab(out, 0, "ScreenOutput");
106  *out << " End Subcycling "
107  "---------------------------------------------------------\n\n";
108 }
109 
110 } // namespace Tempus
111 #endif // Tempus_IntegratorObserverSubcycling_impl_hpp
virtual void observeEndIntegrator(const Integrator< Scalar > &integrator) override
Observe the end of the time integrator.
virtual Teuchos::RCP< Teuchos::Time > getStepperTimer() const =0
virtual void observeBeforeTakeStep(const Integrator< Scalar > &integrator) override
Observe before Stepper takes step.
virtual void observeAfterTakeStep(const Integrator< Scalar > &integrator) override
Observe after Stepper takes step.
virtual Teuchos::RCP< const TimeStepControl< Scalar > > getTimeStepControl() const =0
Returns the TimeStepControl for this Integrator.
virtual void observeAfterCheckTimeStep(const Integrator< Scalar > &integrator) override
virtual void observeStartTimeStep(const Integrator< Scalar > &integrator) override
Observe the beginning of the time step loop.
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
virtual void observeStartIntegrator(const Integrator< Scalar > &integrator) override
Observe the beginning of the time integrator.
virtual void observeNextTimeStep(const Integrator< Scalar > &integrator) override
Observe after the next time step size is selected.
Thyra Base interface for time integrators. Time integrators are designed to advance the solution from...
double totalElapsedTime(bool readCurrentTime=false) const
virtual RCP< FancyOStream > getOStream() const
virtual void observeEndTimeStep(const Integrator< Scalar > &integrator) override
Observe the end of the time step loop.
virtual Teuchos::RCP< const SolutionHistory< Scalar > > getSolutionHistory() const =0
Returns the SolutionHistory for this Integrator.