28 #ifndef OOMPH_NAVIER_STOKES_SURFACE_DRAG_TORQUE_ELEMENTS_HEADER
29 #define OOMPH_NAVIER_STOKES_SURFACE_DRAG_TORQUE_ELEMENTS_HEADER
33 #include <oomph-lib-config.h>
46 template<
class ELEMENT>
94 for (
unsigned i = 0;
i <
ndim + 1;
i++)
101 for (
unsigned i = 0;
i < 2 *
ndim - 1;
i++)
103 drag_torque[
i] = 0.0;
122 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
126 for (
unsigned i = 0;
i <
ndim;
i++)
150 bulk_el_pt->interpolated_x(s_bulk, x_bulk);
152 double max_legal_error = 1.0e-5;
154 for (
unsigned i = 0;
i <
ndim + 1;
i++)
156 error += fabs(x[
i] - x_bulk[
i]);
158 if (error > max_legal_error)
160 std::ostringstream error_stream;
161 error_stream <<
"difference in Eulerian posn from bulk and face: "
162 << error <<
" exceeds threshold " << max_legal_error
165 OOMPH_CURRENT_FUNCTION,
166 OOMPH_EXCEPTION_LOCATION);
176 bulk_el_pt->interpolated_u_nst(s_bulk, veloc);
181 bulk_el_pt->get_traction(s_bulk, normal, traction);
184 for (
unsigned i = 0;
i <
ndim + 1;
i++)
186 drag_force[
i] -= traction[
i] *
W;
192 for (
unsigned i = 0;
i <
ndim + 1;
i++)
202 drag_torque[0] -= (X[0] * traction[1] - X[1] * traction[0]) *
W;
206 drag_torque[0] -= (X[1] * traction[2] - X[2] * traction[1]) *
W;
207 drag_torque[1] -= (X[2] * traction[0] - X[0] * traction[2]) *
W;
208 drag_torque[2] -= (X[0] * traction[1] - X[1] * traction[0]) *
W;
212 throw OomphLibError(
"Dimension of a surface element must be 1 or 2\n",
213 OOMPH_CURRENT_FUNCTION,
214 OOMPH_EXCEPTION_LOCATION);
230 const unsigned&
i)
const
237 void output(std::ostream& outfile,
const unsigned& n_plot)
243 unsigned dim_el =
dim();
267 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
275 bulk_el_pt->interpolated_x(s_bulk, x);
278 bulk_el_pt->interpolated_u_nst(s_bulk, veloc);
281 bulk_el_pt->get_traction(s_bulk, normal, traction);
286 for (
unsigned i = 0;
i < dim_el + 1;
i++)
292 for (
unsigned i = 0;
i < dim_el + 1;
i++)
294 outfile << x[
i] <<
" ";
297 for (
unsigned i = 0;
i < dim_el + 1;
i++)
299 outfile << normal[
i] <<
" ";
302 for (
unsigned i = 0;
i < dim_el + 1;
i++)
304 outfile << veloc[
i] <<
" ";
307 for (
unsigned i = 0;
i < dim_el + 1;
i++)
309 outfile << -1.0 * traction[
i] <<
" ";
311 outfile << -(X[0] * traction[1] - X[1] * traction[0]);
313 outfile << std::endl;
A class that represents a collection of data; each Data object may contain many different individual ...
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....
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
void outer_unit_normal(const Vector< double > &s, Vector< double > &unit_normal) const
Compute outer unit normal at the specified local coordinate.
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
In a FaceElement, the "global" intrinsic coordinate of the element along the boundary,...
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s. Overloaded to get information from bulk...
double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s....
void get_local_coordinate_in_bulk(const Vector< double > &s, Vector< double > &s_bulk) const
Calculate the vector of local coordinate in the bulk element given the local coordinates in this Face...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
A general Finite Element class.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction")
virtual void build_face_element(const int &face_index, FaceElement *face_element_pt)
Function for building a lower dimensional FaceElement on the specified face of the FiniteElement....
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
Data *& external_data_pt(const unsigned &i)
Return a pointer to i-th external data object.
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....
unsigned ndim() const
Access function to # of Eulerian coordinates.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
A class of elements that allow the determination of the drag and toque, relative to a given centre of...
void set_translation_and_rotation(Data *const &object_data_pt)
Set the translation and rotation of the rigid object as external data.
unsigned Translation_index
The index of where the translation and rotation data is stored.
Vector< double > Centre_of_rotation
The centre of rotation for the torque calculation.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function.
virtual void get_drag_and_torque(Vector< double > &drag_force, Vector< double > &drag_torque)
Function that specifies the drag force and the torque about the origin.
NavierStokesSurfaceDragTorqueElement(FiniteElement *const &element_pt, const int &face_index)
Constructor, which takes a "bulk" element and the value of an index describing to which face the elem...
double & centre_of_rotation(const unsigned &i)
Access function for the centre of rotation.
unsigned Dim
The highest dimension of the problem.
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Specify the value of nodal zeta from the face geometry The "global" intrinsic coordinate of the eleme...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
An OomphLibError object which should be thrown when an run-time error is encountered....
//////////////////////////////////////////////////////////////////// ////////////////////////////////...