oomph::ElasticallySupportedRingElement Class Reference

#include <circle_as_generalised_element.h>

+ Inheritance diagram for oomph::ElasticallySupportedRingElement:

Public Member Functions

 ElasticallySupportedRingElement (const double &x_c, const double &y_c, const double &r)
 
virtual ~ElasticallySupportedRingElement ()
 Destructor: More...
 
void set_load_pt (Data *load_pt)
 
double load ()
 "Load" acting on the ring More...
 
doublek_stiff ()
 Access function for the spring stiffness. More...
 
void pin_yc ()
 Pin the vertical displacement. More...
 
void unpin_yc ()
 Unpin the vertical displacement. More...
 
void get_residuals (Vector< double > &residuals)
 Compute element residual vector (wrapper) More...
 
void get_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 Compute element residual Vector and element Jacobian matrix (wrapper) More...
 
- Public Member Functions inherited from oomph::GeneralisedElement
 GeneralisedElement ()
 Constructor: Initialise all pointers and all values to zero. More...
 
virtual ~GeneralisedElement ()
 Virtual destructor to clean up any memory allocated by the object. More...
 
 GeneralisedElement (const GeneralisedElement &)=delete
 Broken copy constructor. More...
 
void operator= (const GeneralisedElement &)=delete
 Broken assignment operator. More...
 
Data *& internal_data_pt (const unsigned &i)
 Return a pointer to i-th internal data object. More...
 
Data *const & internal_data_pt (const unsigned &i) const
 Return a pointer to i-th internal data object (const version) More...
 
Data *& external_data_pt (const unsigned &i)
 Return a pointer to i-th external data object. More...
 
Data *const & external_data_pt (const unsigned &i) const
 Return a pointer to i-th external data object (const version) More...
 
unsigned long eqn_number (const unsigned &ieqn_local) const
 
int local_eqn_number (const unsigned long &ieqn_global) const
 
unsigned add_external_data (Data *const &data_pt, const bool &fd=true)
 
bool external_data_fd (const unsigned &i) const
 
void exclude_external_data_fd (const unsigned &i)
 
void include_external_data_fd (const unsigned &i)
 
void flush_external_data ()
 Flush all external data. More...
 
void flush_external_data (Data *const &data_pt)
 Flush the object addressed by data_pt from the external data array. More...
 
unsigned ninternal_data () const
 Return the number of internal data objects. More...
 
unsigned nexternal_data () const
 Return the number of external data objects. More...
 
unsigned ndof () const
 Return the number of equations/dofs in the element. More...
 
void dof_vector (const unsigned &t, Vector< double > &dof)
 Return the vector of dof values at time level t. More...
 
void dof_pt_vector (Vector< double * > &dof_pt)
 Return the vector of pointers to dof values. More...
 
void set_internal_data_time_stepper (const unsigned &i, TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 
void assign_internal_eqn_numbers (unsigned long &global_number, Vector< double * > &Dof_pt)
 
void describe_dofs (std::ostream &out, const std::string &current_string) const
 
virtual void describe_local_dofs (std::ostream &out, const std::string &current_string) const
 
void add_internal_value_pt_to_map (std::map< unsigned, double * > &map_of_value_pt)
 
virtual void assign_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void complete_setup_of_dependencies ()
 
virtual void get_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void get_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
virtual void get_dresiduals_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam)
 
virtual void get_djacobian_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
 
virtual void get_djacobian_and_dmass_matrix_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
 
virtual void get_hessian_vector_products (Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
 
virtual void get_inner_products (Vector< std::pair< unsigned, unsigned >> const &history_index, Vector< double > &inner_product)
 
virtual void get_inner_product_vectors (Vector< unsigned > const &history_index, Vector< Vector< double >> &inner_product_vector)
 
virtual unsigned self_test ()
 
virtual void compute_norm (Vector< double > &norm)
 
virtual void compute_norm (double &norm)
 
virtual unsigned ndof_types () const
 
virtual void get_dof_numbers_for_unknowns (std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
 
- Public Member Functions inherited from oomph::GeneralCircle
 GeneralCircle (const double &x_c, const double &y_c, const double &r)
 Constructor: Pass x and y-coords of centre and radius (all pinned) More...
 
 GeneralCircle (Data *geom_data_pt)
 
virtual ~GeneralCircle ()
 Destructor: Clean up if necessary. More...
 
void position (const Vector< double > &zeta, Vector< double > &r) const
 Position Vector at Lagrangian coordinate zeta. More...
 
void position (const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
 
doublex_c ()
 Access function to x-coordinate of centre of circle. More...
 
doubley_c ()
 Access function to y-coordinate of centre of circle. More...
 
doubleR ()
 Access function to radius of circle. More...
 
unsigned ngeom_data () const
 How many items of Data does the shape of the object depend on? More...
 
Datageom_data_pt (const unsigned &j)
 
- Public Member Functions inherited from oomph::GeomObject
 GeomObject ()
 Default constructor. More...
 
 GeomObject (const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim)
 
 GeomObject (const unsigned &nlagrangian, const unsigned &ndim, TimeStepper *time_stepper_pt)
 
 GeomObject (const GeomObject &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const GeomObject &)=delete
 Broken assignment operator. More...
 
virtual ~GeomObject ()
 (Empty) destructor More...
 
unsigned nlagrangian () const
 Access function to # of Lagrangian coordinates. More...
 
unsigned ndim () const
 Access function to # of Eulerian coordinates. More...
 
void set_nlagrangian_and_ndim (const unsigned &n_lagrangian, const unsigned &n_dim)
 Set # of Lagrangian and Eulerian coordinates. More...
 
TimeStepper *& time_stepper_pt ()
 
TimeSteppertime_stepper_pt () const
 
virtual void position (const double &t, const Vector< double > &zeta, Vector< double > &r) const
 
virtual void dposition_dt (const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
 
virtual void dposition (const Vector< double > &zeta, DenseMatrix< double > &drdzeta) const
 
virtual void d2position (const Vector< double > &zeta, RankThreeTensor< double > &ddrdzeta) const
 
virtual void d2position (const Vector< double > &zeta, Vector< double > &r, DenseMatrix< double > &drdzeta, RankThreeTensor< double > &ddrdzeta) const
 
virtual void locate_zeta (const Vector< double > &zeta, GeomObject *&sub_geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
 
virtual void interpolated_zeta (const Vector< double > &s, Vector< double > &zeta) const
 

Protected Member Functions

void fill_in_generic_residual_contribution (Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
 
- Protected Member Functions inherited from oomph::GeneralisedElement
unsigned add_internal_data (Data *const &data_pt, const bool &fd=true)
 
bool internal_data_fd (const unsigned &i) const
 
void exclude_internal_data_fd (const unsigned &i)
 
void include_internal_data_fd (const unsigned &i)
 
void clear_global_eqn_numbers ()
 
void add_global_eqn_numbers (std::deque< unsigned long > const &global_eqn_numbers, std::deque< double * > const &global_dof_pt)
 
virtual void assign_internal_and_external_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void assign_all_generic_local_eqn_numbers (const bool &store_local_dof_pt)
 
virtual void assign_additional_local_eqn_numbers ()
 
int internal_local_eqn (const unsigned &i, const unsigned &j) const
 
int external_local_eqn (const unsigned &i, const unsigned &j)
 
virtual void fill_in_contribution_to_residuals (Vector< double > &residuals)
 
void fill_in_jacobian_from_internal_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_internal_by_fd (DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_external_by_fd (Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
void fill_in_jacobian_from_external_by_fd (DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
 
virtual void update_before_internal_fd ()
 
virtual void reset_after_internal_fd ()
 
virtual void update_in_internal_fd (const unsigned &i)
 
virtual void reset_in_internal_fd (const unsigned &i)
 
virtual void update_before_external_fd ()
 
virtual void reset_after_external_fd ()
 
virtual void update_in_external_fd (const unsigned &i)
 
virtual void reset_in_external_fd (const unsigned &i)
 
virtual void fill_in_contribution_to_jacobian (Vector< double > &residuals, DenseMatrix< double > &jacobian)
 
virtual void fill_in_contribution_to_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &mass_matrix)
 
virtual void fill_in_contribution_to_jacobian_and_mass_matrix (Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
 
virtual void fill_in_contribution_to_dresiduals_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam)
 
virtual void fill_in_contribution_to_djacobian_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam)
 
virtual void fill_in_contribution_to_djacobian_and_dmass_matrix_dparameter (double *const &parameter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam)
 
virtual void fill_in_contribution_to_hessian_vector_products (Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
 
virtual void fill_in_contribution_to_inner_products (Vector< std::pair< unsigned, unsigned >> const &history_index, Vector< double > &inner_product)
 
virtual void fill_in_contribution_to_inner_product_vectors (Vector< unsigned > const &history_index, Vector< Vector< double >> &inner_product_vector)
 

Private Attributes

double K_stiff
 Stiffness of the ring's "elastic" support. More...
 
unsigned External_load_index
 
unsigned Internal_geometric_data_index
 
bool Load_data_has_been_set
 Flag to indicate that load data has been set. More...
 

Additional Inherited Members

- Static Public Attributes inherited from oomph::GeneralisedElement
static bool Suppress_warning_about_repeated_internal_data
 
static bool Suppress_warning_about_repeated_external_data = true
 
static double Default_fd_jacobian_step = 1.0e-8
 
- Protected Attributes inherited from oomph::GeneralCircle
Vector< Data * > Geom_data_pt
 Vector of pointers to Data items that affects the object's shape. More...
 
bool Must_clean_up
 Do I need to clean up? More...
 
- Protected Attributes inherited from oomph::GeomObject
unsigned NLagrangian
 Number of Lagrangian (intrinsic) coordinates. More...
 
unsigned Ndim
 Number of Eulerian coordinates. More...
 
TimeStepperGeom_object_time_stepper_pt
 
- Static Protected Attributes inherited from oomph::GeneralisedElement
static DenseMatrix< doubleDummy_matrix
 
static std::deque< double * > Dof_pt_deque
 

Detailed Description

/////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// GeneralCircle "upgraded" to a GeneralisedElement: Circular ring whose position is given by

\[ x = X_c + R \cos(\zeta) \]

\[ y = Y_c + R \sin(\zeta) \]

The ring's vertical position \( Y_c \) is determined by "pseudo elasticity":

\[ 0 = f_{load} - Y_c \ k_{stiff} \]

This simulates the case where the centre of the ring is mounted on an elastic spring of stiffness \( k_{stiff} \) and loaded by the force \( f_{load}. \) The "load" is specified by the Data object load_pt().

Constructor & Destructor Documentation

◆ ElasticallySupportedRingElement()

oomph::ElasticallySupportedRingElement::ElasticallySupportedRingElement ( const double x_c,
const double y_c,
const double r 
)
inline

Constructor: Build ring from doubles that describe the geometry: x and y positions of centre and the radius. Initialise stiffness to 1.0. By default, no load is set.

65  :
67  {
68  // The geometric data is internal to the element -- we copy the pointers
69  // to the GeomObject's geometric data to the element's internal
70  // data to ensure that any unknown values of geometric data are
71  // given global equation numbers. The add_internal_data(...)
72  // function returns the index by which the added Data item
73  // is accessible from internal_data_pt(...).
75 
76  // Geometric Data for the GeomObject has been set up (and pinned) in
77  // constructor for geometric object. Now free the y-position
78  // of the centre because we want to determine it as an unknown
80 
81  // Change cleanup responsibilities: The GeomData will now be killed
82  // by the GeneralisedElement when it wipes its internal Data
83  Must_clean_up=false;
84  }
void unpin(const unsigned &i)
Unpin the i-th stored variable.
Definition: nodes.h:391
unsigned Internal_geometric_data_index
Definition: circle_as_generalised_element.h:266
bool Load_data_has_been_set
Flag to indicate that load data has been set.
Definition: circle_as_generalised_element.h:269
double K_stiff
Stiffness of the ring's "elastic" support.
Definition: circle_as_generalised_element.h:258
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
Definition: circle.h:224
bool Must_clean_up
Do I need to clean up?
Definition: circle.h:227
double & x_c()
Access function to x-coordinate of centre of circle.
Definition: circle.h:205
GeneralCircle(const double &x_c, const double &y_c, const double &r)
Constructor: Pass x and y-coords of centre and radius (all pinned)
Definition: circle.h:101
double & y_c()
Access function to y-coordinate of centre of circle.
Definition: circle.h:208
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:622
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:62
r
Definition: UniformPSDSelfTest.py:20

References oomph::GeneralisedElement::add_internal_data(), oomph::GeneralCircle::Geom_data_pt, oomph::GeneralisedElement::internal_data_pt(), Internal_geometric_data_index, oomph::GeneralCircle::Must_clean_up, and oomph::Data::unpin().

◆ ~ElasticallySupportedRingElement()

virtual oomph::ElasticallySupportedRingElement::~ElasticallySupportedRingElement ( )
inlinevirtual

Destructor:

89  {
90  // The GeomObject's GeomData is mirrored in the element's
91  // Internal Data and therefore gets wiped in the
92  // destructor of GeneralisedElement --> No need to kill it here
93  }

Member Function Documentation

◆ fill_in_generic_residual_contribution()

void oomph::ElasticallySupportedRingElement::fill_in_generic_residual_contribution ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian,
unsigned  flag 
)
inlineprotected

Compute element residual Vector (only if flag=0) and also the element Jacobian matrix (if flag=1)

200  {
201  //Find out how may dofs there are in the element
202  unsigned n_dof = ndof();
203  //If everything is pinned return straight away
204  if (n_dof==0) return;
205 
206  // Pseudo-elastic force balance to determine the position of the
207  // ring's centre for a given load.
208 
209  // What's the local equation number of the force balance equation
210  // [It's the equation that "determines" the value of the internal
211  // dof, y_c, which is stored as the second value of the one-and-only
212  // internal data object in this element]
213  int local_eqn_number_for_yc =
215 
216  // Add residual to appropriate entry in the element's residual
217  // vector:
218  residuals[local_eqn_number_for_yc]=load()-K_stiff*y_c();
219 
220  // Work out Jacobian:
221  if (flag)
222  {
223  // Derivative of residual w.r.t. the internal dof, i.e. the vertical
224  // position of the ring's centre: d residual[0]/d y_c
225  jacobian(local_eqn_number_for_yc,local_eqn_number_for_yc) = -K_stiff;
226 
227 
228  // Derivative with respect to external dof, i.e. the applied
229  // load: d residual[0]/d load -- but only if the load is an unknown
230  if (n_dof==2)
231  {
232  // What's the local equation number of the load parameter?
233  // It's stored as the 0th value in the the element's
234  // one-and-only external data item:
235  int local_eqn_number_for_load =
237 
238 #ifdef PARANOID
239  if (local_eqn_number_for_load<0)
240  {
241  throw OomphLibError(
242  "Load is pinned and yet n_dof=2?\n This is very fishy!\n",
245  }
246 #endif
247 
248  // Add entry into element Jacobian
249  jacobian(local_eqn_number_for_yc,local_eqn_number_for_load) = 1.0;
250  }
251  }
252  } // end of get_residuals_generic(...)
double load()
"Load" acting on the ring
Definition: circle_as_generalised_element.h:128
unsigned External_load_index
Definition: circle_as_generalised_element.h:262
unsigned ndof() const
Return the number of equations/dofs in the element.
Definition: elements.h:835
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Definition: elements.h:267
int external_local_eqn(const unsigned &i, const unsigned &j)
Definition: elements.h:311
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References External_load_index, oomph::GeneralisedElement::external_local_eqn(), Internal_geometric_data_index, oomph::GeneralisedElement::internal_local_eqn(), K_stiff, load(), oomph::GeneralisedElement::ndof(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::GeneralCircle::y_c().

Referenced by get_jacobian(), and get_residuals().

◆ get_jacobian()

void oomph::ElasticallySupportedRingElement::get_jacobian ( Vector< double > &  residuals,
DenseMatrix< double > &  jacobian 
)
inlinevirtual

Compute element residual Vector and element Jacobian matrix (wrapper)

Reimplemented from oomph::GeneralisedElement.

181  {
182  //Initialise residuals to zero
183  residuals.initialise(0.0);
184  //Initialise the jacobian matrix to zero
185  jacobian.initialise(0.0);
186  //Call the generic routine with the flag set to 1
187  fill_in_generic_residual_contribution(residuals,jacobian,1);
188 
189  } // end of get_jacobian(...)
void initialise(const T &val)
Initialize all values in the matrix to val.
Definition: matrices.h:514
void fill_in_generic_residual_contribution(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Definition: circle_as_generalised_element.h:197
void initialise(const _Tp &__value)
Iterate over all values and set to the desired value.
Definition: oomph-lib/src/generic/Vector.h:167

References fill_in_generic_residual_contribution(), oomph::Vector< _Tp >::initialise(), and oomph::DenseMatrix< T >::initialise().

◆ get_residuals()

void oomph::ElasticallySupportedRingElement::get_residuals ( Vector< double > &  residuals)
inlinevirtual

Compute element residual vector (wrapper)

Reimplemented from oomph::GeneralisedElement.

168  {
169  //Initialise residuals to zero
170  residuals.initialise(0.0);
171  //Create a dummy matrix
172  DenseMatrix<double> dummy(1);
173  //Call the generic residuals function with flag set to 0
174  fill_in_generic_residual_contribution(residuals,dummy,0);
175  }

References fill_in_generic_residual_contribution(), and oomph::Vector< _Tp >::initialise().

◆ k_stiff()

double& oomph::ElasticallySupportedRingElement::k_stiff ( )
inline

Access function for the spring stiffness.

144 {return K_stiff;}

References K_stiff.

Referenced by GeomObjectAsGeneralisedElementProblem::GeomObjectAsGeneralisedElementProblem().

◆ load()

double oomph::ElasticallySupportedRingElement::load ( )
inline

"Load" acting on the ring

129  {
130  // Return the load if it has been set
132  {
134  }
135  // ...otherwise return zero load
136  else
137  {
138  return 0.0;
139  }
140  } // end of load()
double value(const unsigned &i) const
Definition: nodes.h:293
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
Definition: elements.h:659

References oomph::GeneralisedElement::external_data_pt(), External_load_index, Load_data_has_been_set, and oomph::Data::value().

Referenced by fill_in_generic_residual_contribution().

◆ pin_yc()

void oomph::ElasticallySupportedRingElement::pin_yc ( )
inline

Pin the vertical displacement.

149  {
150  // Vertical position of centre is stored as value 1 in the
151  // element's one and only internal Data object.
153  }
void pin(const unsigned &i)
Pin the i-th stored variable.
Definition: nodes.h:385

References oomph::GeneralisedElement::internal_data_pt(), Internal_geometric_data_index, and oomph::Data::pin().

◆ set_load_pt()

void oomph::ElasticallySupportedRingElement::set_load_pt ( Data load_pt)
inline

Set pointer to Data object that specifies the "load" on the ElasticallySupportedRingElement

99  {
100 #ifdef PARANOID
101  if (load_pt->nvalue()!=1)
102  {
103  std::ostringstream error_stream;
104  error_stream << "The data object that stores the load on the "
105  << "ElasticallySupportedRingElement\n"
106  << "should only contain a single data value\n"
107  << "This one contains " << load_pt->nvalue() << std::endl;
108 
109  throw OomphLibError(error_stream.str(),
112  }
113 #endif
114 
115  // Add load to the element's external data and store
116  // its index within that storage scheme: Following this assignment,
117  // the load Data is accessible from
118  // GeneralisedElement::external_data_pt(External_load_index)
120 
121  // Load has now been set
123 
124  } // end of set_load_pt(...)
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:307

References oomph::GeneralisedElement::add_external_data(), External_load_index, Load_data_has_been_set, oomph::Data::nvalue(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

Referenced by GeomObjectAsGeneralisedElementProblem::GeomObjectAsGeneralisedElementProblem().

◆ unpin_yc()

void oomph::ElasticallySupportedRingElement::unpin_yc ( )
inline

Unpin the vertical displacement.

158  {
159  // Vertical position of centre is stored as value 1 in the
160  // element's one and only internal Data object.
162 
163  } // end of unpin_yc()

References oomph::GeneralisedElement::internal_data_pt(), Internal_geometric_data_index, and oomph::Data::unpin().

Member Data Documentation

◆ External_load_index

unsigned oomph::ElasticallySupportedRingElement::External_load_index
private

Index of the location of the load Data in the element's array of external data

Referenced by fill_in_generic_residual_contribution(), load(), and set_load_pt().

◆ Internal_geometric_data_index

unsigned oomph::ElasticallySupportedRingElement::Internal_geometric_data_index
private

Index of the location of the geometric Data in the element's array of internal data

Referenced by ElasticallySupportedRingElement(), fill_in_generic_residual_contribution(), pin_yc(), and unpin_yc().

◆ K_stiff

double oomph::ElasticallySupportedRingElement::K_stiff
private

Stiffness of the ring's "elastic" support.

Referenced by fill_in_generic_residual_contribution(), and k_stiff().

◆ Load_data_has_been_set

bool oomph::ElasticallySupportedRingElement::Load_data_has_been_set
private

Flag to indicate that load data has been set.

Referenced by load(), and set_load_pt().


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