27 #ifndef OOMPH_IMMERSED_RIGID_BODY_ELEMENTS_HEADER
28 #define OOMPH_IMMERSED_RIGID_BODY_ELEMENTS_HEADER
33 #include <oomph-lib-config.h>
36 #include "../generic/elements.h"
37 #include "../generic/triangle_mesh.h"
38 #include "../generic/fsi.h"
103 double& external_torque);
262 for (
unsigned i = 0;
i < 2;
i++)
336 for (
unsigned e = 0;
e < nel;
e++)
452 const double&
re()
const
464 const double&
st()
const
507 double phi_orig = atan2(Y, X);
508 double r_orig = sqrt(X * X + Y * Y);
527 r[0] += r_orig * cos(phi_orig);
528 r[1] += r_orig * sin(phi_orig);
564 for (std::list<unsigned>::iterator it =
724 if (xi[0] > zeta_max)
726 std::ostringstream error_message;
727 error_message <<
"Value of intrinsic coordinate " << xi[0]
728 <<
"greater than maximum " << zeta_max <<
"\n";
730 "TriangleMeshPolygon::position()",
731 OOMPH_EXCEPTION_LOCATION);
735 if (xi[0] == zeta_max)
746 unsigned p =
static_cast<unsigned>(floor(xi[0]));
752 std::ostringstream error_message;
754 <<
"Something has gone wrong.\n"
755 <<
"The integer part of the input intrinsic coordinate is " << p
756 <<
"\nwhich is equal to or greater than the number of polylines, "
758 <<
"This should have triggered an earlier error\n";
762 OOMPH_CURRENT_FUNCTION,
763 OOMPH_EXCEPTION_LOCATION);
780 unsigned n_vertex = line_pt->
nvertex();
782 for (
unsigned v = 1; v < n_vertex; v++)
788 double fraction = (xi[0] -
Zeta_vertex[p][v - 1]) /
793 for (
unsigned i = 0;
i < 2;
i++)
795 r[
i] = first[
i] + fraction * (last[
i] - first[
i]);
819 double zeta_offset = 0.0;
822 for (
unsigned p = 0; p < n_poly; ++p)
828 unsigned n_vertex = line_pt->
nvertex();
837 for (
unsigned v = 1; v < n_vertex; v++)
841 sqrt(pow(vertex_coord_next[0] - vertex_coord_first[0], 2.0) +
842 pow(vertex_coord_next[1] - vertex_coord_first[1], 2.0));
844 vertex_coord_first = vertex_coord_next;
849 for (
unsigned v = 1; v < n_vertex; v++)
A class that represents a collection of data; each Data object may contain many different individual ...
void pin(const unsigned &i)
Pin the i-th stored variable.
void unpin(const unsigned &i)
Unpin the i-th stored variable.
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...
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 ...
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
virtual void node_update()
Update the positions of all nodes in the element using each node update function. The default impleme...
A Generalised Element class.
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...
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...
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
static DenseMatrix< double > Dummy_matrix
Empty dense matrix used as a dummy argument to combined residual and jacobian functions in the case w...
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.
/////////////////////////////////////////////////////////////////////
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
Class that solves the equations of motion for a general two-dimensional rigid body subject to a parti...
const Vector< double > & g() const
Access function for gravity.
ExternalTorqueFctPt & external_torque_fct_pt()
Access to function pointer to function that specifies external torque.
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...
Vector< double > centre_of_gravity()
Get current centre of gravity.
double & mass_shape()
Access to dimensionless "mass" shape parameter that must be set by hand for non polygonal shapes.
bool Include_geometric_rotation
Boolean to indicate that the rotation variable does not affect the boundary shape.
void position(const Vector< double > &xi, Vector< double > &r) const
Overload the position to apply the rotation and translation.
double * St_pt
Strouhal number of external fluid.
Vector< double > *& g_pt()
Access function to the direction of gravity.
void pin_centre_of_mass_coordinate(const unsigned &i)
Pin the i-th coordinate of the centre of mass.
static double Default_Physical_Constant_Value
Static default value for physical constants.
void flush_drag_mesh()
Function to clear the drag mesh and all associated external data.
void initialise(TimeStepper *const &time_stepper_pt)
Initialisation function.
void dposition_dt(const Vector< double > &zeta, const unsigned &j, Vector< double > &drdt)
Work out the position derivative, including rigid body motion.
double & initial_centre_of_mass(const unsigned &i)
Access function for the initial centre of mass.
void reset_after_internal_fd()
After all internal data finite-differencing, update nodal positions.
ExternalTorqueFctPt External_torque_fct_pt
Function pointer to function that specifies external torque.
void(* ExternalTorqueFctPt)(const double &time, double &external_torque)
Function pointer to function that specifies external torque.
double *& re_invfr_pt()
Access function for pointer to the fluid inverse Froude number (dimensionless gravitational loading)
unsigned ngeom_data() const
The position of the object depends on one data item.
void update_in_external_fd(const unsigned &i)
After an external data change, update the nodal positions.
void reset_in_external_fd(const unsigned &i)
Do nothing to reset within finite-differencing of external data.
double * ReInvFr_pt
Reynolds number divided by Froude number of external fluid.
void delete_external_hijacked_data()
Delete the storage for the external data formed from hijacked data.
~ImmersedRigidBodyElement()
Destuctor: Cleanup if required.
double & centre_y_displacement()
y-displacement of centre of mass
double *& re_pt()
Access function for the pointer to the fluid Reynolds number.
double Initial_Phi
Original rotation angle.
void reset_in_internal_fd(const unsigned &i)
Do nothing to reset within finite-differencing of internal data.
bool Displacement_data_is_internal
Boolean flag to indicate whether data is internal.
void reset_after_external_fd()
After all external data finite-differencing, update nodal positions.
void get_residuals_rigid_body_generic(Vector< double > &residuals, DenseMatrix< double > &jacobian, const bool &flag)
Get residuals and/or Jacobian.
void(* ExternalForceFctPt)(const double &time, Vector< double > &external_force)
Function pointer to function that specifies external force.
void output_centre_of_gravity(std::ostream &outfile)
Output position velocity and acceleration of centre of gravity.
const double & st() const
Access function for the fluid Strouhal number.
double *& density_ratio_pt()
Access function for the pointer to the density ratio.
Data * Centre_displacement_data_pt
Data for centre of gravity displacement. Values: 0: x-displ; 1: y-displ; 2: rotation angle.
void unpin_rotation_angle()
Unpin the rotation angle.
unsigned Index_for_centre_displacement
Index for the data (internal or external) that contains the centre-of-gravity displacement.
double * Re_pt
Reynolds number of external fluid.
static Vector< double > Default_Gravity_vector
Static default value for gravity.
void update_in_internal_fd(const unsigned &i)
After an internal data change, update the nodal positions.
GeomObject * Geom_object_pt
Underlying geometric object.
void pin_rotation_angle()
Pin the rotation angle.
double & initial_phi()
Access function for the initial angle.
ExternalForceFctPt External_force_fct_pt
Function pointer to function that specifies external force.
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...
const double & re() const
Access function for the fluid Reynolds number.
double Moment_of_inertia
Polar moment of inertia of body.
Mesh *const & drag_mesh_pt()
Access fct to mesh containing face elements that allow the computation of the drag on the body.
ExternalForceFctPt & external_force_fct_pt()
Access to function pointer to function that specifies external force.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Get the contribution to the residuals.
void unset_geometric_rotation()
Set the rotation of the object to be ignored (only really useful if you have a circular shape)
Data *& centre_displacement_data_pt()
Pointer to Data for centre of gravity displacement. Values: 0: x-displ; 1: y-displ; 2: rotation angle...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Get residuals including contribution to jacobian.
double & moment_of_inertia_shape()
Access to dimensionless polar "moment of inertia" shape parameter.
double & centre_rotation_angle()
rotation of centre of mass
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.
const double & re_invfr()
Access to the fluid inverse Froude number.
Vector< double > * G_pt
The direction of gravity.
double & centre_x_displacement()
x-displacement of centre of mass
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.
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...
Data * geom_data_pt(const unsigned &j)
Return pointer to the j-th (only) Data item that the object's shape depends on.
Mesh * Drag_mesh_pt
Mesh containing face elements that allow the computation of the drag on the body.
void get_force_and_torque(const double &time, Vector< double > &force, double &torque)
Get force and torque from specified fct pointers and drag mesh.
const double & density_ratio() const
Access function for the the density ratio.
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...
const double & initial_centre_of_mass(const unsigned &i) const
Access function for the initial centre of mass (const version)
double *& st_pt()
Access function for the pointer to the fluid Strouhal number.
static double Default_Physical_Ratio_Value
Static default value for physical ratios.
Vector< double > Initial_centre_of_mass
X-coordinate of initial centre of gravity.
void node_update_adjacent_fluid_elements()
Update the positions of the nodes in fluid elements adjacent to the rigid body, defined as being elem...
std::list< unsigned > List_of_external_hijacked_data
Storage for the external data that is formed from hijacked data that must be deleted by this element.
double * Density_ratio_pt
Density ratio of the solid to the external fluid.
void set_geometric_rotation()
Set the rotation of the object to be included.
void unpin_centre_of_mass_coordinate(const unsigned &i)
Unpin the i-th coordinate of the centre of mass.
Class upgrading a TriangleMeshPolygon to a "hole" for use during triangle mesh generation....
void assign_zeta()
Helper function to assign the values of the (scaled) arc-length to each node of each polyline....
void position(const Vector< double > &xi, Vector< double > &r) const
Overload (again) the position to apply the rotation and translation.
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...
Vector< Vector< double > > Zeta_vertex
Vector of intrisic coordinate values at the nodes.
void reset_reference_configuration()
Update the reference configuration by re-setting the original position of the vertices to their curre...
~ImmersedRigidBodyTriangleMeshPolygon()
Empty Destuctor.
void get_initial_position(const Vector< double > &xi, Vector< double > &r) const
Get the initial position of the polygon.
void position(const unsigned &t, const Vector< double > &xi, Vector< double > &r) const
Overload (again) the position to apply the rotation and translation.
GeneralisedElement *& element_pt(const unsigned long &e)
Return pointer to element e.
unsigned long nelement() const
Return number of elements in the mesh.
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Class defining a polyline for use in Triangle Mesh generation.
unsigned nvertex() const
Number of vertices.
Vector< double > vertex_coordinate(const unsigned &i) const
Coordinate vector of i-th vertex (const version)
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
unsigned npolyline() const
Number of constituent polylines.
TriangleMeshPolyLine * polyline_pt(const unsigned &i) const
Pointer to i-th constituent polyline.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...