26 #ifndef OOMPH_PSEUDO_BUCKLING_RING_HEADER
27 #define OOMPH_PSEUDO_BUCKLING_RING_HEADER
32 #include <oomph-lib-config.h>
62 "Don't call empty constructor for PseudoBucklingRing!",
63 OOMPH_CURRENT_FUNCTION,
64 OOMPH_EXCEPTION_LOCATION);
85 std::ostringstream error_message;
86 error_message <<
"geom_data_pt should be of size 1, but is of size"
90 OOMPH_CURRENT_FUNCTION,
91 OOMPH_EXCEPTION_LOCATION);
95 std::ostringstream error_message;
96 error_message <<
"geom_data_pt[0] should have 5 values, but has"
100 OOMPH_CURRENT_FUNCTION,
101 OOMPH_EXCEPTION_LOCATION);
118 const unsigned n_buckl,
135 for (
unsigned itime = 0; itime <= n_time; itime++)
167 const unsigned& n_buckl,
168 const unsigned& imode,
173 double K1 = (pow(
double(n_buckl), 2) + 1.0) *
174 (1.0 / 12.0 * pow(
double(n_buckl), 2) * pow(HoR, 2) + 1.0);
177 1.0 / 12.0 * pow(HoR, 2) * pow(
double(n_buckl), 2) *
178 pow((pow(
double(n_buckl), 2) - 1.0), 2) /
179 (pow((pow(
double(n_buckl), 2) + 1.0), 2) *
180 pow((1.0 / 12.0 * pow(
double(n_buckl), 2) * pow(HoR, 2) + 1.0), 2));
183 double omega1 = sqrt(0.5 * K1 * (1.0 + sqrt(1.0 - 4 * K2oK1sq)));
184 double omega2 = sqrt(0.5 * K1 * (1.0 - sqrt(1.0 - 4 * K2oK1sq)));
189 (1.0 / 12.0 * pow(
double(n_buckl), 2) * pow(HoR, 2) + 1.0)) /
191 pow(
double(n_buckl), 2) * (1.0 / 12.0 * pow(HoR, 2) + 1.0));
195 (1.0 / 12.0 * pow(
double(n_buckl), 2) * pow(HoR, 2) + 1.0) /
197 pow(
double(n_buckl), 2) * (1.0 / 12.0 * pow(HoR, 2) + 1.0));
218 oomph_info <<
"wrong imode " << imode << std::endl;
238 for (
unsigned itime = 0; itime <= n_time; itime++)
347 if (r.size() !=
Ndim)
349 throw OomphLibError(
"The position vector r has the wrong dimension",
350 OOMPH_CURRENT_FUNCTION,
351 OOMPH_EXCEPTION_LOCATION);
365 r[0] = R_0 * cos(zeta[0]) +
367 (cos(double_N_buckl * zeta[0]) * cos(zeta[0]) -
368 Ampl_ratio * sin(double_N_buckl * zeta[0]) * sin(zeta[0])) *
371 r[1] = R_0 * sin(zeta[0]) +
373 (cos(double_N_buckl * zeta[0]) * sin(zeta[0]) +
374 Ampl_ratio * sin(double_N_buckl * zeta[0]) * cos(zeta[0])) *
387 OOMPH_CURRENT_FUNCTION,
388 OOMPH_EXCEPTION_LOCATION);
401 veloc[0] = Eps_buckl *
402 (cos(double_N_buckl * zeta[0]) * cos(zeta[0]) -
403 Ampl_ratio * sin(double_N_buckl * zeta[0]) * sin(zeta[0])) *
406 veloc[1] = Eps_buckl *
407 (cos(double_N_buckl * zeta[0]) * sin(zeta[0]) +
408 Ampl_ratio * sin(double_N_buckl * zeta[0]) * cos(zeta[0])) *
421 throw OomphLibError(
"The vector accel has the wrong dimension",
422 OOMPH_CURRENT_FUNCTION,
423 OOMPH_EXCEPTION_LOCATION);
436 accel[0] = -Eps_buckl *
437 (cos(double_N_buckl * zeta[0]) * cos(zeta[0]) -
438 Ampl_ratio * sin(double_N_buckl * zeta[0]) * sin(zeta[0])) *
442 accel[1] = -Eps_buckl *
443 (cos(double_N_buckl * zeta[0]) * sin(zeta[0]) +
444 Ampl_ratio * sin(double_N_buckl * zeta[0]) * cos(zeta[0])) *
457 if (r.size() !=
Ndim)
459 throw OomphLibError(
"The position vector r has the wrong dimension",
460 OOMPH_CURRENT_FUNCTION,
461 OOMPH_EXCEPTION_LOCATION);
466 "The time value t is greater than the number of previous steps",
467 OOMPH_CURRENT_FUNCTION,
468 OOMPH_EXCEPTION_LOCATION);
483 for (
unsigned i = 0;
i <
t;
i++)
489 r[0] = R_0 * cos(zeta[0]) +
491 (cos(double_N_buckl * zeta[0]) * cos(zeta[0]) -
492 Ampl_ratio * sin(double_N_buckl * zeta[0]) * sin(zeta[0])) *
495 r[1] = R_0 * sin(zeta[0]) +
497 (cos(double_N_buckl * zeta[0]) * sin(zeta[0]) +
498 Ampl_ratio * sin(double_N_buckl * zeta[0]) * cos(zeta[0])) *
527 std::ostringstream error_message;
528 error_message << j <<
"th derivative not implemented\n";
531 OOMPH_CURRENT_FUNCTION,
532 OOMPH_EXCEPTION_LOCATION);
616 const unsigned n_buckl,
636 for (
unsigned i = 0;
i < n_geom_data;
i++)
650 const unsigned& n_buckl,
651 const unsigned& imode,
668 for (
unsigned i = 0;
i < n_geom_data;
i++)
772 jacobian(local_eqn, local_eqn) = -1.0;
775 if (local_unknown >= 0)
777 jacobian(local_eqn, local_unknown) = 1.0;
A class that represents a collection of data; each Data object may contain many different individual ...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
double value(const unsigned &i) const
Return i-th stored value. This function is not virtual so that it can be inlined. This means that if ...
void initialise(const T &val)
Initialize all values in the matrix to val.
A Generalised Element class.
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Add a (pointer to an) internal data object to the element and return the index required to obtain it ...
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Return the local equation number corresponding to the j-th value stored at the i-th internal data.
int external_local_eqn(const unsigned &i, const unsigned &j)
Return the local equation number corresponding to the j-th value stored at the i-th external data.
void flush_external_data()
Flush all external data.
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
Add a (pointer to an) external data object to the element and return its index (i....
/////////////////////////////////////////////////////////////////////
TimeStepper * Geom_object_time_stepper_pt
Timestepper (used to handle access to geometry at previous timesteps)
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
unsigned Ndim
Number of Eulerian coordinates.
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////////
Data * External_reference_pressure_pt
Pointer to the data object that represents the external reference pressure.
int reference_pressure_local_eqn()
Return the local equation number of the reference pressure variable.
unsigned External_reference_pressure_index
The Data object that represents the reference pressure is stored at the location indexed by this inte...
virtual void get_residuals_generic(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Compute element residual Vector (only if flag=0) and also element Jacobian matrix (if flag=1)
int geometric_local_eqn()
Return the local equation number of the internal geometric variable.
void set_reference_pressure_pt(Data *const &data_pt)
Set the pressure data that is used as reference pressure.
virtual ~PseudoBucklingRingElement()
Destructor: Kill internal data and set to NULL.
PseudoBucklingRingElement(const double &eps_buckl, const double &HoR, const unsigned &n_buckl, const unsigned &imode, TimeStepper *time_stepper_pt)
Constructor: Pass buckling amplitude, h/R, buckling wavenumbe and pointer to global timestepper....
unsigned Internal_geometric_variable_index
Index of the value stored in the single geometric object that has become an unknown.
PseudoBucklingRingElement(const PseudoBucklingRingElement &dummy)=delete
Broken copy constructor.
virtual void get_residuals(Vector< double > &residuals)
Compute element residual Vector (wrapper)
PseudoBucklingRingElement(const double &eps_buckl, const double &l_ratio, const unsigned n_buckl, const double &r_0, const double &T, TimeStepper *time_stepper_pt)
Constructor: Build pseudo buckling ring from doubles that describe the geometry.
Data *const & reference_pressure_pt() const
Pointer to pressure data that is used as reference pressure.
void operator=(const PseudoBucklingRingElement &)=delete
Broken assignment operator.
virtual void get_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Compute element residual Vector and element Jacobian matrix (wrapper)
double reference_pressure() const
Return the reference pressure.
Pseudo buckling ring: Circular ring deformed by the N-th buckling mode of a thin-wall elastic ring.
void position(const unsigned &t, const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta at discrete previous time (t=0: present time; t>0: prev...
~PseudoBucklingRing()
Destructor: Clean up if necessary.
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta at present time.
void set_R_0(const double &r_0)
Set undeformed radius of ring.
bool Must_clean_up
Do I need to clean up?
void set_T(const double &T)
Set period of oscillation.
void set_ampl_ratio(const double &l_ratio)
Set amplitude ratio between radial and azimuthal buckling displacements.
PseudoBucklingRing(const double &eps_buckl, const double &l_ratio, const unsigned n_buckl, const double &r_0, const double &T, TimeStepper *time_stepper_pt)
Constructor: 1 Lagrangian coordinate, 2 Eulerian coords. Pass buckling amplitude, ratio of of bucklin...
Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th Data item that the object's shape depends on.
double n_buckl_float()
Access function for buckling wavenumber (as float)
PseudoBucklingRing(const double &eps_buckl, const double &HoR, const unsigned &n_buckl, const unsigned &imode, TimeStepper *time_stepper_pt)
Constructor: 1 Lagrangian coordinate, 2 Eulerian coords. Pass buckling amplitude, h/R,...
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
PseudoBucklingRing()
Default constructor (empty and broken)
void veloc(const Vector< double > &zeta, Vector< double > &veloc)
Parametrised velocity on object at current time: veloc = d r(zeta)/dt.
unsigned ngeom_data() const
How many items of Data does the shape of the object depend on?
void dposition_dt(const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
j-th time-derivative on object at current time: .
PseudoBucklingRing(const Vector< Data * > &geom_data_pt, TimeStepper *time_stepper_pt)
Constructor: 1 Lagrangian coordinate, 2 Eulerian coords. Pass buckling amplitude, ratio of of bucklin...
PseudoBucklingRing(const PseudoBucklingRing &node)=delete
Broken copy constructor.
void set_n_buckl(const unsigned &n_buckl)
Set buckling wavenumber.
double r_0()
Access function for undeformed radius.
double eps_buckl()
Access function for buckling amplitude.
void operator=(const PseudoBucklingRing &)=delete
Broken assignment operator.
void set_eps_buckl(const double &eps_buckl)
Set buckling amplitude.
double ampl_ratio()
Access function for amplitude ratio.
void accel(const Vector< double > &zeta, Vector< double > &accel)
Parametrised acceleration on object at current time: accel = d^2 r(zeta)/dt^2.
double T()
Access function for period of oscillation.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
Time *const & time_pt() const
Access function for the pointer to time (const version)
double & dt(const unsigned &t=0)
Return the value of the t-th stored timestep (t=0: present; t>0: previous).
double & time()
Return the current value of the continuous time.
A slight extension to the standard template vector class so that we can include "graceful" array rang...
void initialise(const _Tp &__value)
Iterate over all values and set to the desired value.
const double Pi
50 digits from maple
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...