28 #ifndef OOMPH_NAVIER_STOKES_SURFACE_POWER_ELEMENTS_HEADER
29 #define OOMPH_NAVIER_STOKES_SURFACE_POWER_ELEMENTS_HEADER
33 #include <oomph-lib-config.h>
38 #include "../generic/Qelements.h"
49 template<
class ELEMENT>
77 const unsigned&
i)
const
86 std::ofstream dummy_file;
119 if (outfile.is_open()) outfile <<
"ZONE I=3" << std::endl;
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);
180 bulk_el_pt->get_traction(s_bulk, normal, traction);
183 for (
unsigned i = 0;
i <
ndim + 1;
i++)
185 drag[
i] += traction[
i] *
W;
188 if (outfile.is_open())
191 for (
unsigned i = 0;
i <
ndim + 1;
i++)
193 outfile << x[
i] <<
" ";
197 for (
unsigned i = 0;
i <
ndim + 1;
i++)
199 outfile << traction[
i] <<
" ";
204 for (
unsigned i = 0;
i <
ndim + 1;
i++)
206 outfile << normal[
i] <<
" ";
209 outfile << std::endl;
219 std::ofstream dummy_file;
229 double rate_of_work_integral = 0.0;
252 if (outfile.is_open()) outfile <<
"ZONE I=3, J=3" << std::endl;
255 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
259 for (
unsigned i = 0;
i <
ndim;
i++)
283 bulk_el_pt->interpolated_x(s_bulk, x_bulk);
285 double max_legal_error = 1.0e-5;
287 for (
unsigned i = 0;
i <
ndim + 1;
i++)
289 error += fabs(x[
i] - x_bulk[
i]);
291 if (error > max_legal_error)
293 std::ostringstream error_stream;
294 error_stream <<
"difference in Eulerian posn from bulk and face: "
295 << error <<
" exceeds threshold " << max_legal_error
298 OOMPH_CURRENT_FUNCTION,
299 OOMPH_EXCEPTION_LOCATION);
310 bulk_el_pt->interpolated_u_nst(s_bulk, veloc);
314 bulk_el_pt->get_traction(s_bulk, normal, traction);
318 double rate_of_work = 0.0;
319 for (
unsigned i = 0;
i <
ndim + 1;
i++)
321 rate_of_work += traction[
i] * veloc[
i];
325 rate_of_work_integral += rate_of_work *
W;
327 if (outfile.is_open())
330 for (
unsigned i = 0;
i <
ndim + 1;
i++)
332 outfile << x[
i] <<
" ";
336 for (
unsigned i = 0;
i <
ndim + 1;
i++)
338 outfile << traction[
i] <<
" ";
342 for (
unsigned i = 0;
i <
ndim + 1;
i++)
344 outfile << veloc[
i] <<
" ";
348 for (
unsigned i = 0;
i <
ndim + 1;
i++)
350 outfile << normal[
i] <<
" ";
354 for (
unsigned i = 0;
i <
ndim + 1;
i++)
356 outfile << rate_of_work <<
" ";
359 outfile << std::endl;
363 return rate_of_work_integral;
371 double& rate_of_work_integral_n,
372 double& rate_of_work_integral_t)
374 std::ofstream dummy_file;
376 rate_of_work_integral_p,
377 rate_of_work_integral_n,
378 rate_of_work_integral_t);
386 double& rate_of_work_integral_p,
387 double& rate_of_work_integral_n,
388 double& rate_of_work_integral_t)
391 rate_of_work_integral_p = 0;
392 rate_of_work_integral_n = 0;
393 rate_of_work_integral_t = 0;
416 if (outfile.is_open()) outfile <<
"ZONE I=3, J=3" << std::endl;
419 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
423 for (
unsigned i = 0;
i <
ndim;
i++)
447 bulk_el_pt->interpolated_x(s_bulk, x_bulk);
449 double max_legal_error = 1.0e-5;
451 for (
unsigned i = 0;
i <
ndim + 1;
i++)
453 error += fabs(x[
i] - x_bulk[
i]);
455 if (error > max_legal_error)
457 std::ostringstream error_stream;
458 error_stream <<
"difference in Eulerian posn from bulk and face: "
459 << error <<
" exceeds threshold " << max_legal_error
462 OOMPH_CURRENT_FUNCTION,
463 OOMPH_EXCEPTION_LOCATION);
474 bulk_el_pt->interpolated_u_nst(s_bulk, veloc);
480 bulk_el_pt->get_traction(
481 s_bulk, normal, traction_p, traction_n, traction_t);
485 double rate_of_work_p = 0.0;
486 double rate_of_work_n = 0.0;
487 double rate_of_work_t = 0.0;
488 for (
unsigned i = 0;
i <
ndim + 1;
i++)
490 rate_of_work_p += traction_p[
i] * veloc[
i];
491 rate_of_work_n += traction_n[
i] * veloc[
i];
492 rate_of_work_t += traction_t[
i] * veloc[
i];
496 rate_of_work_integral_p += rate_of_work_p *
W;
497 rate_of_work_integral_n += rate_of_work_n *
W;
498 rate_of_work_integral_t += rate_of_work_t *
W;
500 if (outfile.is_open())
503 for (
unsigned i = 0;
i <
ndim + 1;
i++)
505 outfile << x[
i] <<
" ";
509 for (
unsigned i = 0;
i <
ndim + 1;
i++)
511 outfile << traction_p[
i] <<
" ";
515 for (
unsigned i = 0;
i <
ndim + 1;
i++)
517 outfile << traction_n[
i] <<
" ";
521 for (
unsigned i = 0;
i <
ndim + 1;
i++)
523 outfile << traction_t[
i] <<
" ";
527 for (
unsigned i = 0;
i <
ndim + 1;
i++)
529 outfile << veloc[
i] <<
" ";
533 for (
unsigned i = 0;
i <
ndim + 1;
i++)
535 outfile << normal[
i] <<
" ";
539 for (
unsigned i = 0;
i <
ndim + 1;
i++)
541 outfile << rate_of_work_p <<
" ";
545 for (
unsigned i = 0;
i <
ndim + 1;
i++)
547 outfile << rate_of_work_n <<
" ";
551 for (
unsigned i = 0;
i <
ndim + 1;
i++)
553 outfile << rate_of_work_t <<
" ";
556 outfile << std::endl;
565 std::ofstream dummy_file;
574 double kinetic_energy_flux_integral = 0.0;
596 if (outfile.is_open()) outfile <<
"ZONE I=3, J=3" << std::endl;
599 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
603 for (
unsigned i = 0;
i <
ndim;
i++)
627 bulk_el_pt->interpolated_x(s_bulk, x_bulk);
629 double max_legal_error = 1.0e-5;
631 for (
unsigned i = 0;
i <
ndim + 1;
i++)
633 error += fabs(x[
i] - x_bulk[
i]);
635 if (error > max_legal_error)
637 std::ostringstream error_stream;
638 error_stream <<
"difference in Eulerian posn from bulk and face: "
639 << error <<
" exceeds threshold " << max_legal_error
642 OOMPH_CURRENT_FUNCTION,
643 OOMPH_EXCEPTION_LOCATION);
653 bulk_el_pt->interpolated_u_nst(s_bulk, veloc);
655 double kin_energy = 0.0;
656 for (
unsigned i = 0;
i <
ndim + 1;
i++)
658 kin_energy += veloc[
i] * veloc[
i];
663 double kin_energy_flux = 0.0;
664 for (
unsigned i = 0;
i <
ndim + 1;
i++)
666 kin_energy_flux += kin_energy * normal[
i] * veloc[
i];
670 kinetic_energy_flux_integral += kin_energy_flux *
W;
672 if (outfile.is_open())
675 for (
unsigned i = 0;
i <
ndim + 1;
i++)
677 outfile << x[
i] <<
" ";
681 for (
unsigned i = 0;
i <
ndim + 1;
i++)
683 outfile << veloc[
i] <<
" ";
687 for (
unsigned i = 0;
i <
ndim + 1;
i++)
689 outfile << normal[
i] <<
" ";
693 outfile << kin_energy_flux <<
" ";
695 outfile << std::endl;
699 return kinetic_energy_flux_integral;
706 std::ofstream dummy_file;
715 double volume_flux_integral = 0.0;
737 if (outfile.is_open()) outfile <<
"ZONE I=3, J=3" << std::endl;
740 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
744 for (
unsigned i = 0;
i <
ndim;
i++)
769 bulk_el_pt->interpolated_x(s_bulk, x_bulk);
771 double max_legal_error = 1.0e-5;
773 for (
unsigned i = 0;
i <
ndim + 1;
i++)
775 error += fabs(x[
i] - x_bulk[
i]);
777 if (error > max_legal_error)
779 std::ostringstream error_stream;
780 error_stream <<
"difference in Eulerian posn from bulk and face: "
781 << error <<
" exceeds threshold " << max_legal_error
784 OOMPH_CURRENT_FUNCTION,
785 OOMPH_EXCEPTION_LOCATION);
795 bulk_el_pt->interpolated_u_nst(s_bulk, veloc);
798 double volume_flux = 0.0;
799 for (
unsigned i = 0;
i <
ndim + 1;
i++)
801 volume_flux += normal[
i] * veloc[
i];
805 volume_flux_integral += volume_flux *
W;
807 if (outfile.is_open())
810 for (
unsigned i = 0;
i <
ndim + 1;
i++)
812 outfile << x[
i] <<
" ";
816 for (
unsigned i = 0;
i <
ndim + 1;
i++)
818 outfile << veloc[
i] <<
" ";
822 for (
unsigned i = 0;
i <
ndim + 1;
i++)
824 outfile << normal[
i] <<
" ";
828 outfile << volume_flux <<
" ";
830 outfile << std::endl;
834 return volume_flux_integral;
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.
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 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....
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 power input and various other fluxes over the...
Vector< double > drag_force(std::ofstream &outfile)
Get drag force (traction acting on fluid) Doc in outfile.
double get_kinetic_energy_flux(std::ofstream &outfile)
Get integral of kinetic energy flux and doc.
unsigned Dim
The highest dimension of the problem.
void get_rate_of_traction_work_components(double &rate_of_work_integral_p, double &rate_of_work_integral_n, double &rate_of_work_integral_t)
Get integral of instantaneous rate of work done by the traction that's exerted onto the fluid,...
NavierStokesSurfacePowerElement(FiniteElement *const &element_pt, const int &face_index)
Constructor, which takes a "bulk" element and the value of the index and its limit.
double get_rate_of_traction_work()
Get integral of instantaneous rate of work done by the traction that's exerted onto the fluid.
double get_kinetic_energy_flux()
Get integral of kinetic energy flux.
Vector< double > drag_force()
Get drag force (traction acting on fluid)
double get_volume_flux(std::ofstream &outfile)
Get integral of volume flux and doc.
double get_rate_of_traction_work(std::ofstream &outfile)
Get integral of instantaneous rate of work done by the traction that's exerted onto the fluid....
void get_rate_of_traction_work_components(std::ofstream &outfile, double &rate_of_work_integral_p, double &rate_of_work_integral_n, double &rate_of_work_integral_t)
Get integral of instantaneous rate of work done by the traction that's exerted onto the fluid,...
double get_volume_flux()
Get integral of volume flux.
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
The "global" intrinsic coordinate of the element when viewed as part of a geometric object should be ...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
An OomphLibError object which should be thrown when an run-time error is encountered....
//////////////////////////////////////////////////////////////////// ////////////////////////////////...