interface_elements.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Header file for (one-dimensional) free surface elements
27 // Include guards, to prevent multiple includes
28 #ifndef OOMPH_INTERFACE_ELEMENTS_HEADER
29 #define OOMPH_INTERFACE_ELEMENTS_HEADER
30 
31 // Config header generated by autoconfig
32 #ifdef HAVE_CONFIG_H
33 #include <oomph-lib-config.h>
34 #endif
35 
36 #include "../generic/elements.h"
37 #include "../generic/spines.h"
38 #include "../generic/shape.h"
39 #include "../generic/hijacked_elements.h"
40 
41 namespace oomph
42 {
43  //========================================================================
52  //=========================================================================
54  {
55  private:
58  typedef void (*WallUnitNormalFctPt)(const Vector<double>& x,
59  Vector<double>& unit_normal);
60 
65 
68 
70  double* Ca_pt;
71 
72  protected:
78 
82 
86  virtual int kinematic_local_eqn(const unsigned& n) = 0;
87 
91  {
92 #ifdef PARANOID
94  {
95 #endif
96  (*Wall_unit_normal_fct_pt)(x, normal);
97 #ifdef PARANOID
98  }
99  else
100  {
101  throw OomphLibError("Wall unit normal fct has not been set",
102  "FluidInterfaceBoundingElement::wall_unit_normal()",
104  }
105 #endif
106  }
107 
111  inline void update_in_external_fd(const unsigned& i)
112  {
113  // Update the bulk element
115  }
116 
119  // function to take care of the remesh)
120  inline void reset_in_external_fd(const unsigned& i) {}
121 
125  {
126  // Update the bulk element
128  }
129 
130  public:
134  Contact_angle_pt(0),
135  Ca_pt(0),
137  {
138  }
139 
142  {
144  }
145 
148  {
150  }
151 
154  {
156  }
157 
163  void set_contact_angle(double* const& angle_pt, const bool& strong = true);
164 
166  double*& contact_angle_pt()
167  {
168  return Contact_angle_pt;
169  }
170 
172  double*& ca_pt()
173  {
174  return Ca_pt;
175  }
176 
178  double ca()
179  {
180 #ifdef PARANOID
181  if (Ca_pt != 0)
182  {
183 #endif
184  return *Ca_pt;
185 #ifdef PARANOID
186  }
187  else
188  {
189  throw OomphLibError("Capillary number has not been set",
190  "FluidInterfaceBoundingElement::ca()",
192  }
193 #endif
194  }
195 
196 
198  double& contact_angle()
199  {
200 #ifdef PARANOID
201  if (Contact_angle_pt == 0)
202  {
203  std::string error_message = "Contact angle not set\n";
204  error_message +=
205  "Please use FluidInterfaceBoundingElement::set_contact_angle()\n";
206  throw OomphLibError(
208  }
209 #endif
210  return *Contact_angle_pt;
211  }
212 
215  {
216  // Add the residual contributions using a dummy matrix
218  residuals, GeneralisedElement::Dummy_matrix, 0);
219  }
220 
223  Vector<double>& residuals,
224  DenseMatrix<double>& jacobian,
225  unsigned flag) = 0;
226 
227 
236  Vector<double>& residuals,
237  DenseMatrix<double>& jacobian,
238  const unsigned& flag,
239  const Shape& psif,
240  const DShape& dpsifds,
241  const Vector<double>& interpolated_n,
242  const double& W)
243  {
244  }
245 
247  void output(std::ostream& outfile)
248  {
249  FiniteElement::output(outfile);
250  }
251 
253  void output(std::ostream& outfile, const unsigned& n_plot)
254  {
255  FiniteElement::output(outfile, n_plot);
256  }
257 
259  void output(FILE* file_pt)
260  {
261  FiniteElement::output(file_pt);
262  }
263 
265  void output(FILE* file_pt, const unsigned& n_plot)
266  {
267  FiniteElement::output(file_pt, n_plot);
268  }
269  };
270 
271 
272  //==========================================================================
274  //==========================================================================
277  {
278  protected:
285  Vector<double>& residuals, DenseMatrix<double>& jacobian, unsigned flag);
286 
287  public:
290  };
291 
292 
293  //==========================================================================
295  //==========================================================================
297  {
298  protected:
305  Vector<double>& residuals, DenseMatrix<double>& jacobian, unsigned flag);
306 
307  public:
310  };
311 
312 
313  //=======================================================================
319  //======================================================================
320  class FluidInterfaceElement : public virtual FaceElement
321  {
322  // Make the bounding element class a friend
324 
325  private:
327  double* Ca_pt;
328 
330  double* St_pt;
331 
334 
335 
336  protected:
339 
345 
348 
351 
356  virtual int kinematic_local_eqn(const unsigned& n) = 0;
357 
361  {
362 #ifdef PARANOID
364  {
365  throw OomphLibError("No external pressure has been set\n",
368  }
369 #endif
372  }
373 
380  Vector<double>& residuals, DenseMatrix<double>& jacobian, unsigned flag);
381 
404  const Shape& psi,
405  const DShape& dpsids,
406  const DenseMatrix<double>& interpolated_t,
408  DShape& dpsidS,
409  DShape& dpsidS_div) = 0;
410 
427  Vector<double>& residuals,
428  DenseMatrix<double>& jacobian,
429  const unsigned& flag,
430  const Shape& psif,
431  const DShape& dpsifds,
432  const DShape& dpsifdS,
433  const DShape& dpsifdS_div,
434  const Vector<double>& s,
436  const Vector<double>& interpolated_n,
437  const double& W,
438  const double& J)
439  {
440  }
441 
442  public:
445  {
446  // Initialise pointer to capillary number
447  Ca_pt = 0;
448 
449  // Set the Strouhal number to the default value
451  }
452 
458  virtual double sigma(const Vector<double>& s_local)
459  {
460  return 1.0;
461  }
462 
465  {
466  // Add the residual contributions
468  residuals, GeneralisedElement::Dummy_matrix, 0);
469  }
470 
471 
473  const double& ca() const
474  {
475 #ifdef PARANOID
476  if (Ca_pt != 0)
477  {
478 #endif
479  return *Ca_pt;
480 #ifdef PARANOID
481  }
482  else
483  {
484  throw OomphLibError("Capillary number has not been set",
485  "FluidInterfaceElement::ca()",
487  }
488 #endif
489  }
490 
492  double*& ca_pt()
493  {
494  return Ca_pt;
495  }
496 
498  const double& st() const
499  {
500  return *St_pt;
501  }
502 
504  double*& st_pt()
505  {
506  return St_pt;
507  }
508 
510  double u(const unsigned& j, const unsigned& i)
511  {
512  return node_pt(j)->value(U_index_interface[i]);
513  }
514 
516  double interpolated_u(const Vector<double>& s, const unsigned& i);
517 
519  double pext() const
520  {
521  // If the external pressure has not been set, then return a
522  // default value of zero.
523  if (Pext_data_pt == 0)
524  {
525  return 0.0;
526  }
527  // Otherwise return the appropriate value
528  else
529  {
531  }
532  }
533 
539  void set_external_pressure_data(Data* external_pressure_data_pt)
540  {
541 #ifdef PARANOID
542  if (external_pressure_data_pt->nvalue() != 1)
543  {
544  std::ostringstream error_message;
545  error_message
546  << "External pressure Data must only contain a single value!\n"
547  << "This one contains " << external_pressure_data_pt->nvalue()
548  << std::endl;
549 
550  throw OomphLibError(error_message.str(),
553  }
554 #endif
555 
556  // Store pointer explicitly
557  Pext_data_pt = external_pressure_data_pt;
558 
559  // Add the external pressure to the element's external Data?
560  // But do not finite-difference with respect to it
561  this->add_external_data(Pext_data_pt, false);
562 
563  // The external pressure has just been promoted to become
564  // external Data of this element -- what is its number?
566 
567  // Index of pressure value in Data object
568  Index_of_external_pressure_value = 0;
569  }
570 
579  Data* external_pressure_data_pt,
580  const unsigned& index_of_external_pressure_value)
581  {
582  // Index of pressure value in Data object
583  Index_of_external_pressure_value = index_of_external_pressure_value;
584 
585 #ifdef PARANOID
586  if (index_of_external_pressure_value >=
587  external_pressure_data_pt->nvalue())
588  {
589  std::ostringstream error_message;
590  error_message << "External pressure Data only contains "
591  << external_pressure_data_pt->nvalue() << " values\n"
592  << "You have declared value "
593  << index_of_external_pressure_value
594  << " to be the value representing the pressure\n"
595  << std::endl;
596  throw OomphLibError(error_message.str(),
599  }
600 #endif
601 
602  // Store pointer explicitly
603  Pext_data_pt = external_pressure_data_pt;
604 
605  // Add the external pressure to the element's external Data?
606  // But do not finite-difference with respect to it
607  this->add_external_data(Pext_data_pt, false);
608 
609  // The external pressure has just been promoted to become
610  // external Data of this element -- what is its number?
612  }
613 
614 
618  const int& face_index)
619  {
620  throw OomphLibError("Virtual function not yet implemented",
623  return 0;
624  }
625 
626 
634 
636  void output(std::ostream& outfile)
637  {
638  FiniteElement::output(outfile);
639  }
640 
642  void output(std::ostream& outfile, const unsigned& n_plot);
643 
645  void output(FILE* file_pt)
646  {
647  FiniteElement::output(file_pt);
648  }
649 
651  void output(FILE* file_pt, const unsigned& n_plot);
652  };
653 
654 
655  //=============================================================
659  //=============================================================
661  {
662  public:
663  // Empty Constructor
665 
666  protected:
669  const Shape& psi,
670  const DShape& dpsids,
671  const DenseMatrix<double>& interpolated_t,
672  const Vector<double>& interpolated_x,
673  DShape& surface_gradient,
674  DShape& surface_divergence);
675  };
676 
677 
678  //=============================================================
683  //=============================================================
685  {
686  public:
687  // Empty Constructor
689 
690  protected:
693  const Shape& psi,
694  const DShape& dpsids,
695  const DenseMatrix<double>& interpolated_t,
696  const Vector<double>& interpolated_x,
697  DShape& surface_gradient,
698  DShape& surface_divergence);
699  };
700 
701 
702  //=============================================================
707  //=============================================================
709  {
710  public:
711  // Empty Constructor
713 
714  protected:
717  const Shape& psi,
718  const DShape& dpsids,
719  const DenseMatrix<double>& interpolated_t,
720  const Vector<double>& interpolated_x,
721  DShape& surface_gradient,
722  DShape& surface_divergence);
723  };
724 
725 
726 } // namespace oomph
727 
728 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
Definition: interface_elements.h:685
double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &surface_gradient, DShape &surface_divergence)
Fill in the specific surface derivative calculations.
Definition: interface_elements.cc:798
AxisymmetricDerivatives()
Definition: interface_elements.h:688
Definition: shape.h:278
Definition: nodes.h:86
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
double value(const unsigned &i) const
Definition: nodes.h:293
Definition: elements.h:4338
int & face_index()
Definition: elements.h:4626
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
unsigned & bulk_node_number(const unsigned &n)
Definition: elements.h:4825
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
virtual void output(std::ostream &outfile)
Definition: elements.h:3050
virtual void node_update()
Definition: elements.cc:5072
Definition: interface_elements.h:54
double *& contact_angle_pt()
Access function to the pointer specifying the prescribed contact angle.
Definition: interface_elements.h:166
Vector< unsigned > U_index_interface_boundary
Definition: interface_elements.h:81
void(* WallUnitNormalFctPt)(const Vector< double > &x, Vector< double > &unit_normal)
Definition: interface_elements.h:58
virtual int kinematic_local_eqn(const unsigned &n)=0
void wall_unit_normal(const Vector< double > &x, Vector< double > &normal)
Definition: interface_elements.h:90
double * Contact_angle_pt
Pointer to the desired value of the contact angle (if any)
Definition: interface_elements.h:67
WallUnitNormalFctPt wall_unit_normal_fct_pt() const
Access function: Pointer to wall unit normal function. Const version.
Definition: interface_elements.h:147
WallUnitNormalFctPt & wall_unit_normal_fct_pt()
Access function: Pointer to wall unit normal function.
Definition: interface_elements.h:141
virtual void add_additional_residual_contributions_interface_boundary(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag, const Shape &psif, const DShape &dpsifds, const Vector< double > &interpolated_n, const double &W)
Definition: interface_elements.h:235
double & contact_angle()
Return value of the contact angle.
Definition: interface_elements.h:198
virtual void fill_in_generic_residual_contribution_interface_boundary(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)=0
Calculate the generic residuals contribution.
void reset_after_external_fd()
Definition: interface_elements.h:124
void reset_in_external_fd(const unsigned &i)
Definition: interface_elements.h:120
double *& ca_pt()
Access function to the pointer specifying the capillary number.
Definition: interface_elements.h:172
void output(std::ostream &outfile)
Overload the output function.
Definition: interface_elements.h:247
void set_contact_angle(double *const &angle_pt, const bool &strong=true)
Definition: interface_elements.cc:47
void output(FILE *file_pt)
Overload the C-style output function.
Definition: interface_elements.h:259
void update_in_external_fd(const unsigned &i)
Definition: interface_elements.h:111
FluidInterfaceBoundingElement()
Constructor.
Definition: interface_elements.h:132
WallUnitNormalFctPt Wall_unit_normal_fct_pt
Definition: interface_elements.h:64
double * Ca_pt
Pointer to the desired value of the capillary number.
Definition: interface_elements.h:70
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Calculate the residuals.
Definition: interface_elements.h:214
Vector< unsigned > & u_index_interface_boundary()
Access for nodal index at which the velocity components are stored.
Definition: interface_elements.h:153
double ca()
Return the value of the capillary number.
Definition: interface_elements.h:178
void output(FILE *file_pt, const unsigned &n_plot)
C-style Output function.
Definition: interface_elements.h:265
void output(std::ostream &outfile, const unsigned &n_plot)
Output function.
Definition: interface_elements.h:253
unsigned Contact_angle_flag
Definition: interface_elements.h:77
Definition: interface_elements.h:321
virtual double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &dpsidS, DShape &dpsidS_div)=0
virtual void add_additional_residual_contributions_interface(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag, const Shape &psif, const DShape &dpsifds, const DShape &dpsifdS, const DShape &dpsifdS_div, const Vector< double > &s, const Vector< double > &interpolated_x, const Vector< double > &interpolated_n, const double &W, const double &J)
Definition: interface_elements.h:426
const double & st() const
The value of the Strouhal number.
Definition: interface_elements.h:498
double *& ca_pt()
Pointer to the Capillary number.
Definition: interface_elements.h:492
unsigned Index_of_external_pressure_value
Which of the values in Pext_data_pt stores the external pressure.
Definition: interface_elements.h:350
int External_data_number_of_external_pressure
Definition: interface_elements.h:344
virtual FluidInterfaceBoundingElement * make_bounding_element(const int &face_index)
Definition: interface_elements.h:617
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Calculate the residuals by calling the generic residual contribution.
Definition: interface_elements.h:464
FluidInterfaceElement()
Constructor, set the default values of the booleans and pointers (null)
Definition: interface_elements.h:444
double u(const unsigned &j, const unsigned &i)
Return the i-th velocity component at local node j.
Definition: interface_elements.h:510
double *& st_pt()
The pointer to the Strouhal number.
Definition: interface_elements.h:504
virtual int kinematic_local_eqn(const unsigned &n)=0
Vector< unsigned > U_index_interface
Nodal index at which the i-th velocity component is stored.
Definition: interface_elements.h:338
void set_external_pressure_data(Data *external_pressure_data_pt)
Definition: interface_elements.h:539
double pext() const
Return the value of the external pressure.
Definition: interface_elements.h:519
virtual double sigma(const Vector< double > &s_local)
Definition: interface_elements.h:458
virtual void hijack_kinematic_conditions(const Vector< unsigned > &bulk_node_number)=0
void set_external_pressure_data(Data *external_pressure_data_pt, const unsigned &index_of_external_pressure_value)
Definition: interface_elements.h:578
double interpolated_u(const Vector< double > &s, const unsigned &i)
Calculate the i-th velocity component at the local coordinate s.
Definition: interface_elements.cc:442
Data * Pext_data_pt
Pointer to the Data item that stores the external pressure.
Definition: interface_elements.h:347
void output(std::ostream &outfile)
Overload the output function.
Definition: interface_elements.h:636
const double & ca() const
The value of the Capillary number.
Definition: interface_elements.h:473
int pext_local_eqn()
Definition: interface_elements.h:360
void output(FILE *file_pt)
Overload the C-style output function.
Definition: interface_elements.h:645
double * Ca_pt
Pointer to the Capillary number.
Definition: interface_elements.h:327
static double Default_Physical_Constant_Value
Default value for physical constants.
Definition: interface_elements.h:333
double * St_pt
Pointer to the Strouhal number.
Definition: interface_elements.h:330
virtual void fill_in_generic_residual_contribution_interface(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Definition: interface_elements.cc:471
unsigned nexternal_data() const
Return the number of external data objects.
Definition: elements.h:829
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:307
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
int external_local_eqn(const unsigned &i, const unsigned &j)
Definition: elements.h:311
Definition: interface_elements.h:661
double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &surface_gradient, DShape &surface_divergence)
Fill in the specific surface derivative calculations.
Definition: interface_elements.cc:757
LineDerivatives()
Definition: interface_elements.h:664
Specialisation of the interface boundary constraint to a line.
Definition: interface_elements.h:297
LineFluidInterfaceBoundingElement()
Constructor.
Definition: interface_elements.h:309
void fill_in_generic_residual_contribution_interface_boundary(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Add contribution to element's residual vector and Jacobian.
Definition: interface_elements.cc:224
double value(const unsigned &i) const
Definition: nodes.cc:2408
Definition: oomph_definitions.h:222
Specialisation of the interface boundary constraint to a point.
Definition: interface_elements.h:277
PointFluidInterfaceBoundingElement()
Constructor.
Definition: interface_elements.h:289
void fill_in_generic_residual_contribution_interface_boundary(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Add contribution to element's residual vector and Jacobian.
Definition: interface_elements.cc:86
Definition: shape.h:76
Definition: interface_elements.h:709
double compute_surface_derivatives(const Shape &psi, const DShape &dpsids, const DenseMatrix< double > &interpolated_t, const Vector< double > &interpolated_x, DShape &surface_gradient, DShape &surface_divergence)
Fill in the specific surface derivative calculations.
Definition: interface_elements.cc:847
SurfaceDerivatives()
Definition: interface_elements.h:712
RealScalar s
Definition: level1_cplx_impl.h:130
void normal(const Vector< double > &x, Vector< double > &normal)
Definition: free_surface_rotation.cc:65
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
@ 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
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2