31 #ifndef OOMPH_IMMERSED_RIGID_BODY_ELEMENTS_HEADER 32 #define OOMPH_IMMERSED_RIGID_BODY_ELEMENTS_HEADER 37 #include <oomph-lib-config.h> 40 #include "../generic/elements.h" 41 #include "../generic/triangle_mesh.h" 42 #include "../generic/fsi.h" 114 double& external_torque);
238 for(
unsigned i=0;
i<2;
i++)
309 for (
unsigned e=0;
e<nel;
e++)
423 double Y = initial_x[1] - Initial_centre_of_mass[1];
426 double phi_orig=atan2(Y,X);
427 double r_orig=sqrt(X*X+Y*Y);
430 r[0] = Initial_centre_of_mass[0] +
433 r[1] = Initial_centre_of_mass[1] +
446 r[0] += r_orig*cos(phi_orig);
447 r[1] += r_orig*sin(phi_orig);
484 for(std::list<unsigned>::iterator it =
485 List_of_external_hijacked_data.begin();
486 it!=List_of_external_hijacked_data.end();++it)
493 List_of_external_hijacked_data.clear();
604 boundary_polyline_pt,
618 this->get_initial_position(xi,initial_x);
628 this->get_initial_position(xi,initial_x);
638 void reset_reference_configuration();
646 unsigned n_poly = this->npolyline();
653 double zeta_max = Zeta_vertex[n_poly-1].back();
658 std::ostringstream error_message;
659 error_message <<
"Value of intrinsic coordinate " << xi[0] <<
660 "greater than maximum " << zeta_max <<
"\n";
663 "TriangleMeshPolygon::position()",
664 OOMPH_EXCEPTION_LOCATION);
668 if(xi[0] == zeta_max)
670 unsigned n_vertex = this->polyline_pt(n_poly-1)->nvertex();
671 r = this->polyline_pt(n_poly-1)->vertex_coordinate(n_vertex-1);
679 unsigned p =
static_cast<unsigned> (floor(xi[0]));
685 std::ostringstream error_message;
687 <<
"Something has gone wrong.\n" 688 <<
"The integer part of the input intrinsic coordinate is " 690 "\nwhich is equal to or greater than the number of polylines, " 692 <<
"This should have triggered an earlier error\n";
696 OOMPH_CURRENT_FUNCTION,
697 OOMPH_EXCEPTION_LOCATION);
704 if(xi[0] == Zeta_vertex[p][0])
706 r = line_pt->vertex_coordinate(0);
714 unsigned n_vertex = line_pt->nvertex();
716 for(
unsigned v=1;v<n_vertex;v++)
720 if(xi[0] < Zeta_vertex[p][v])
722 double fraction = (xi[0] - Zeta_vertex[p][v-1])/
723 (Zeta_vertex[p][v] - Zeta_vertex[p][v-1]);
727 for(
unsigned i=0;
i<2;
i++)
729 r[
i] = first[
i] + fraction*(last[
i] - first[
i]);
743 unsigned n_poly = this->npolyline();
746 Zeta_vertex.resize(n_poly);
753 double zeta_offset = 0.0;
756 for(
unsigned p=0;p<n_poly;++p)
762 unsigned n_vertex = line_pt->
nvertex();
765 Zeta_vertex[p].resize(n_vertex);
766 Zeta_vertex[p][0] = 0.0;
771 for(
unsigned v=1;v<n_vertex;v++)
775 sqrt(pow(vertex_coord_next[0] - vertex_coord_first[0],2.0)
776 + pow(vertex_coord_next[1] - vertex_coord_first[1],2.0));
777 Zeta_vertex[p][v] = Zeta_vertex[p][v-1] + length;
778 vertex_coord_first = vertex_coord_next;
782 Zeta_vertex[p][0] += zeta_offset;
783 for(
unsigned v=1;v<n_vertex;v++)
785 Zeta_vertex[p][v] /= Zeta_vertex[p][n_vertex-1];
786 Zeta_vertex[p][v] += zeta_offset;
GeomObject * Geom_object_pt
Underlying geometric object.
A Generalised Element class.
void unpin(const unsigned &i)
Unpin the i-th stored variable.
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 ...
void pin_centre_of_mass_coordinate(const unsigned &i)
Pin the i-th coordinate of the centre of mass.
Vector< double > centre_of_gravity()
Get current centre of gravity.
void delete_external_hijacked_data()
Delete the storage for the external data formed from hijacked data.
void reset_after_internal_fd()
After all internal data finite-differencing, update nodal positions.
double Initial_Phi
Original rotation angle.
double * ReInvFr_pt
Reynolds number divided by Froude number of external fluid.
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.
double & moment_of_inertia_shape()
Access to dimensionless polar "moment of inertia" shape parameter.
const double & initial_centre_of_mass(const unsigned &i) const
Access function for the initial centre of mass (const version)
Mesh *const & drag_mesh_pt()
Access fct to mesh containing face elements that allow the computation of the drag on the body...
void set_geometric_rotation()
Set the rotation of the object to be included.
void fill_in_jacobian_from_internal_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
Calculate the contributions to the jacobian from the internal degrees of freedom using finite differe...
void reset_in_internal_fd(const unsigned &i)
Do nothing to reset within finite-differencing of internal data.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Get the contribution to the residuals.
void unpin_rotation_angle()
Unpin the rotation angle.
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
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 fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Get residuals including contribution to jacobian.
void get_residuals_rigid_body_generic(Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &flag)
Get residuals and/or Jacobian.
Vector< Vector< double > > Zeta_vertex
Vector of intrisic coordinate values at the nodes.
static double Default_Physical_Ratio_Value
Static default value for physical ratios.
void flush_drag_mesh()
Function to clear the drag mesh and all associated external data.
double & centre_rotation_angle()
rotation of centre of mass
std::list< unsigned > List_of_external_hijacked_data
const double & re_invfr()
Access to the fluid inverse Froude number.
void unpin_centre_of_mass_coordinate(const unsigned &i)
Unpin the i-th coordinate of the centre of mass.
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.
void position(const unsigned &t, const Vector< double > &xi, Vector< double > &r) const
Overload to include the time history of the motion of the object.
void pin(const unsigned &i)
Pin the i-th stored variable.
void position(const Vector< double > &xi, Vector< double > &r) const
Overload the position to apply the rotation and translation.
void fill_in_jacobian_from_external_by_fd(Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &fd_all_data=false)
Calculate the contributions to the jacobian from the external degrees of freedom using finite differe...
const double & re() const
Access function for the fluid Reynolds number.
void get_initial_position(const Vector< double > &xi, Vector< double > &r) const
Get the initial position of the polygon.
unsigned long nelement() const
Return number of elements in the mesh.
void flush_external_data()
Flush all external data.
double * Density_ratio_pt
Density ratio of the solid to the external fluid.
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
unsigned ngeom_data() const
The position of the object depends on one data item.
double & centre_y_displacement()
y-displacement of centre of mass
void reset_after_external_fd()
After all external data finite-differencing, update nodal positions.
void node_update_adjacent_fluid_elements()
Update the positions of the nodes in fluid elements adjacent to the rigid body, defined as being elem...
void(* ExternalTorqueFctPt)(const double &time, double &external_torque)
Function pointer to function that specifies external torque.
void get_force_and_torque(const double &time, Vector< double > &force, double &torque)
Get force and torque from specified fct pointers and drag mesh.
double & centre_x_displacement()
x-displacement of centre of mass
unsigned nvertex() const
Number of vertices.
Class defining a polyline for use in Triangle Mesh generation.
double * St_pt
Strouhal number of external fluid.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
void unset_geometric_rotation()
Set the rotation of the object to be ignored (only really useful if you have a circular shape) ...
void(* ExternalForceFctPt)(const double &time, Vector< double > &external_force)
Function pointer to function that specifies external force.
const Vector< double > & g() const
Access function for gravity.
double Moment_of_inertia
Polar moment of inertia of body.
void position(const unsigned &t, const Vector< double > &xi, Vector< double > &r) const
Overload (again) the position to apply the rotation and translation.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
void update_in_internal_fd(const unsigned &i)
After an internal data change, update the nodal positions.
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()
Access to function pointer to function that specifies external torque.
ExternalTorqueFctPt External_torque_fct_pt
Function pointer to function that specifies external torque.
ExternalForceFctPt & external_force_fct_pt()
Access to function pointer to function that specifies external force.
double *& density_ratio_pt()
Access function for the pointer to the density ratio.
ImmersedRigidBodyElement(GeomObject *const &geom_object_pt, TimeStepper *const &time_stepper_pt, Data *const ¢re_displacement_data_pt=0)
Constructor that takes an underlying geometric object: and timestepper.
ImmersedRigidBodyElement(TimeStepper *const &time_stepper_pt, Data *const ¢re_displacement_data_pt=0)
Default constructor that intialises everything to zero. This is expected to be called only from deriv...
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.
~ImmersedRigidBodyTriangleMeshPolygon()
Empty Destuctor.
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
void initialise(TimeStepper *const &time_stepper_pt)
Initialisation function.
Vector< double > *& g_pt()
Access function to the direction of gravity.
Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th (only) Data item that the object's shape depends on.
Vector< double > vertex_coordinate(const unsigned &i) const
Coordinate vector of i-th vertex (const version)
double *& re_invfr_pt()
Access function for pointer to the fluid inverse Froude number (dimensionless gravitational loading) ...
double *& st_pt()
Access function for the pointer to the fluid Strouhal number.
void reset_in_external_fd(const unsigned &i)
Do nothing to reset within finite-differencing of external data.
Mesh * Drag_mesh_pt
Mesh containing face elements that allow the computation of the drag on the body. ...
double & initial_centre_of_mass(const unsigned &i)
Access function for the initial centre of mass.
void pin_rotation_angle()
Pin the rotation angle.
double & initial_phi()
Access function for the initial angle.
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.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Vector< double > * G_pt
The direction of gravity.
~ImmersedRigidBodyElement()
Destuctor: Cleanup if required.
bool Include_geometric_rotation
double *& re_pt()
Access function for the pointer to the fluid Reynolds number.
void update_in_external_fd(const unsigned &i)
After an external data change, update the nodal positions.
void position(const Vector< double > &xi, Vector< double > &r) const
Overload (again) the position to apply the rotation and translation.
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...
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
double * Re_pt
Reynolds number of external fluid.
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...
virtual void node_update()
Update the positions of all nodes in the element using each node update function. The default impleme...
Class defining a closed polygon for the Triangle mesh generation.