ElasticFishBackElement Class Reference
+ Inheritance diagram for ElasticFishBackElement:

Public Member Functions

 ElasticFishBackElement (const double &x_c, const double &y_c, const double &r)
 
virtual ~ElasticFishBackElement ()
 Destructor: More...
 
doublek_stiff ()
 "Stiffness" of the ring More...
 
doubleload ()
 "Load" acting on the ring 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...
 
void set_load_pt (Data *load_pt)
 
- 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::Circle
 Circle (const double &x_c, const double &y_c, const double &r)
 Constructor: Pass x and y-coords of centre and radius (all pinned) More...
 
 Circle (const double &x_c, const double &y_c, const double &r, TimeStepper *time_stepper_pt)
 
 Circle (const Vector< Data * > &geom_data_pt)
 
 Circle (const Circle &dummy)=delete
 Broken copy constructor. More...
 
void operator= (const Circle &)=delete
 Broken assignment operator. More...
 
virtual ~Circle ()
 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
 External index of the load object. 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::Circle
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...
 
bool Is_time_dependent
 Genuine time-dependence? 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

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Fish back as a GeneralisedElement: Circular ring whose position is given by

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

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

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

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

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

◆ ElasticFishBackElement()

ElasticFishBackElement::ElasticFishBackElement ( 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.

96  : Circle(x_c,y_c,r), K_stiff(1.0)
97  {
98  // Geometric Data for the GeomObject has been setup (and pinned) in
99  // constructor for geometric object. Now free the y-position
100  // of the centre because we want to determine it as an unknown
101  Geom_data_pt[0]->unpin(1);
102 
103  // The geometric data is internal to the element -- we copy the pointers
104  // to the element's internal data to ensure that any unknown values
105  // of geometric data are given global equation numbers.
106  unsigned n_geom_data=Geom_data_pt.size();
107  for (unsigned i=0;i<n_geom_data;i++)
109 
110  // Change cleanup responsibilities: The GeomData will now be killed
111  // by the GeneralisedElement when it wipes its internal Data
112  Must_clean_up=false;
113  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
double K_stiff
Stiffness of the ring's "elastic" support.
Definition: poisson/elastic_poisson/elastic_poisson.cc:219
double & y_c()
Access function to y-coordinate of centre of circle.
Definition: geom_objects.h:1083
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
Definition: geom_objects.h:1109
bool Must_clean_up
Do I need to clean up?
Definition: geom_objects.h:1112
double & x_c()
Access function to x-coordinate of centre of circle.
Definition: geom_objects.h:1077
Circle(const double &x_c, const double &y_c, const double &r)
Constructor: Pass x and y-coords of centre and radius (all pinned)
Definition: geom_objects.h:876
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:62
r
Definition: UniformPSDSelfTest.py:20

References i.

◆ ~ElasticFishBackElement()

virtual ElasticFishBackElement::~ElasticFishBackElement ( )
inlinevirtual

Destructor:

118  {
119  // The GeomObject's GeomData is mirrored in the element's
120  // Internal Data and therefore gets wiped in the
121  // destructor of GeneralisedElement --> No need to kill it here
122  }

Member Function Documentation

◆ fill_in_generic_residual_contribution()

void ElasticFishBackElement::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)

188  {
189  //Find out how may dofs there are in the element
190  unsigned n_dof = ndof();
191  //If there are no freedoms then return immediately
192  if (n_dof==0) return;
193 
194  // Pseudo-elastic force balance to determine the position of the
195  // ring's centre for a given load.
196  residuals[0]=load()-K_stiff*y_c();
197 
198  // Work out Jacobian:
199  if (flag)
200  {
201  // Derivative of residual w.r.t. the internal dof, i.e. the vertical
202  // position of the ring's centre: d residual[0]/d y_c
203  jacobian(0,0) = -K_stiff;
204 
205 
206  // Derivative with respect to external dof, i.e. the applied
207  // load: d residual[0]/d load -- but only if the load is an unknown
208  if (n_dof==2)
209  {
210  jacobian(0,1) = 1.0;
211  }
212  }
213  }
double & load()
"Load" acting on the ring
Definition: poisson/elastic_poisson/elastic_poisson.cc:128
unsigned ndof() const
Return the number of equations/dofs in the element.
Definition: elements.h:835

References load().

◆ get_jacobian()

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

Compute element residual Vector and element Jacobian matrix (wrapper)

Reimplemented from oomph::GeneralisedElement.

146  {
147  //Zero the residuals vector
148  residuals.initialise(0.0);
149  //Zero the jacobian matrix
150  jacobian.initialise(0.0);
151  //Call the generic routine with the flag set to 1
152  fill_in_generic_residual_contribution(residuals,jacobian,1);
153  }
void fill_in_generic_residual_contribution(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Definition: poisson/elastic_poisson/elastic_poisson.cc:185
void initialise(const T &val)
Initialize all values in the matrix to val.
Definition: matrices.h:514
void initialise(const _Tp &__value)
Iterate over all values and set to the desired value.
Definition: oomph-lib/src/generic/Vector.h:167

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

◆ get_residuals()

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

Compute element residual vector (wrapper)

Reimplemented from oomph::GeneralisedElement.

132  {
133  //Zero the residuals vector
134  residuals.initialise(0.0);
135  //Create a dummy matrix
136  DenseMatrix<double> dummy(1);
137 
138  //Call the generic residuals function with flag set to 0
139  fill_in_generic_residual_contribution(residuals,dummy,0);
140  }

References oomph::Vector< _Tp >::initialise().

◆ k_stiff()

double& ElasticFishBackElement::k_stiff ( )
inline

"Stiffness" of the ring

125 {return K_stiff;}

◆ load()

double& ElasticFishBackElement::load ( )
inline

"Load" acting on the ring

128 {return *(external_data_pt(0)->value_pt(0));}
double * value_pt(const unsigned &i) const
Definition: nodes.h:324
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
Definition: elements.h:659

◆ set_load_pt()

void ElasticFishBackElement::set_load_pt ( Data load_pt)
inline

Set pointer to Data object that specifies the "load" on the fish back

158  {
159 #ifdef PARANOID
160  if (load_pt->nvalue()!=1)
161  {
162  std::ostringstream error_stream;
163  error_stream << "The data object that stores the load on the fish back's"
164  << std::endl
165  << "should only contain a single data value\n"
166  << "This one contains " << load_pt->nvalue() << std::endl;
167 
168  throw OomphLibError(error_stream.str(),
171  }
172 #endif
173  // Vector has been created (and its one and only entry initialised to
174  // NULL) in the constructor
176  }
unsigned External_load_index
External index of the load object.
Definition: poisson/elastic_poisson/elastic_poisson.cc:222
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:307
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::Data::nvalue(), OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.

Member Data Documentation

◆ External_load_index

unsigned ElasticFishBackElement::External_load_index
private

External index of the load object.

◆ K_stiff

double ElasticFishBackElement::K_stiff
private

Stiffness of the ring's "elastic" support.


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