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// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 // Header file for elements that are used to apply contact angle
31 // BC for Young Laplace eqns
32 
33 #ifndef OOMPH_YOUNGLAPLACE_FLUX_ELEMENTS_HEADER
34 #define OOMPH_YOUNGLAPLACE_FLUX_ELEMENTS_HEADER
35 
36 
37 // Config header generated by autoconfig
38 #ifdef HAVE_CONFIG_H
39  #include <oomph-lib-config.h>
40 #endif
41 
42 
43 // oomph-lib ncludes
44 #include "../generic/Qelements.h"
45 
46 namespace oomph
47 {
48 
49 //======================================================================
50 /// \short A class for elements that allow the imposition of an
51 /// contact angle bcs for Young Laplace elements.
52 /// The element geometry is obtained from the FaceGeometry<ELEMENT>
53 /// policy class. Jacobian is evaluated by finite differencing.
54 //======================================================================
55 template <class ELEMENT>
56 class YoungLaplaceContactAngleElement : public virtual FaceGeometry<ELEMENT>,
57 public virtual FaceElement
58 {
59 
60 public:
61 
62  /// \short Constructor, takes the pointer to the "bulk" element and the
63  /// index of the face to which the element is attached.
65  const int &face_index);
66 
67  ///\short Broken empty constructor
69  {
70  throw OomphLibError(
71  "Don't call empty constructor for YoungLaplaceContactAngleElement",
72  OOMPH_CURRENT_FUNCTION,
73  OOMPH_EXCEPTION_LOCATION);
74  }
75 
76  /// Broken copy constructor
78  {
79  BrokenCopy::broken_copy("YoungLaplaceContactAngleElement");
80  }
81 
82  /// Broken assignment operator
84  {
85  BrokenCopy::broken_assign("YoungLaplaceContactAngleElement");
86  }
87 
88 
89  /// \short Access function for the pointer to the prescribed contact angle
90  /// (const version)
91  double* prescribed_cos_gamma_pt() const
92  {
94  }
95 
96 
97  /// Access function for the pointer to the prescribed contact angle
99  {
101  }
102 
103 
104  /// Add the element's contribution to its residual vector
106 
107  /// \short Get the local equation number of the (one and only) unknown
108  /// stored at local node n (returns -1 if value is pinned).
109  /// Can be overloaded in derived multiphysics elements.
110  inline int u_local_eqn(const unsigned& n)
111  {
112  //Local equation number is the first value stored at the node
113  return nodal_local_eqn(n,0);
114  }
115 
116 
117  /// Specify the value of nodal zeta from the face geometry
118  /// \short The "global" intrinsic coordinate of the element when
119  /// viewed as part of a geometric object should be given by
120  /// the FaceElement representation, by default (needed to break
121  /// indeterminacy if bulk element is SolidElement)
122  double zeta_nodal(const unsigned &n, const unsigned &k,
123  const unsigned &i) const
124  {return FaceElement::zeta_nodal(n,k,i);}
125 
126  /// Output function -- forward to broken version in FiniteElement
127  /// until somebody decides what exactly they want to plot here...
128  void output(std::ostream &outfile) {FiniteElement::output(outfile);}
129 
130  /// \short Output function -- forward to broken version in FiniteElement
131  /// until somebody decides what exactly they want to plot here...
132  void output(std::ostream &outfile, const unsigned &n_plot)
133  {FiniteElement::output(outfile,n_plot);}
134 
135  /// C-style output function -- forward to broken version in FiniteElement
136  /// until somebody decides what exactly they want to plot here...
137  void output(FILE* file_pt) {FiniteElement::output(file_pt);}
138 
139  /// \short C-style output function -- forward to broken version in
140  /// FiniteElement until somebody decides what exactly they want to plot
141  /// here...
142  void output(FILE* file_pt, const unsigned &n_plot)
143  {FiniteElement::output(file_pt,n_plot);}
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  /// \short 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  /// \short 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.
177  void contact_line_vectors(const Vector<double>& s,
178  Vector<double>& tangent,
179  Vector<double>& normal,
180  Vector<double>& spine,
181  double& norm_of_drds);
182 
183 protected:
184 
185  /// \short Define an access function to the first data value stored
186  /// at each node. In a more general "Equation" element, such abstraction
187  /// is essential, because different Elements will store the same variables
188  /// in different locations.
189  double &u(const unsigned int &n) {return *this->node_pt(n)->value_pt(0);}
190 
191  /// Function to calculate the cos of the prescribed contact angle
193  {
194  //If the function pointer is zero return zero
195  if(Prescribed_cos_gamma_pt == 0)
196  {
197  return 0.0;
198  }
199  //Otherwise de-reference pointer
200  else
201  {
202  return *Prescribed_cos_gamma_pt;
203  }
204  }
205 
206 
207 private:
208 
209  /// Pointer to prescribed cos gamma
211 
212 
213 };
214 
215 
216 }
217 
218 #endif
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
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:2884
cstr elem_len * i
Definition: cfortran.h:607
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:322
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
Definition: elements.h:4412
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element&#39;s contribution to its residual vector.
double * prescribed_cos_gamma_pt() const
Access function for the pointer to the prescribed contact angle (const version)
A general Finite Element class.
Definition: elements.h:1274
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.
Definition: elements.h:4292
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...
A class for elements that allow the imposition of an contact angle bcs for Young Laplace elements...
double prescribed_cos_gamma()
Function to calculate the cos of the prescribed contact angle.
static char t char * s
Definition: cfortran.h:572
double * Prescribed_cos_gamma_pt
Pointer to prescribed cos gamma.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2109
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 *& prescribed_cos_gamma_pt()
Access function for the pointer to the prescribed contact angle.
void operator=(const YoungLaplaceContactAngleElement &)
Broken assignment operator.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
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...
void contact_line_vectors(const Vector< double > &s, Vector< double > &tangent, Vector< double > &normal)
Get unit tangent and normal vectors to contact line.
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...
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function – forward to broken version in FiniteElement until somebody decides what exa...
void output(std::ostream &outfile, const unsigned &n_plot)
Output function – forward to broken version in FiniteElement until somebody decides what exactly the...
YoungLaplaceContactAngleElement(const YoungLaplaceContactAngleElement &dummy)
Broken copy constructor.
double actual_cos_contact_angle(const Vector< double > &s)
Compute cosinus of actual contact angle.
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:1386