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++)
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
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++)
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++)
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
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++)
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++)
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
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++)
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++)
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
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++)
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++)
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
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++)
828 outfile << volume_flux <<
" ";
830 outfile << std::endl;
834 return volume_flux_integral;
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
RowVector3d w
Definition: Matrix_resize_int.cpp:3
Definition: elements.h:4338
int & face_index()
Definition: elements.h:4626
void outer_unit_normal(const Vector< double > &s, Vector< double > &unit_normal) const
Compute outer unit normal at the specified local coordinate.
Definition: elements.cc:6006
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Definition: elements.h:4497
FiniteElement *& bulk_element_pt()
Pointer to higher-dimensional "bulk" element.
Definition: elements.h:4735
double interpolated_x(const Vector< double > &s, const unsigned &i) const
Definition: elements.h:4528
double J_eulerian(const Vector< double > &s) const
Definition: elements.cc:5242
void get_local_coordinate_in_bulk(const Vector< double > &s, Vector< double > &s_bulk) const
Definition: elements.cc:6384
Definition: elements.h:4998
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
virtual void build_face_element(const int &face_index, FaceElement *face_element_pt)
Definition: elements.cc:5132
unsigned dim() const
Definition: elements.h:2611
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Definition: elements.h:1963
unsigned ndim() const
Access function to # of Eulerian coordinates.
Definition: geom_objects.h:177
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.
Definition: navier_stokes_surface_power_elements.h:52
Vector< double > drag_force(std::ofstream &outfile)
Definition: navier_stokes_surface_power_elements.h:93
double get_kinetic_energy_flux(std::ofstream &outfile)
Get integral of kinetic energy flux and doc.
Definition: navier_stokes_surface_power_elements.h:571
unsigned Dim
The highest dimension of the problem.
Definition: navier_stokes_surface_power_elements.h:840
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)
Definition: navier_stokes_surface_power_elements.h:370
NavierStokesSurfacePowerElement(FiniteElement *const &element_pt, const int &face_index)
Definition: navier_stokes_surface_power_elements.h:56
double get_rate_of_traction_work()
Definition: navier_stokes_surface_power_elements.h:217
double get_kinetic_energy_flux()
Get integral of kinetic energy flux.
Definition: navier_stokes_surface_power_elements.h:563
Vector< double > drag_force()
Get drag force (traction acting on fluid)
Definition: navier_stokes_surface_power_elements.h:84
double get_volume_flux(std::ofstream &outfile)
Get integral of volume flux and doc.
Definition: navier_stokes_surface_power_elements.h:712
double get_rate_of_traction_work(std::ofstream &outfile)
Definition: navier_stokes_surface_power_elements.h:226
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)
Definition: navier_stokes_surface_power_elements.h:385
double get_volume_flux()
Get integral of volume flux.
Definition: navier_stokes_surface_power_elements.h:704
double zeta_nodal(const unsigned &n, const unsigned &k, const unsigned &i) const
Definition: navier_stokes_surface_power_elements.h:75
unsigned ndim() const
Return (Eulerian) spatial dimension of the node.
Definition: nodes.h:1054
Definition: oomph_definitions.h:222
RealScalar s
Definition: level1_cplx_impl.h:130
char char char int int * k
Definition: level2_impl.h:374
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
int error
Definition: calibrate.py:297
@ W
Definition: quadtree.h:63
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86