young_laplace_contact_angle_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-2023 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 elements that are used to apply contact angle
27 // BC for Young Laplace eqns
28 
29 #ifndef OOMPH_YOUNGLAPLACE_FLUX_ELEMENTS_HEADER
30 #define OOMPH_YOUNGLAPLACE_FLUX_ELEMENTS_HEADER
31 
32 
33 // Config header generated by autoconfig
34 #ifdef HAVE_CONFIG_H
35 #include <oomph-lib-config.h>
36 #endif
37 
38 
39 // oomph-lib ncludes
40 #include "../generic/Qelements.h"
41 
42 namespace oomph
43 {
44  //======================================================================
45  /// A class for elements that allow the imposition of an
46  /// contact angle bcs for Young Laplace elements.
47  /// The element geometry is obtained from the FaceGeometry<ELEMENT>
48  /// policy class. Jacobian is evaluated by finite differencing.
49  //======================================================================
50  template<class ELEMENT>
51  class YoungLaplaceContactAngleElement : public virtual FaceGeometry<ELEMENT>,
52  public virtual FaceElement
53  {
54  public:
55  /// Constructor, takes the pointer to the "bulk" element and the
56  /// index of the face to which the element is attached.
58  const int& face_index);
59 
60  /// Broken empty constructor
62  {
63  throw OomphLibError(
64  "Don't call empty constructor for YoungLaplaceContactAngleElement",
65  OOMPH_CURRENT_FUNCTION,
66  OOMPH_EXCEPTION_LOCATION);
67  }
68 
69  /// Broken copy constructor
71  const YoungLaplaceContactAngleElement& dummy) = delete;
72 
73  /// Broken assignment operator
75 
76  /// Access function for the pointer to the prescribed contact angle
77  /// (const version)
78  double* prescribed_cos_gamma_pt() const
79  {
81  }
82 
83 
84  /// Access function for the pointer to the prescribed contact angle
86  {
88  }
89 
90 
91  /// Add the element's contribution to its residual vector
93 
94  /// Get the local equation number of the (one and only) unknown
95  /// stored at local node n (returns -1 if value is pinned).
96  /// Can be overloaded in derived multiphysics elements.
97  inline int u_local_eqn(const unsigned& n)
98  {
99  // Local equation number is the first value stored at the node
100  return nodal_local_eqn(n, 0);
101  }
102 
103 
104  /// Specify the value of nodal zeta from the face geometry
105  /// The "global" intrinsic coordinate of the element when
106  /// viewed as part of a geometric object should be given by
107  /// the FaceElement representation, by default (needed to break
108  /// indeterminacy if bulk element is SolidElement)
109  double zeta_nodal(const unsigned& n,
110  const unsigned& k,
111  const unsigned& i) const
112  {
113  return FaceElement::zeta_nodal(n, k, i);
114  }
115 
116  /// Output function -- forward to broken version in FiniteElement
117  /// until somebody decides what exactly they want to plot here...
118  void output(std::ostream& outfile)
119  {
120  FiniteElement::output(outfile);
121  }
122 
123  /// Output function -- forward to broken version in FiniteElement
124  /// until somebody decides what exactly they want to plot here...
125  void output(std::ostream& outfile, const unsigned& n_plot)
126  {
127  FiniteElement::output(outfile, n_plot);
128  }
129 
130  /// C-style output function -- forward to broken version in FiniteElement
131  /// until somebody decides what exactly they want to plot here...
132  void output(FILE* file_pt)
133  {
134  FiniteElement::output(file_pt);
135  }
136 
137  /// C-style output function -- forward to broken version in
138  /// FiniteElement until somebody decides what exactly they want to plot
139  /// here...
140  void output(FILE* file_pt, const unsigned& n_plot)
141  {
142  FiniteElement::output(file_pt, n_plot);
143  }
144 
145  /// Compute cosinus of actual contact angle
147 
148  /// Get unit tangent and normal vectors to contact line
150  Vector<double>& tangent,
151  Vector<double>& normal)
152  {
153  // Dummy
154  double norm_of_drds;
155  Vector<double> spine(3);
156  contact_line_vectors(s, tangent, normal, spine, norm_of_drds);
157  }
158 
159  /// Get unit tangent and normal vectors to contact line. Final
160  /// argument gives the norm of dR/ds where R is the vector to the
161  /// contact line and s the local coordinate in the element.
163  Vector<double>& tangent,
164  Vector<double>& normal,
165  double& norm_of_drds)
166  {
167  // Dummy
168  Vector<double> spine(3);
169  contact_line_vectors(s, tangent, normal, spine, norm_of_drds);
170  }
171 
172 
173  /// Get tangent and normal vectors to contact line and spine vector
174  /// (wall normal can then be obtained by cross-product). Final
175  /// argument gives the norm of dR/ds where R is the vector to the
176  /// contact line and s the local coordinate in the element.
178  Vector<double>& tangent,
179  Vector<double>& normal,
180  Vector<double>& spine,
181  double& norm_of_drds);
182 
183  protected:
184  /// Define an access function to the first data value stored
185  /// at each node. In a more general "Equation" element, such abstraction
186  /// is essential, because different Elements will store the same variables
187  /// in different locations.
188  double& u(const unsigned int& n)
189  {
190  return *this->node_pt(n)->value_pt(0);
191  }
192 
193  /// Function to calculate the cos of the prescribed contact angle
195  {
196  // If the function pointer is zero return zero
197  if (Prescribed_cos_gamma_pt == 0)
198  {
199  return 0.0;
200  }
201  // Otherwise de-reference pointer
202  else
203  {
204  return *Prescribed_cos_gamma_pt;
205  }
206  }
207 
208 
209  private:
210  /// Pointer to prescribed cos gamma
212  };
213 
214 
215 } // namespace oomph
216 
217 #endif
static char t char * s
Definition: cfortran.h:568
cstr elem_len * i
Definition: cfortran.h:603
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
Definition: nodes.h:324
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
Definition: elements.h:4338
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
Definition: elements.h:4626
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,...
Definition: elements.h:4497
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition: elements.h:4998
A general Finite Element class.
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
Definition: elements.h:3050
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node.
Definition: elements.h:1432
An OomphLibError object which should be thrown when an run-time error is encountered....
A class for elements that allow the imposition of an contact angle bcs for Young Laplace elements....
int u_local_eqn(const unsigned &n)
Get the local equation number of the (one and only) unknown stored at local node n (returns -1 if val...
void operator=(const YoungLaplaceContactAngleElement &)=delete
Broken assignment operator.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly they...
double actual_cos_contact_angle(const Vector< double > &s)
Compute cosinus of actual contact angle.
YoungLaplaceContactAngleElement(const YoungLaplaceContactAngleElement &dummy)=delete
Broken copy constructor.
void output(FILE *file_pt)
C-style output function – forward to broken version in FiniteElement until somebody decides what exac...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector.
double * prescribed_cos_gamma_pt() const
Access function for the pointer to the prescribed contact angle (const version)
double prescribed_cos_gamma()
Function to calculate the cos of the prescribed contact angle.
double *& prescribed_cos_gamma_pt()
Access function for the pointer to the prescribed contact angle.
double & u(const unsigned int &n)
Define an access function to the first data value stored at each node. In a more general "Equation" e...
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...
void contact_line_vectors(const Vector< double > &s, Vector< double > &tangent, Vector< double > &normal)
Get unit tangent and normal vectors to contact line.
void contact_line_vectors(const Vector< double > &s, Vector< double > &tangent, Vector< double > &normal, double &norm_of_drds)
Get unit tangent and normal vectors to contact line. Final argument gives the norm of dR/ds where R i...
double * Prescribed_cos_gamma_pt
Pointer to prescribed cos gamma.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function – forward to broken version in FiniteElement until somebody decides what exac...
void output(std::ostream &outfile)
Output function – forward to broken version in FiniteElement until somebody decides what exactly they...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...