oomph::Steady< NSTEPS > Class Template Reference

#include <timesteppers.h>

+ Inheritance diagram for oomph::Steady< NSTEPS >:

Public Types

typedef double(* InitialConditionFctPt) (const double &t)
 

Public Member Functions

 Steady ()
 
 Steady (const Steady &)=delete
 Broken copy constructor. More...
 
void operator= (const Steady &)=delete
 Broken assignment operator. More...
 
unsigned order () const
 
void assign_initial_values_impulsive (Data *const &data_pt)
 
void assign_initial_positions_impulsive (Node *const &node_pt)
 
void assign_initial_data_values (Data *const &data_pt, Vector< InitialConditionFctPt > initial_value_fct)
 
void shift_time_values (Data *const &data_pt)
 
void shift_time_positions (Node *const &node_pt)
 
void set_weights ()
 Set weights. More...
 
unsigned nprev_values () const
 Number of previous values available. More...
 
unsigned ndt () const
 Number of timestep increments that need to be stored by the scheme. More...
 
double weight (const unsigned &i, const unsigned &j) const
 Dummy: Access function for j-th weight for the i-th derivative. More...
 
- Public Member Functions inherited from oomph::TimeStepper
 TimeStepper (const unsigned &tstorage, const unsigned &max_deriv)
 
 TimeStepper ()
 Broken empty constructor. More...
 
 TimeStepper (const TimeStepper &)=delete
 Broken copy constructor. More...
 
void operator= (const TimeStepper &)=delete
 Broken assignment operator. More...
 
virtual ~TimeStepper ()
 virtual destructor More...
 
unsigned highest_derivative () const
 Highest order derivative that the scheme can compute. More...
 
doubletime ()
 Return current value of continous time. More...
 
double time () const
 Return current value of continous time. More...
 
virtual unsigned nprev_values_for_value_at_evaluation_time () const
 
void make_steady ()
 
bool is_steady () const
 
bool predict_by_explicit_step () const
 
ExplicitTimeStepperexplicit_predictor_pt ()
 
void set_predictor_pt (ExplicitTimeStepper *_pred_pt)
 
void update_predicted_time (const double &new_time)
 
void check_predicted_values_up_to_date () const
 Check that the predicted values are the ones we want. More...
 
unsigned predictor_storage_index () const
 
void enable_warning_in_assign_initial_data_values ()
 
void disable_warning_in_assign_initial_data_values ()
 
const DenseMatrix< double > * weights_pt () const
 Get a (const) pointer to the weights. More...
 
virtual void undo_make_steady ()
 
std::string type () const
 
void time_derivative (const unsigned &i, Data *const &data_pt, Vector< double > &deriv)
 
double time_derivative (const unsigned &i, Data *const &data_pt, const unsigned &j)
 Evaluate i-th derivative of j-th value in Data. More...
 
void time_derivative (const unsigned &i, Node *const &node_pt, Vector< double > &deriv)
 
double time_derivative (const unsigned &i, Node *const &node_pt, const unsigned &j)
 
Time *const & time_pt () const
 Access function for the pointer to time (const version) More...
 
Time *& time_pt ()
 
unsigned ntstorage () const
 
bool adaptive_flag () const
 Function to indicate whether the scheme is adaptive (false by default) More...
 
virtual void set_predictor_weights ()
 
virtual void calculate_predicted_values (Data *const &data_pt)
 
virtual void calculate_predicted_positions (Node *const &node_pt)
 
virtual void set_error_weights ()
 
virtual double temporal_error_in_position (Node *const &node_pt, const unsigned &i)
 
virtual double temporal_error_in_value (Data *const &data_pt, const unsigned &i)
 
virtual void actions_before_timestep (Problem *problem_pt)
 
virtual void actions_after_timestep (Problem *problem_pt)
 

Static Private Attributes

static double One = 1.0
 Static variable to hold the value 1.0. More...
 
static double Zero = 0.0
 Static variable to hold the value 0.0. More...
 
static Time Dummy_time
 

Additional Inherited Members

- Protected Attributes inherited from oomph::TimeStepper
TimeTime_pt
 Pointer to discrete time storage scheme. More...
 
DenseMatrix< doubleWeight
 Storage for the weights associated with the timestepper. More...
 
std::string Type
 
bool Adaptive_Flag
 
bool Is_steady
 
bool Shut_up_in_assign_initial_data_values
 
bool Predict_by_explicit_step
 
ExplicitTimeStepperExplicit_predictor_pt
 
double Predicted_time
 
int Predictor_storage_index
 

Detailed Description

template<unsigned NSTEPS>
class oomph::Steady< NSTEPS >

////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// Faux time-stepper for steady problems. Allows storage for NSTEPS previous values.

Member Typedef Documentation

◆ InitialConditionFctPt

template<unsigned NSTEPS>
typedef double(* oomph::Steady< NSTEPS >::InitialConditionFctPt) (const double &t)

Typedef for function that returns the (scalar) initial value at a given value of the continuous time t.

Constructor & Destructor Documentation

◆ Steady() [1/2]

template<unsigned NSTEPS>
oomph::Steady< NSTEPS >::Steady ( )
inline

Constructor: Creates storage for NSTEPS previous timesteps and can evaluate up to 2nd derivatives (though it doesn't actually do anything – all time-derivatives evaluate to zero)

687  : TimeStepper(NSTEPS + 1, 2)
688  {
689  Type = "Steady";
690  Time_pt = &Dummy_time;
691 
692  // Overwrite default assignment in base constructor -- this TimeStepper
693  // actually is steady all the time.
694  Is_steady = true;
695  }
static Time Dummy_time
Definition: timesteppers.h:888
Time * Time_pt
Pointer to discrete time storage scheme.
Definition: timesteppers.h:234
std::string Type
Definition: timesteppers.h:241
bool Is_steady
Definition: timesteppers.h:251
TimeStepper()
Broken empty constructor.
Definition: timesteppers.h:301

References Flag_definition::Time_pt.

◆ Steady() [2/2]

template<unsigned NSTEPS>
oomph::Steady< NSTEPS >::Steady ( const Steady< NSTEPS > &  )
delete

Broken copy constructor.

Member Function Documentation

◆ assign_initial_data_values()

template<unsigned NSTEPS>
void oomph::Steady< NSTEPS >::assign_initial_data_values ( Data *const &  data_pt,
Vector< InitialConditionFctPt initial_value_fct 
)
inline

Initialise the time-history for the Data values, corresponding to given time history, specified by Vector of function pointers.

767  {
768  // The time history stores the previous function values
769  unsigned n_time_value = ntstorage();
770 
771  // Find number of values stored
772  unsigned n_value = data_pt->nvalue();
773 
774  // Loop over current and stored timesteps
775  for (unsigned t = 0; t < n_time_value; t++)
776  {
777  // Get corresponding continous time
778  double time_local = Time_pt->time(t);
779 
780  // Loop over values
781  for (unsigned j = 0; j < n_value; j++)
782  {
783  data_pt->set_value(t, j, initial_value_fct[j](time_local));
784  }
785  }
786  }
unsigned ntstorage() const
Definition: timesteppers.h:601
double & time()
Return the current value of the continuous time.
Definition: timesteppers.h:123
t
Definition: plotPSD.py:36
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2

References j, oomph::Data::nvalue(), oomph::Data::set_value(), plotPSD::t, and Flag_definition::Time_pt.

◆ assign_initial_positions_impulsive()

template<unsigned NSTEPS>
void oomph::Steady< NSTEPS >::assign_initial_positions_impulsive ( Node *const &  node_pt)
inlinevirtual

Initialise the time-history for the nodal positions corresponding to an impulsive start.

Implements oomph::TimeStepper.

734  {
735  // Find the number of coordinates
736  unsigned n_dim = node_pt->ndim();
737  // Find the number of positoin types
738  unsigned n_position_type = node_pt->nposition_type();
739 
740  // Loop over values
741  for (unsigned i = 0; i < n_dim; i++)
742  {
743  // Set previous values to the initial value, if not a copy
744  if (node_pt->position_is_a_copy(i) == false)
745  {
746  for (unsigned k = 0; k < n_position_type; k++)
747  {
748  for (unsigned t = 1; t <= NSTEPS; t++)
749  {
750  node_pt->x_gen(t, k, i) = node_pt->x_gen(k, i);
751  }
752  }
753  }
754  }
755  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
char char char int int * k
Definition: level2_impl.h:374

References i, k, oomph::Node::ndim(), oomph::Node::nposition_type(), oomph::Node::position_is_a_copy(), plotPSD::t, and oomph::Node::x_gen().

◆ assign_initial_values_impulsive()

template<unsigned NSTEPS>
void oomph::Steady< NSTEPS >::assign_initial_values_impulsive ( Data *const &  data_pt)
inlinevirtual

Initialise the time-history for the Data values, corresponding to an impulsive start.

Implements oomph::TimeStepper.

714  {
715  // Find number of values stored
716  unsigned n_value = data_pt->nvalue();
717  // Loop over values
718  for (unsigned j = 0; j < n_value; j++)
719  {
720  // Set previous values to the initial value, if not a copy
721  if (data_pt->is_a_copy(j) == false)
722  {
723  for (unsigned t = 1; t <= NSTEPS; t++)
724  {
725  data_pt->set_value(t, j, data_pt->value(j));
726  }
727  }
728  }
729  }

References oomph::Data::is_a_copy(), j, oomph::Data::nvalue(), oomph::Data::set_value(), plotPSD::t, and oomph::Data::value().

◆ ndt()

template<unsigned NSTEPS>
unsigned oomph::Steady< NSTEPS >::ndt ( ) const
inlinevirtual

Number of timestep increments that need to be stored by the scheme.

Implements oomph::TimeStepper.

863  {
864  return NSTEPS;
865  }

◆ nprev_values()

template<unsigned NSTEPS>
unsigned oomph::Steady< NSTEPS >::nprev_values ( ) const
inlinevirtual

Number of previous values available.

Implements oomph::TimeStepper.

857  {
858  return NSTEPS;
859  }

◆ operator=()

template<unsigned NSTEPS>
void oomph::Steady< NSTEPS >::operator= ( const Steady< NSTEPS > &  )
delete

Broken assignment operator.

◆ order()

template<unsigned NSTEPS>
unsigned oomph::Steady< NSTEPS >::order ( ) const
inlinevirtual

Return the actual order of the scheme. Returning zero here – doesn't make much sense, though

Reimplemented from oomph::TimeStepper.

707  {
708  return 0;
709  }

◆ set_weights()

template<unsigned NSTEPS>
void oomph::Steady< NSTEPS >::set_weights ( )
inlinevirtual

Set weights.

Implements oomph::TimeStepper.

840  {
841  // Loop over higher derivatives
842  unsigned max_deriv = highest_derivative();
843  for (unsigned i = 0; i < max_deriv; i++)
844  {
845  for (unsigned j = 0; j < NSTEPS; j++)
846  {
847  Weight(i, j) = 0.0;
848  }
849  }
850 
851  // Zeroth derivative must return the value itself:
852  Weight(0, 0) = 1.0;
853  }
DenseMatrix< double > Weight
Storage for the weights associated with the timestepper.
Definition: timesteppers.h:237
unsigned highest_derivative() const
Highest order derivative that the scheme can compute.
Definition: timesteppers.h:318

References i, j, and ProblemParameters::Weight.

◆ shift_time_positions()

template<unsigned NSTEPS>
void oomph::Steady< NSTEPS >::shift_time_positions ( Node *const &  node_pt)
inlinevirtual

This function advances the time history of the positions at a node.

Implements oomph::TimeStepper.

814  {
815  // Find the number of coordinates
816  unsigned n_dim = node_pt->ndim();
817  // Find the number of position types
818  unsigned n_position_type = node_pt->nposition_type();
819 
820  // Loop over the positions
821  for (unsigned i = 0; i < n_dim; i++)
822  {
823  // If the position is not a copy
824  if (node_pt->position_is_a_copy(i) == false)
825  {
826  for (unsigned k = 0; k < n_position_type; k++)
827  {
828  // Loop over stored times, and set values to previous values
829  for (unsigned t = NSTEPS; t > 0; t--)
830  {
831  node_pt->x_gen(t, k, i) = node_pt->x_gen(t - 1, k, i);
832  }
833  }
834  }
835  }
836  }

References i, k, oomph::Node::ndim(), oomph::Node::nposition_type(), oomph::Node::position_is_a_copy(), plotPSD::t, and oomph::Node::x_gen().

◆ shift_time_values()

template<unsigned NSTEPS>
void oomph::Steady< NSTEPS >::shift_time_values ( Data *const &  data_pt)
inlinevirtual

This function updates the Data's time history so that we can advance to the next timestep. As for BDF schemes, we simply push the values backwards...

Implements oomph::TimeStepper.

792  {
793  // Find number of values stored
794  unsigned n_value = data_pt->nvalue();
795 
796  // Loop over the values
797  for (unsigned j = 0; j < n_value; j++)
798  {
799  // Set previous values to the previous value, if not a copy
800  if (data_pt->is_a_copy(j) == false)
801  {
802  // Loop over times, in reverse order
803  for (unsigned t = NSTEPS; t > 0; t--)
804  {
805  data_pt->set_value(t, j, data_pt->value(t - 1, j));
806  }
807  }
808  }
809  }

References oomph::Data::is_a_copy(), j, oomph::Data::nvalue(), oomph::Data::set_value(), plotPSD::t, and oomph::Data::value().

◆ weight()

template<unsigned NSTEPS>
double oomph::Steady< NSTEPS >::weight ( const unsigned i,
const unsigned j 
) const
inlinevirtual

Dummy: Access function for j-th weight for the i-th derivative.

Reimplemented from oomph::TimeStepper.

869  {
870  if ((i == 0) && (j == 0))
871  {
872  return One;
873  }
874  else
875  {
876  return Zero;
877  }
878  }
static double One
Static variable to hold the value 1.0.
Definition: timesteppers.h:882
static double Zero
Static variable to hold the value 0.0.
Definition: timesteppers.h:885

References i, j, and oomph::PseudoSolidHelper::Zero.

Member Data Documentation

◆ Dummy_time

template<unsigned NSTEPS>
Time oomph::Steady< NSTEPS >::Dummy_time
staticprivate

◆ One

template<unsigned NSTEPS>
double oomph::Steady< NSTEPS >::One = 1.0
staticprivate

Static variable to hold the value 1.0.

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

◆ Zero

template<unsigned NSTEPS>
double oomph::Steady< NSTEPS >::Zero = 0.0
staticprivate

Static variable to hold the value 0.0.


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