32 #ifndef OOMPH_NAVIER_STOKES_SURFACE_POWER_ELEMENTS_HEADER 33 #define OOMPH_NAVIER_STOKES_SURFACE_POWER_ELEMENTS_HEADER 37 #include <oomph-lib-config.h> 42 #include "../generic/Qelements.h" 54 template <
class ELEMENT>
83 const unsigned &
i)
const 91 std::ofstream dummy_file;
126 if (outfile.is_open()) outfile <<
"ZONE I=3" << std::endl;
129 for (
unsigned ipt=0;ipt<n_intpt;ipt++)
157 bulk_el_pt->interpolated_x(s_bulk,x_bulk);
159 double max_legal_error=1.0e-5;
161 for(
unsigned i=0;
i<ndim+1;
i++)
163 error+=fabs(x[
i]- x_bulk[
i]);
165 if (error>max_legal_error)
167 std::ostringstream error_stream;
168 error_stream <<
"difference in Eulerian posn from bulk and face: " 169 << error <<
" exceeds threshold " << max_legal_error
173 OOMPH_CURRENT_FUNCTION,
174 OOMPH_EXCEPTION_LOCATION);
184 bulk_el_pt->interpolated_u_nst(s_bulk,veloc);
188 bulk_el_pt->get_traction(s_bulk,normal,traction);
191 for (
unsigned i=0;
i<ndim+1;
i++)
193 drag[
i]+=traction[
i]*
W;
196 if (outfile.is_open())
199 for(
unsigned i=0;
i<ndim+1;
i++)
201 outfile << x[
i] <<
" ";
205 for(
unsigned i=0;
i<ndim+1;
i++)
207 outfile << traction[
i] <<
" ";
212 for(
unsigned i=0;
i<ndim+1;
i++)
214 outfile << normal[
i] <<
" ";
217 outfile << std::endl;
227 std::ofstream dummy_file;
239 double rate_of_work_integral=0.0;
262 if (outfile.is_open()) outfile <<
"ZONE I=3, J=3" << std::endl;
265 for (
unsigned ipt=0;ipt<n_intpt;ipt++)
293 bulk_el_pt->interpolated_x(s_bulk,x_bulk);
295 double max_legal_error=1.0e-5;
297 for(
unsigned i=0;
i<ndim+1;
i++)
299 error+=fabs(x[
i]- x_bulk[
i]);
301 if (error>max_legal_error)
303 std::ostringstream error_stream;
304 error_stream <<
"difference in Eulerian posn from bulk and face: " 305 << error <<
" exceeds threshold " << max_legal_error
309 OOMPH_CURRENT_FUNCTION,
310 OOMPH_EXCEPTION_LOCATION);
321 bulk_el_pt->interpolated_u_nst(s_bulk,veloc);
325 bulk_el_pt->get_traction(s_bulk,normal,traction);
329 double rate_of_work=0.0;
330 for (
unsigned i=0;
i<ndim+1;
i++)
332 rate_of_work+=traction[
i]*veloc[
i];
336 rate_of_work_integral+=rate_of_work*
W;
338 if (outfile.is_open())
341 for(
unsigned i=0;
i<ndim+1;
i++)
343 outfile << x[
i] <<
" ";
347 for(
unsigned i=0;
i<ndim+1;
i++)
349 outfile << traction[
i] <<
" ";
353 for(
unsigned i=0;
i<ndim+1;
i++)
355 outfile << veloc[
i] <<
" ";
359 for(
unsigned i=0;
i<ndim+1;
i++)
361 outfile << normal[
i] <<
" ";
365 for(
unsigned i=0;
i<ndim+1;
i++)
367 outfile << rate_of_work <<
" ";
370 outfile << std::endl;
374 return rate_of_work_integral;
384 double& rate_of_work_integral_n,
385 double& rate_of_work_integral_t)
387 std::ofstream dummy_file;
389 rate_of_work_integral_p,
390 rate_of_work_integral_n,
391 rate_of_work_integral_t);
400 double& rate_of_work_integral_p,
401 double& rate_of_work_integral_n,
402 double& rate_of_work_integral_t)
406 rate_of_work_integral_p=0;
407 rate_of_work_integral_n=0;
408 rate_of_work_integral_t=0;
431 if (outfile.is_open()) outfile <<
"ZONE I=3, J=3" << std::endl;
434 for (
unsigned ipt=0;ipt<n_intpt;ipt++)
462 bulk_el_pt->interpolated_x(s_bulk,x_bulk);
464 double max_legal_error=1.0e-5;
466 for(
unsigned i=0;
i<ndim+1;
i++)
468 error+=fabs(x[
i]- x_bulk[
i]);
470 if (error>max_legal_error)
472 std::ostringstream error_stream;
473 error_stream <<
"difference in Eulerian posn from bulk and face: " 474 << error <<
" exceeds threshold " << max_legal_error
478 OOMPH_CURRENT_FUNCTION,
479 OOMPH_EXCEPTION_LOCATION);
490 bulk_el_pt->interpolated_u_nst(s_bulk,veloc);
496 bulk_el_pt->get_traction(s_bulk,normal,traction_p,traction_n,traction_t);
500 double rate_of_work_p=0.0;
501 double rate_of_work_n=0.0;
502 double rate_of_work_t=0.0;
503 for (
unsigned i=0;
i<ndim+1;
i++)
505 rate_of_work_p+=traction_p[
i]*veloc[
i];
506 rate_of_work_n+=traction_n[
i]*veloc[
i];
507 rate_of_work_t+=traction_t[
i]*veloc[
i];
511 rate_of_work_integral_p+=rate_of_work_p*
W;
512 rate_of_work_integral_n+=rate_of_work_n*
W;
513 rate_of_work_integral_t+=rate_of_work_t*
W;
515 if (outfile.is_open())
518 for(
unsigned i=0;
i<ndim+1;
i++)
520 outfile << x[
i] <<
" ";
524 for(
unsigned i=0;
i<ndim+1;
i++)
526 outfile << traction_p[
i] <<
" ";
530 for(
unsigned i=0;
i<ndim+1;
i++)
532 outfile << traction_n[
i] <<
" ";
536 for(
unsigned i=0;
i<ndim+1;
i++)
538 outfile << traction_t[
i] <<
" ";
542 for(
unsigned i=0;
i<ndim+1;
i++)
544 outfile << veloc[
i] <<
" ";
548 for(
unsigned i=0;
i<ndim+1;
i++)
550 outfile << normal[
i] <<
" ";
554 for(
unsigned i=0;
i<ndim+1;
i++)
556 outfile << rate_of_work_p <<
" ";
560 for(
unsigned i=0;
i<ndim+1;
i++)
562 outfile << rate_of_work_n <<
" ";
566 for(
unsigned i=0;
i<ndim+1;
i++)
568 outfile << rate_of_work_t <<
" ";
571 outfile << std::endl;
583 std::ofstream dummy_file;
593 double kinetic_energy_flux_integral=0.0;
615 if (outfile.is_open()) outfile <<
"ZONE I=3, J=3" << std::endl;
618 for (
unsigned ipt=0;ipt<n_intpt;ipt++)
646 bulk_el_pt->interpolated_x(s_bulk,x_bulk);
648 double max_legal_error=1.0e-5;
650 for(
unsigned i=0;
i<ndim+1;
i++)
652 error+=fabs(x[
i]- x_bulk[
i]);
654 if (error>max_legal_error)
656 std::ostringstream error_stream;
657 error_stream <<
"difference in Eulerian posn from bulk and face: " 658 << error <<
" exceeds threshold " << max_legal_error
662 OOMPH_CURRENT_FUNCTION,
663 OOMPH_EXCEPTION_LOCATION);
673 bulk_el_pt->interpolated_u_nst(s_bulk,veloc);
675 double kin_energy=0.0;
676 for (
unsigned i=0;
i<ndim+1;
i++)
678 kin_energy+=veloc[
i]*veloc[
i];
683 double kin_energy_flux=0.0;
684 for (
unsigned i=0;
i<ndim+1;
i++)
686 kin_energy_flux+=kin_energy*normal[
i]*veloc[
i];
690 kinetic_energy_flux_integral+=kin_energy_flux*
W;
692 if (outfile.is_open())
695 for(
unsigned i=0;
i<ndim+1;
i++)
697 outfile << x[
i] <<
" ";
701 for(
unsigned i=0;
i<ndim+1;
i++)
703 outfile << veloc[
i] <<
" ";
707 for(
unsigned i=0;
i<ndim+1;
i++)
709 outfile << normal[
i] <<
" ";
713 outfile << kin_energy_flux <<
" ";
715 outfile << std::endl;
720 return kinetic_energy_flux_integral;
728 std::ofstream dummy_file;
737 double volume_flux_integral=0.0;
759 if (outfile.is_open()) outfile <<
"ZONE I=3, J=3" << std::endl;
762 for (
unsigned ipt=0;ipt<n_intpt;ipt++)
791 bulk_el_pt->interpolated_x(s_bulk,x_bulk);
793 double max_legal_error=1.0e-5;
795 for(
unsigned i=0;
i<ndim+1;
i++)
797 error+=fabs(x[
i]- x_bulk[
i]);
799 if (error>max_legal_error)
801 std::ostringstream error_stream;
802 error_stream <<
"difference in Eulerian posn from bulk and face: " 803 << error <<
" exceeds threshold " << max_legal_error
807 OOMPH_CURRENT_FUNCTION,
808 OOMPH_EXCEPTION_LOCATION);
818 bulk_el_pt->interpolated_u_nst(s_bulk,veloc);
821 double volume_flux=0.0;
822 for (
unsigned i=0;
i<ndim+1;
i++)
824 volume_flux+=normal[
i]*veloc[
i];
828 volume_flux_integral+=volume_flux*
W;
830 if (outfile.is_open())
833 for(
unsigned i=0;
i<ndim+1;
i++)
835 outfile << x[
i] <<
" ";
839 for(
unsigned i=0;
i<ndim+1;
i++)
841 outfile << veloc[
i] <<
" ";
845 for(
unsigned i=0;
i<ndim+1;
i++)
847 outfile << normal[
i] <<
" ";
851 outfile << volume_flux <<
" ";
853 outfile << std::endl;
858 return volume_flux_integral;
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.
A general Finite Element class.
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, when viewed as part of a compound geometric object is specified using the boundary coordinate defined by the mesh. Note: Boundary coordinates will have been set up when creating the underlying mesh, and their values will have been stored at the nodes.
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...
Vector< double > drag_force(std::ofstream &outfile)
Get drag force (traction acting on fluid) Doc in outfile.
double get_volume_flux(std::ofstream &outfile)
Get integral of volume flux and doc.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
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...
double get_kinetic_energy_flux(std::ofstream &outfile)
Get integral of kinetic energy flux and doc.
double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s...
double get_rate_of_traction_work()
Get integral of instantaneous rate of work done by the traction that's exerted onto the fluid...
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
double get_volume_flux()
Get integral of volume flux.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
NavierStokesSurfacePowerElement(FiniteElement *const &element_pt, const int &face_index)
Vector< double > drag_force()
Get drag force (traction acting on fluid)
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
unsigned Dim
The highest dimension of the problem.
unsigned ndim() const
Access function to # of Eulerian coordinates.
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 ...
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...
unsigned dim() const
Return the spatial dimension of the element, i.e. the number of local coordinates required to paramet...
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...
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
double get_kinetic_energy_flux()
Get integral of kinetic energy flux.
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...
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...