SSP_RungeKutta< ORDER > Class Template Reference
+ Inheritance diagram for SSP_RungeKutta< ORDER >:

Public Member Functions

 SSP_RungeKutta ()
 Constructor, set the type. More...
 
 SSP_RungeKutta (const SSP_RungeKutta &)
 Broken copy constructor. More...
 
void operator= (const SSP_RungeKutta &)
 Broken assignment operator. More...
 
void timestep (ExplicitTimeSteppableObject *const &object_pt, const double &dt)
 Function that is used to advance time in the object. More...
 
void timestep (ExplicitTimeSteppableObject *const &object_pt, const double &dt)
 Explicit specialisation for second-order RK scheme. More...
 
- Public Member Functions inherited from oomph::ExplicitTimeStepper
 ExplicitTimeStepper ()
 Empty Constructor. More...
 
 ExplicitTimeStepper (const ExplicitTimeStepper &)=delete
 Broken copy constructor. More...
 
void operator= (const ExplicitTimeStepper &)=delete
 Broken assignment operator. More...
 
virtual ~ExplicitTimeStepper ()
 Empty virtual destructor — no memory is allocated in this class. More...
 

Additional Inherited Members

- Protected Attributes inherited from oomph::ExplicitTimeStepper
std::string Type
 

Detailed Description

template<unsigned ORDER>
class SSP_RungeKutta< ORDER >

=========================================================== Strong Stability preserving Runge Kutta Timestepping

Constructor & Destructor Documentation

◆ SSP_RungeKutta() [1/2]

template<unsigned ORDER>
SSP_RungeKutta< ORDER >::SSP_RungeKutta ( )
inline

Constructor, set the type.

50  {
51  Type="SSP_RungeKutta";
52  }
std::string Type
Definition: explicit_timesteppers.h:136

◆ SSP_RungeKutta() [2/2]

template<unsigned ORDER>
SSP_RungeKutta< ORDER >::SSP_RungeKutta ( const SSP_RungeKutta< ORDER > &  )
inline

Broken copy constructor.

56  {
57  BrokenCopy::broken_copy("SS_PRungeKutta");
58  }
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
Definition: oomph_utilities.cc:212

References oomph::BrokenCopy::broken_copy().

Member Function Documentation

◆ operator=()

template<unsigned ORDER>
void SSP_RungeKutta< ORDER >::operator= ( const SSP_RungeKutta< ORDER > &  )
inline

Broken assignment operator.

62  {
63  BrokenCopy::broken_assign("SSP_RungeKutta");
64  }
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
Definition: oomph_utilities.cc:195

References oomph::BrokenCopy::broken_assign().

◆ timestep() [1/2]

template<unsigned ORDER>
void SSP_RungeKutta< ORDER >::timestep ( ExplicitTimeSteppableObject *const &  object_pt,
const double dt 
)
virtual

Function that is used to advance time in the object.

Implements oomph::ExplicitTimeStepper.

80 {
81  std::ostringstream error_stream;
82  error_stream << "Timestep not implemented for order " << ORDER << "\n";
83  throw OomphLibError(error_stream.str(),
86 }
Definition: oomph_definitions.h:222
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ timestep() [2/2]

void SSP_RungeKutta< 2 >::timestep ( ExplicitTimeSteppableObject *const &  object_pt,
const double dt 
)

Explicit specialisation for second-order RK scheme.

94 {
96 
97  //Store the initial values and initial time
98  DoubleVector u;
99  object_pt->get_dofs(u);
100 
101  // Stage 1
102  // ============================================================
103  object_pt->actions_before_explicit_stage();
104 
105  //Now get the first unknowns
106  DoubleVector k1;
107  object_pt->get_dvaluesdt(k1);
108 
109  //Add to the residuals
110  object_pt->add_to_dofs(dt,k1);
111  //Increment the time
112  object_pt->time() += dt;
113  object_pt->actions_after_explicit_stage();
114 
115  // Stage 2
116  // ============================================================
117  object_pt->actions_before_explicit_stage();
118 
119  //Get the next unknowns
120  DoubleVector k2;
121  object_pt->get_dvaluesdt(k2);
122 
123  //Add to the residuals so that the current value of the unknowns
124  //is the result of two forward Euler steps of time dt
125  object_pt->add_to_dofs(dt,k2);
126 
127  //Set the final values of the unknowns by taking the average of the
128  //initial value and the result of the two forward Euler steps
129 
130  //Get the current value
131  DoubleVector u_final;
132  object_pt->get_dofs(u_final);
133 
134  //Now take the average
135  unsigned n_dof = u_final.nrow();
136  for(unsigned n=0;n<n_dof;n++)
137  {
138  u_final[n] += u[n];
139  u_final[n] *= 0.5;
140  }
141 
142  //Set the dofs to the new final value
143  object_pt->set_dofs(u_final);
144 
145  //Time remains the same
146 
147  // Actions functions
148  object_pt->actions_after_explicit_stage();
149  object_pt->actions_after_explicit_timestep();
150 }
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
unsigned nrow() const
access function to the number of global rows.
Definition: linear_algebra_distribution.h:463
Definition: double_vector.h:58
virtual void add_to_dofs(const double &lambda, const DoubleVector &increment_dofs)
Function that adds the values to the dofs.
Definition: explicit_timesteppers.cc:112
virtual void get_dofs(DoubleVector &dofs) const
Function that gets the values of the dofs in the object.
Definition: explicit_timesteppers.cc:60
virtual void actions_after_explicit_timestep()
Definition: explicit_timesteppers.h:116
virtual double & time()
Definition: explicit_timesteppers.cc:132
virtual void actions_before_explicit_stage()
Definition: explicit_timesteppers.h:102
virtual void set_dofs(const DoubleVector &dofs)
Function that sets the values of the dofs in the object.
Definition: explicit_timesteppers.cc:95
virtual void get_dvaluesdt(DoubleVector &minv_res)
Definition: explicit_timesteppers.cc:41
virtual void actions_after_explicit_stage()
Definition: explicit_timesteppers.h:108
virtual void actions_before_explicit_timestep()
Definition: explicit_timesteppers.h:112

References oomph::ExplicitTimeSteppableObject::actions_after_explicit_stage(), oomph::ExplicitTimeSteppableObject::actions_after_explicit_timestep(), oomph::ExplicitTimeSteppableObject::actions_before_explicit_stage(), oomph::ExplicitTimeSteppableObject::actions_before_explicit_timestep(), oomph::ExplicitTimeSteppableObject::add_to_dofs(), oomph::ExplicitTimeSteppableObject::get_dofs(), oomph::ExplicitTimeSteppableObject::get_dvaluesdt(), n, oomph::DistributableLinearAlgebraObject::nrow(), oomph::ExplicitTimeSteppableObject::set_dofs(), and oomph::ExplicitTimeSteppableObject::time().


The documentation for this class was generated from the following file: