oomph::ContinuationStorageScheme Class Reference

#include <generalised_timesteppers.h>

+ Inheritance diagram for oomph::ContinuationStorageScheme:

Public Member Functions

 ContinuationStorageScheme ()
 
 ContinuationStorageScheme (const ContinuationStorageScheme &)=delete
 Broken copy constructor. More...
 
void modify_storage (GeneralisedTimeStepper *const &time_stepper_pt)
 Modify the scheme based on the underlying timestepper. More...
 
void operator= (const ContinuationStorageScheme &)=delete
 Broken assignment operator. More...
 
unsigned order () const
 
void undo_make_steady ()
 This is a steady scheme, so you can't do this. More...
 
void assign_initial_values_impulsive (Data *const &data_pt)
 
void assign_initial_positions_impulsive (Node *const &node_pt)
 
void shift_time_values (Data *const &data_pt)
 Broken shifting of time values. More...
 
void shift_time_positions (Node *const &node_pt)
 Broken shifting of time positions. More...
 
void set_weights ()
 Set the weights (Do nothing) 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...
 
void set_consistent_pinned_values (Data *const &data_pt)
 
void set_consistent_pinned_positions (Node *const &node_pt)
 
unsigned dof_derivative_offset ()
 
unsigned dof_current_offset ()
 
- Public Member Functions inherited from oomph::GeneralisedTimeStepper
unsigned ndof_storage_entries () const
 Return the number of entries that correspond to dof storage. 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...
 
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 ()
 
virtual double weight (const unsigned &i, const unsigned &j) const
 Access function for j-th weight for the i-th derivative. More...
 
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)
 

Private Attributes

unsigned Dof_derivative_offset
 
unsigned Dof_current_offset
 

Additional Inherited Members

- Protected Member Functions inherited from oomph::GeneralisedTimeStepper
 GeneralisedTimeStepper (const unsigned &n_tstorage, const unsigned &max_deriv, const unsigned &ndof_storage_entries=1)
 
 GeneralisedTimeStepper ()
 Broken empty constructor. More...
 
 GeneralisedTimeStepper (const GeneralisedTimeStepper &)=delete
 Broken copy constructor. More...
 
void operator= (const GeneralisedTimeStepper &)=delete
 Broken assignment operator. More...
 
- Protected Attributes inherited from oomph::GeneralisedTimeStepper
unsigned Ndof_storage_entries
 
- 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

GeneralisedTimestepper used to store the arclength derivatives and pervious solutions required in continuation problems. The data is stored as auxilliary data in the (fake) TimeStepper so that spatial adaptivity will be handled automatically through our standard mechanisms. The adopted storage scheme is that the continuation derivatives will be stored at the first auxilliary value and the previous value will be the second auixilliary value

Constructor & Destructor Documentation

◆ ContinuationStorageScheme() [1/2]

oomph::ContinuationStorageScheme::ContinuationStorageScheme ( )
inline

Constructor for the case when we allow adaptive continuation It can evaulate up to second derivatives, but doesn't do anything the time-derivatives evaluate to zero.

113  : GeneralisedTimeStepper(3, 2),
116  {
117  Type = "ContinuationStorageScheme";
118  Is_steady = true;
119  }
unsigned Dof_current_offset
Definition: generalised_timesteppers.h:106
unsigned Dof_derivative_offset
Definition: generalised_timesteppers.h:103
GeneralisedTimeStepper()
Broken empty constructor.
Definition: generalised_timesteppers.h:71
std::string Type
Definition: timesteppers.h:241
bool Is_steady
Definition: timesteppers.h:251

References oomph::TimeStepper::Is_steady, and oomph::TimeStepper::Type.

◆ ContinuationStorageScheme() [2/2]

oomph::ContinuationStorageScheme::ContinuationStorageScheme ( const ContinuationStorageScheme )
delete

Broken copy constructor.

Member Function Documentation

◆ assign_initial_positions_impulsive()

void oomph::ContinuationStorageScheme::assign_initial_positions_impulsive ( Node *const &  node_pt)
inlinevirtual

Broken initialisation of the positions for the node corresponding to an impulsive start

Implements oomph::TimeStepper.

178  {
179  OomphLibWarning(
180  "Cannot perform impulsive start for ContinuationStorageScheme",
183  }
#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.

◆ assign_initial_values_impulsive()

void oomph::ContinuationStorageScheme::assign_initial_values_impulsive ( Data *const &  data_pt)
inlinevirtual

Broken initialisation the time-history for the Data values corresponding to an impulsive start.

Implements oomph::TimeStepper.

168  {
169  OomphLibWarning(
170  "Cannot perform impulsive start for ContinuationStorageScheme",
173  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ dof_current_offset()

unsigned oomph::ContinuationStorageScheme::dof_current_offset ( )
inline
323  {
324  return Dof_current_offset;
325  }

References Dof_current_offset.

◆ dof_derivative_offset()

unsigned oomph::ContinuationStorageScheme::dof_derivative_offset ( )
inline
317  {
318  return Dof_derivative_offset;
319  }

References Dof_derivative_offset.

◆ modify_storage()

void oomph::ContinuationStorageScheme::modify_storage ( GeneralisedTimeStepper *const &  time_stepper_pt)
inline

Modify the scheme based on the underlying timestepper.

127  {
128  // Get the number of "dofs" in the existing timestepper
129  this->Ndof_storage_entries = time_stepper_pt->ndof_storage_entries();
130  // Get the current amount of storage
131  unsigned n_tstorage = time_stepper_pt->ntstorage();
132 
133  // Find the offsets which is always relative to the number of dofs stored
134  // in the existing timestepper
135  Dof_derivative_offset = n_tstorage;
136  Dof_current_offset = n_tstorage + this->Ndof_storage_entries;
137 
138  // Set the new amount of storage twice the dofs to store parameter
139  // derivatives and initial values plus the original storage
140  unsigned n_new_tstorage = 2 * this->Ndof_storage_entries + n_tstorage;
141 
142  // Resize the weights accordingly
143  Weight.resize(3, n_new_tstorage, 0.0);
144  // Set the weight for the zero-th derivative which is always 1.0
145  Weight(0, 0) = 1.0;
146  }
void resize(const unsigned long &n)
Definition: matrices.h:498
unsigned Ndof_storage_entries
Definition: generalised_timesteppers.h:54
DenseMatrix< double > Weight
Storage for the weights associated with the timestepper.
Definition: timesteppers.h:237

References Dof_current_offset, Dof_derivative_offset, oomph::GeneralisedTimeStepper::Ndof_storage_entries, oomph::GeneralisedTimeStepper::ndof_storage_entries(), oomph::TimeStepper::ntstorage(), oomph::DenseMatrix< T >::resize(), and oomph::TimeStepper::Weight.

◆ ndt()

unsigned oomph::ContinuationStorageScheme::ndt ( ) const
inlinevirtual

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

Implements oomph::TimeStepper.

214  {
215  return 0;
216  }

◆ nprev_values()

unsigned oomph::ContinuationStorageScheme::nprev_values ( ) const
inlinevirtual

Number of previous values available.

Implements oomph::TimeStepper.

208  {
209  return 0;
210  }

◆ operator=()

void oomph::ContinuationStorageScheme::operator= ( const ContinuationStorageScheme )
delete

Broken assignment operator.

◆ order()

unsigned oomph::ContinuationStorageScheme::order ( ) const
inlinevirtual

Return the actual order of the scheme. It's a steady scheme so it's zero, but that doesn't really make sense.

Reimplemented from oomph::TimeStepper.

155  {
156  return 0;
157  }

◆ set_consistent_pinned_positions()

void oomph::ContinuationStorageScheme::set_consistent_pinned_positions ( Node *const &  node_pt)
inline

Set consistent values of the derivatives and current value when the Nodes position is pinned. This must be done by the "timestepper" because only it knows the local storage scheme

262  {
263  // Only need to do anything if this is a solid node
264  if (SolidNode* const solid_node_pt = dynamic_cast<SolidNode*>(node_pt))
265  {
266 #ifdef PARANOID
267  // If the data is not associated with the continuation time stepper then
268  // complain
269  if (this != node_pt->position_time_stepper_pt())
270  {
271  std::ostringstream error_stream;
272  error_stream
273  << "Node object " << node_pt << " has position timestepper of type "
274  << typeid(node_pt->position_time_stepper_pt()).name() << "\n"
275  << "Please set the Node's position timestepper to be a "
276  << "ContinuationStorageScheme before calling this function\n";
277  throw OomphLibError(error_stream.str(),
280  }
281 #endif
282 
283  // Find the number of coordinates
284  const unsigned n_dim = solid_node_pt->ndim();
285  // Find the number of position types
286  const unsigned n_position_type = solid_node_pt->nposition_type();
287 
288  // Loop over physical coordinates
289  for (unsigned i = 0; i < n_dim; i++)
290  {
291  // Set the appropriate values if it's not a copy
292  if (solid_node_pt->position_is_a_copy(i) == false)
293  {
294  // Loop over generalised dofs
295  for (unsigned k = 0; k < n_position_type; k++)
296  {
297  // If it's pinned then set the "history" values
298  if (solid_node_pt->position_is_pinned(k, i))
299  {
300  for (unsigned t = 0; t < Ndof_storage_entries; t++)
301  {
302  // Set the derivative to 0
303  solid_node_pt->x_gen(Dof_derivative_offset + t, k, i) = 0.0;
304  // Set the stored current value to the present value
305  solid_node_pt->x_gen(Dof_current_offset + t, k, i) =
306  solid_node_pt->x_gen(t, k, i);
307  }
308  }
309  }
310  }
311  }
312  }
313  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
char char char int int * k
Definition: level2_impl.h:374
string name
Definition: plotDoE.py:33
t
Definition: plotPSD.py:36

References Dof_current_offset, Dof_derivative_offset, i, k, plotDoE::name, oomph::GeneralisedTimeStepper::Ndof_storage_entries, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::Node::position_time_stepper_pt(), and plotPSD::t.

Referenced by oomph::Mesh::set_consistent_pinned_values_for_continuation().

◆ set_consistent_pinned_values()

void oomph::ContinuationStorageScheme::set_consistent_pinned_values ( Data *const &  data_pt)
inline

Set consistent values of the derivatives and current value when the data is pinned. This must be done by the "timestepper" because only it knows the local storage scheme

222  {
223 #ifdef PARANOID
224  // If the data is not associated with the continuation time stepper then
225  // complain
226  if (this != data_pt->time_stepper_pt())
227  {
228  std::ostringstream error_stream;
229  error_stream
230  << "Data object " << data_pt << " has timestepper of type "
231  << typeid(data_pt->time_stepper_pt()).name() << "\n"
232  << "Please set the data's timestepper to be a "
233  << "ContinuationStorageScheme before calling this function\n";
234  throw OomphLibError(
235  error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
236  }
237 #endif
238 
239  // Loop over the values in the data object
240  const unsigned n_value = data_pt->nvalue();
241  for (unsigned i = 0; i < n_value; ++i)
242  {
243  // Only bother to do anything if the value is pinned and not a copy
244  if (data_pt->is_pinned(i) && (data_pt->is_a_copy(i) == false))
245  {
246  // ASSUMPTION storage is always at the "front"
247  for (unsigned t = 0; t < this->Ndof_storage_entries; t++)
248  {
249  // Set the stored derivatve to be zero
250  data_pt->set_value(Dof_derivative_offset + t, i, 0.0);
251  // Set the stored current value to be the same as the present value
252  data_pt->set_value(Dof_current_offset + t, i, data_pt->value(t, i));
253  }
254  }
255  }
256  }

References Dof_current_offset, Dof_derivative_offset, i, oomph::Data::is_a_copy(), oomph::Data::is_pinned(), plotDoE::name, oomph::GeneralisedTimeStepper::Ndof_storage_entries, oomph::Data::nvalue(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::Data::set_value(), plotPSD::t, oomph::Data::time_stepper_pt(), and oomph::Data::value().

Referenced by oomph::SpineMesh::set_consistent_pinned_spine_values_for_continuation(), oomph::Problem::set_consistent_pinned_values_for_continuation(), and oomph::Mesh::set_consistent_pinned_values_for_continuation().

◆ set_weights()

void oomph::ContinuationStorageScheme::set_weights ( )
inlinevirtual

Set the weights (Do nothing)

Implements oomph::TimeStepper.

204 {}

◆ shift_time_positions()

void oomph::ContinuationStorageScheme::shift_time_positions ( Node *const &  node_pt)
inlinevirtual

Broken shifting of time positions.

Implements oomph::TimeStepper.

196  {
197  throw OomphLibError(
198  "Cannot shift time positions forContinuationStorageScheme",
201  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ shift_time_values()

void oomph::ContinuationStorageScheme::shift_time_values ( Data *const &  data_pt)
inlinevirtual

Broken shifting of time values.

Implements oomph::TimeStepper.

187  {
188  throw OomphLibError(
189  "Cannot shift time values forContinuationStorageScheme",
192  }

References OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

◆ undo_make_steady()

void oomph::ContinuationStorageScheme::undo_make_steady ( )
inlinevirtual

This is a steady scheme, so you can't do this.

Reimplemented from oomph::TimeStepper.

161  {
162  Is_steady = true;
163  }

References oomph::TimeStepper::Is_steady.

Member Data Documentation

◆ Dof_current_offset

unsigned oomph::ContinuationStorageScheme::Dof_current_offset
private

◆ Dof_derivative_offset

unsigned oomph::ContinuationStorageScheme::Dof_derivative_offset
private

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