70 double Y = initial_x[1] - Initial_centre_of_mass[1];
73 double phi_orig=atan2(Y,X);
74 double r_orig=sqrt(X*X+Y*Y);
89 drdt[0] += - r_orig*sin(
91 drdt[1] += r_orig*cos(
100 std::ostringstream warning_stream;
102 <<
"Using default (static) assignment " << j
103 <<
"-th time derivative in GeomObject::dposition_dt(...) is zero\n" 104 <<
"Overload for your specific geometric object if this is not \n" 105 <<
"appropriate. \n";
107 "GeomObject::dposition_dt()",
108 OOMPH_EXCEPTION_LOCATION);
110 unsigned n=drdt.size();
111 for (
unsigned i=0;
i<n;
i++) {drdt[
i]=0.0;}
136 outfile << time_stepper_pt->
time() <<
" " 142 << veloc[0] <<
" " << veloc[1] <<
" " << veloc[2] <<
" " 143 << accel[0] <<
" " << accel[1] <<
" " << accel[2] << std::endl;
187 for (
unsigned e=0;
e<nel;
e++)
190 get_drag_and_torque(element_drag_force,
191 element_drag_torque);
192 force[0]+=element_drag_force[0];
193 force[1]+=element_drag_force[1];
194 torque+=element_drag_torque[0];
215 std::set<Data*> bulk_geometric_data_pt;
217 std::set<std::pair<Data*,unsigned> > bulk_load_data_pt;
220 const unsigned n_element = drag_mesh_pt->
nelement();
221 for(
unsigned e=0;
e<n_element;++
e)
228 ->bulk_element_pt());
232 throw OomphLibError(
"Drag mesh must consist of FSIFluidElements\n",
233 OOMPH_CURRENT_FUNCTION,
234 OOMPH_EXCEPTION_LOCATION);
244 for(std::set<Data*>::iterator it = bulk_geometric_data_pt.begin();
245 it!=bulk_geometric_data_pt.end();++it)
251 for(std::set<std::pair<Data*,unsigned> >::iterator it =
252 bulk_load_data_pt.begin();
253 it!=bulk_load_data_pt.end();++it)
270 if(time_stepper_pt==0) {
return;}
308 double time=timestepper_pt->
time();
317 double external_torque;
322 const double Lambda_sq =
327 const double scaled_re_inv_fr =
337 residuals[local_eqn]=
338 Lambda_sq*
Mass*accel[0]- external_force[0] -
Mass*scaled_re_inv_fr*G[0];
343 jacobian(local_eqn,local_eqn)=
351 residuals[local_eqn]=Lambda_sq*
Mass*accel[1] -
352 external_force[1] -
Mass*scaled_re_inv_fr*G[1];
356 jacobian(local_eqn,local_eqn)=
368 jacobian(local_eqn,local_eqn)=
389 boundary_polyline_pt,
410 double inertia_x=0.0;
411 double inertia_y=0.0;
414 unsigned nboundary=boundary_polyline_pt.size();
415 for (
unsigned i=0;
i<nboundary;
i++)
418 unsigned nseg=boundary_polyline_pt[
i]->nsegment();
419 for(
unsigned j=0;j<nseg;j++)
426 Mass+=0.5*(r_left[0]*r_right[1]-r_right[0]*r_left[1]);
430 (r_left[0]*r_right[1]-r_right[0]*r_left[1]);
432 (r_left[0]*r_right[1]-r_right[0]*r_left[1]);
441 Mass+=0.5*(r_left[0]*r_right[1]-r_right[0]*r_left[1]);
445 (r_left[0]*r_right[1]-r_right[0]*r_left[1]);
447 (r_left[0]*r_right[1]-r_right[0]*r_left[1]);
456 for (
unsigned i=0;
i<nboundary;
i++)
459 unsigned nseg=boundary_polyline_pt[
i]->nsegment();
460 for(
unsigned j=0;j<nseg;j++)
473 inertia_x+=1.0/12.0*(r_left[1]*r_left[1]+
474 r_left[1]*r_right[1]+
475 r_right[1]*r_right[1])*
476 (r_left[0]*r_right[1]-r_right[0]*r_left[1]);
478 inertia_y+=1.0/12.0*(r_left[0]*r_left[0]+
479 r_left[0]*r_right[0]+
480 r_right[0]*r_right[0])*
481 (r_left[0]*r_right[1]-r_right[0]*r_left[1]);
497 inertia_x+=1.0/12.0*(r_left[1]*r_left[1]+
498 r_left[1]*r_right[1]+
499 r_right[1]*r_right[1])*
500 (r_left[0]*r_right[1]-r_right[0]*r_left[1]);
502 inertia_y+=1.0/12.0*(r_left[0]*r_left[0]+
503 r_left[0]*r_right[0]+
504 r_right[0]*r_right[0])*
505 (r_left[0]*r_right[1]-r_right[0]*r_left[1]);
555 for (
unsigned i=0;
i<npoly;
i++)
558 unsigned nvertex=poly_line_pt->
nvertex();
559 for (
unsigned j=0;j<nvertex;j++)
583 for (
unsigned t=0;
t<nprev;
t++)
GeomObject * Geom_object_pt
Underlying geometric object.
int centre_displacement_local_eqn(const unsigned &i)
Return the equation number associated with the i-th centre of gravity displacment 0: x-displ; 1: y-di...
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 ...
virtual void identify_geometric_data(std::set< Data *> &geometric_data_pt)
The purpose of this function is to identify all Data objects that affect the elements' geometry...
void delete_external_hijacked_data()
Delete the storage for the external data formed from hijacked data.
double Initial_Phi
Original rotation angle.
Data *& centre_displacement_data_pt()
Pointer to Data for centre of gravity displacement. Values: 0: x-displ; 1: y-displ; 2: rotation angle...
void dposition_dt(const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
Work out the position derivative, including rigid body motion.
void set_drag_mesh(Mesh *const &drag_mesh_pt)
Function to set the drag mesh and add the appropriate load and geometric data as external data to the...
Vector< double > Initial_centre_of_mass
X-coordinate of initial centre of gravity.
void reset_reference_configuration()
Update the reference configuration by re-setting the original position of the vertices to their curre...
Mesh *const & drag_mesh_pt()
Access fct to mesh containing face elements that allow the computation of the drag on the body...
ImmersedRigidBodyTriangleMeshPolygon(const Vector< double > &hole_center, const Vector< TriangleMeshCurveSection *> &boundary_polyline_pt, TimeStepper *const &time_stepper_pt, Data *const ¢re_displacement_data_pt=0)
Constructor: Specify coordinates of a point inside the hole and a vector of pointers to TriangleMeshP...
double & time()
Return current value of continous time.
void apply_rigid_body_motion(const unsigned &t, const Vector< double > &initial_x, Vector< double > &r) const
Helper function to adjust the position in response to changes in position and angle of the solid abou...
void get_residuals_rigid_body_generic(Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &flag)
Get residuals and/or Jacobian.
static double Default_Physical_Ratio_Value
Static default value for physical ratios.
std::list< unsigned > List_of_external_hijacked_data
const double & re_invfr()
Access to the fluid inverse Froude number.
Vector< double > internal_point() const
Coordinates of the internal point.
Custom Data class that is used when HijackingData. The class always contains a single value that is c...
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
unsigned Index_for_centre_displacement
Index for the data (internal or external) that contains the centre-of-gravity displacement.
static Vector< double > Default_Gravity_vector
Static default value for gravity.
const double & density_ratio() const
Access function for the the density ratio.
TriangleMeshPolyLine * polyline_pt(const unsigned &i) const
Pointer to i-th constituent polyline.
virtual void identify_load_data(std::set< std::pair< Data *, unsigned > > &paired_load_data)=0
Add to the set paired_load_data pairs containing.
void position(const Vector< double > &xi, Vector< double > &r) const
Overload the position to apply the rotation and translation.
const double & re() const
Access function for the fluid Reynolds number.
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
unsigned long nelement() const
Return number of elements in the mesh.
void flush_external_data()
Flush all external data.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
void get_force_and_torque(const double &time, Vector< double > &force, double &torque)
Get force and torque from specified fct pointers and drag mesh.
unsigned nvertex() const
Number of vertices.
Class defining a polyline for use in Triangle Mesh generation.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
const Vector< double > & g() const
Access function for gravity.
double Moment_of_inertia
Polar moment of inertia of body.
ExternalForceFctPt External_force_fct_pt
Function pointer to function that specifies external force.
Data * Centre_displacement_data_pt
Data for centre of gravity displacement. Values: 0: x-displ; 1: y-displ; 2: rotation angle...
A class that represents a collection of data; each Data object may contain many different individual ...
ExternalTorqueFctPt External_torque_fct_pt
Function pointer to function that specifies external torque.
Base class defining a closed curve for the Triangle mesh generation.
static double Default_Physical_Constant_Value
Static default value for physical constants.
bool Displacement_data_is_internal
Boolean flag to indicate whether data is internal.
void initialise(TimeStepper *const &time_stepper_pt)
Initialisation function.
bool Can_update_configuration
Boolean flag to indicate whether the polygon can update its own reference configuration after it has ...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Vector< double > vertex_coordinate(const unsigned &i) const
Coordinate vector of i-th vertex (const version)
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 ...
Mesh * Drag_mesh_pt
Mesh containing face elements that allow the computation of the drag on the body. ...
void time_derivative(const unsigned &i, Data *const &data_pt, Vector< double > &deriv)
Evaluate i-th derivative of all values in Data and return in Vector deriv[].
const double & st() const
Access function for the fluid Strouhal number.
void output_centre_of_gravity(std::ostream &outfile)
Output position velocity and acceleration of centre of gravity.
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...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
unsigned ncurve_section() const
Number of constituent curves.
bool Include_geometric_rotation
The FSIFluidElement class is a base class for all fluid finite elements that apply a load (traction) ...
Class defining a closed polygon for the Triangle mesh generation.