30 #ifndef OOMPH_PSEUDO_BUCKLING_RING_HEADER 31 #define OOMPH_PSEUDO_BUCKLING_RING_HEADER 36 #include <oomph-lib-config.h> 78 "Don't call empty constructor for PseudoBucklingRing!",
79 OOMPH_CURRENT_FUNCTION,
80 OOMPH_EXCEPTION_LOCATION);
99 if (geom_data_pt.size()!=1)
101 std::ostringstream error_message;
103 <<
"geom_data_pt should be of size 1, but is of size" 104 << geom_data_pt.size() << std::endl;
107 OOMPH_CURRENT_FUNCTION,
108 OOMPH_EXCEPTION_LOCATION);
110 if (geom_data_pt[0]->nvalue()!=5)
112 std::ostringstream error_message;
114 <<
"geom_data_pt[0] should have 5 values, but has" 115 << geom_data_pt[0]->nvalue() << std::endl;
118 OOMPH_CURRENT_FUNCTION,
119 OOMPH_EXCEPTION_LOCATION);
135 const double&
ampl_ratio,
const unsigned n_buckl,
152 for (
unsigned itime=0;itime<=n_time;itime++)
184 const unsigned& n_buckl,
185 const unsigned& imode,
190 double K1=(pow(
double(n_buckl),2)+1.0)*
191 (1.0/12.0*pow(
double(n_buckl),2)*pow(HoR,2)+1.0);
193 double K2oK1sq=1.0/12.0*pow(HoR,2)*pow(
double(n_buckl),2)*
194 pow( (pow(
double(n_buckl),2)-1.0) ,2)/
195 ( pow((pow(
double(n_buckl),2)+1.0),2) *
196 pow((1.0/12.0*pow(
double(n_buckl),2)*pow(HoR,2)+1.0),2) );
199 double omega1=sqrt(0.5*K1*(1.0+sqrt(1.0-4*K2oK1sq)));
200 double omega2=sqrt(0.5*K1*(1.0-sqrt(1.0-4*K2oK1sq)));
204 (double(n_buckl)*(1.0/12.0*pow(
double(n_buckl),2)*pow(HoR,2)+1.0))/
205 (pow(omega1,2)-pow(
double(n_buckl),2)*(1.0/12.0*pow(HoR,2)+1.0));
208 double(n_buckl)*(1.0/12.0*pow(
double(n_buckl),2)*pow(HoR,2)+1.0)/
209 (pow(omega2,2)-pow(
double(n_buckl),2)*(1.0/12.0*pow(HoR,2)+1.0));
217 ampl_ratio=ampl_ratio2;
221 ampl_ratio=ampl_ratio1;
226 ampl_ratio=ampl_ratio2;
230 oomph_info <<
"wrong imode " << imode << std::endl;
236 ampl_ratio=ampl_ratio1;
250 for (
unsigned itime=0;itime<=n_time;itime++)
344 throw OomphLibError(
"The position vector r has the wrong dimension",
345 OOMPH_CURRENT_FUNCTION,
346 OOMPH_EXCEPTION_LOCATION);
360 r[0]=R_0*cos(zeta[0]) +
361 Eps_buckl*( cos(double_N_buckl*zeta[0])*cos(zeta[0])-
362 Ampl_ratio*sin(double_N_buckl*zeta[0])*sin(zeta[0]) )
365 r[1]=R_0*sin(zeta[0]) +
366 Eps_buckl*( cos(double_N_buckl*zeta[0])*sin(zeta[0])+
367 Ampl_ratio*sin(double_N_buckl*zeta[0])*cos(zeta[0]) )
378 if (veloc.size()!=
Ndim)
381 "The vector veloc has the wrong size",
382 OOMPH_CURRENT_FUNCTION,
383 OOMPH_EXCEPTION_LOCATION);
397 Eps_buckl*( cos(double_N_buckl*zeta[0])*cos(zeta[0])-
398 Ampl_ratio*sin(double_N_buckl*zeta[0])*sin(zeta[0]) )
401 Eps_buckl*( cos(double_N_buckl*zeta[0])*sin(zeta[0])+
402 Ampl_ratio*sin(double_N_buckl*zeta[0])*cos(zeta[0]) )
412 if (accel.size()!=
Ndim)
414 throw OomphLibError(
"The vector accel has the wrong dimension",
415 OOMPH_CURRENT_FUNCTION,
416 OOMPH_EXCEPTION_LOCATION);
430 -Eps_buckl*( cos(double_N_buckl*zeta[0])*cos(zeta[0])-
431 Ampl_ratio*sin(double_N_buckl*zeta[0])*sin(zeta[0]) )
435 -Eps_buckl*( cos(double_N_buckl*zeta[0])*sin(zeta[0])+
436 Ampl_ratio*sin(double_N_buckl*zeta[0])*cos(zeta[0]) )
449 throw OomphLibError(
"The position vector r has the wrong dimension",
450 OOMPH_CURRENT_FUNCTION,
451 OOMPH_EXCEPTION_LOCATION);
456 "The time value t is greater than the number of previous steps",
457 OOMPH_CURRENT_FUNCTION,
458 OOMPH_EXCEPTION_LOCATION);
473 for (
unsigned i=0;
i<
t;
i++)
479 r[0]=R_0*cos(zeta[0]) +
480 Eps_buckl*( cos(double_N_buckl*zeta[0])*cos(zeta[0])-
481 Ampl_ratio*sin(double_N_buckl*zeta[0])*sin(zeta[0]) )
484 r[1]=R_0*sin(zeta[0]) +
485 Eps_buckl*( cos(double_N_buckl*zeta[0])*sin(zeta[0])+
486 Ampl_ratio*sin(double_N_buckl*zeta[0])*cos(zeta[0]) )
515 std::ostringstream error_message;
516 error_message << j <<
"th derivative not implemented\n";
519 OOMPH_CURRENT_FUNCTION,
520 OOMPH_EXCEPTION_LOCATION);
595 {
return internal_local_eqn(0,Internal_geometric_variable_index);}
599 {
return external_local_eqn(External_reference_pressure_index,0);}
607 const double&
ampl_ratio,
const unsigned n_buckl,
608 const double&
r_0,
const double&
T,
611 r_0,T,time_stepper_pt),
612 External_reference_pressure_pt(0)
620 Internal_geometric_variable_index = 3;
637 const unsigned& n_buckl,
638 const unsigned& imode,
641 External_reference_pressure_pt(0)
649 Internal_geometric_variable_index = 3;
689 get_residuals_generic(residuals,dummy,0);
698 get_residuals_generic(residuals,jacobian,1);
708 if(External_reference_pressure_pt == 0) {
return 0.0;}
709 else {
return External_reference_pressure_pt->
value(0);}
716 flush_external_data(External_reference_pressure_pt);
718 External_reference_pressure_pt = data_pt;
720 External_reference_pressure_index = add_external_data(data_pt);
738 int local_eqn = geometric_local_eqn();
744 residuals[local_eqn] = reference_pressure() - (
r_0()-1.0);
751 jacobian(local_eqn,local_eqn) = -1.0;
753 int local_unknown = reference_pressure_local_eqn();
754 if(local_unknown >= 0)
756 jacobian(local_eqn,local_unknown) = 1.0;
double eps_buckl()
Access function for buckling amplitude.
A Generalised Element class.
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 broken_copy(const std::string &class_name)
Issue error message and terminate execution.
virtual void get_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Compute element residual Vector and element Jacobian matrix (wrapper)
void set_T(const double &T)
Set period of oscillation.
void initialise(const T &val)
Initialize all values in the matrix to val.
void accel(const Vector< double > &zeta, Vector< double > &accel)
Parametrised acceleration on object at current time: accel = d^2 r(zeta)/dt^2.
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) ...
void dposition_dt(const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
j-th time-derivative on object at current time: .
void operator=(const PseudoBucklingRingElement &)
Broken assignment operator.
Data * External_reference_pressure_pt
Pointer to the data object that represents the external reference pressure.
void veloc(const Vector< double > &zeta, Vector< double > &veloc)
Parametrised velocity on object at current time: veloc = d r(zeta)/dt.
int geometric_local_eqn()
Return the local equation number of the internal geometric variable.
Pseudo buckling ring: Circular ring deformed by the N-th buckling mode of a thin-wall elastic ring...
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...
Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th Data item that the object's shape depends on.
~PseudoBucklingRing()
Destructor: Clean up if necessary.
PseudoBucklingRing()
Default constructor (empty and broken)
const double Pi
50 digits from maple
void operator=(const PseudoBucklingRing &)
Broken assignment operator.
void set_reference_pressure_pt(Data *const &data_pt)
Set the pressure data that is used as reference pressure.
void set_eps_buckl(const double &eps_buckl)
Set buckling amplitude.
void position(const Vector< double > &zeta, Vector< double > &r) const
Position Vector at Lagrangian coordinate zeta at present time.
unsigned Internal_geometric_variable_index
Index of the value stored in the single geometric object that has become an unknown.
Vector< Data * > Geom_data_pt
Vector of pointers to Data items that affects the object's shape.
Pseudo buckling ring: Circular ring deformed by the N-th buckling mode of a thin-wall elastic ring...
TimeStepper * Geom_object_time_stepper_pt
Timestepper (used to handle access to geometry at previous timesteps)
PseudoBucklingRingElement(const PseudoBucklingRingElement &dummy)
Broken copy constructor.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
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(Vector< double > &residuals)
Compute element residual Vector (wrapper)
double reference_pressure() const
Return the reference pressure.
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...
double & dt(const unsigned &t=0)
virtual ~PseudoBucklingRingElement()
Destructor: Kill internal data and set to NULL.
double r_0()
Access function for undeformed radius.
void set_n_buckl(const unsigned &n_buckl)
Set buckling wavenumber.
A class that represents a collection of data; each Data object may contain many different individual ...
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...
double & time()
Return the current value of the continuous time.
double ampl_ratio()
Access function for amplitude ratio.
void initialise(const _Tp &__value)
Iterate over all values and set to the desired value.
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.
bool Must_clean_up
Do I need to clean up?
double T()
Access function for period of oscillation.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
PseudoBucklingRing(const PseudoBucklingRing &node)
Broken copy constructor.
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...
Time *const & time_pt() const
Access function for the pointer to time (const version)
Data *const & reference_pressure_pt() const
Pointer to pressure data that is used as reference pressure.
void set_R_0(const double &r_0)
Set undeformed radius of ring.
void set_ampl_ratio(const double &l_ratio)
Set amplitude ratio between radial and azimuthal buckling displacements.
int reference_pressure_local_eqn()
Return the local equation number of the reference pressure variable.
double n_buckl_float()
Access function for buckling wavenumber (as float)
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...
unsigned ngeom_data() const
How many items of Data does the shape of the object depend on?
virtual unsigned nprev_values() const =0
Number of previous values available: 0 for static, 1 for BDF<1>,...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
unsigned Ndim
Number of Eulerian coordinates.