biharmonic_flux_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 #ifndef OOMPH_BIHARMONIC_FLUX_ELEMENTS_HEADER
31 #define OOMPH_BIHARMONIC_FLUX_ELEMENTS_HEADER
32 
33 // Config header generated by autoconfig
34 #ifdef HAVE_CONFIG_H
35  #include <oomph-lib-config.h>
36 #endif
37 
38 #ifdef OOMPH_HAS_MPI
39 //mpi headers
40 #include "mpi.h"
41 #endif
42 
43 // Generic C++ headers
44 #include <iostream>
45 #include <math.h>
46 
47 // oomph-lib headers
48 #include "../generic/matrices.h"
49 #include "../generic/elements.h"
50 #include "../generic/hermite_elements.h"
51 #include "biharmonic_elements.h"
52 
53 
54 
55 // oomph namespace
56 namespace oomph
57 {
58 
59  //============================================================================
60 /// \short face geometry for biharmonic elements - template parameter
61 /// indicates dimension of problem (i.e. bulk element), not the face elements
62 //============================================================================
63 template<unsigned DIM>
65  public virtual QHermiteElement<DIM-1>
66 {
67 
68  public:
69 
70  /// \short Constructor: Call the constructor for the
71  /// appropriate lower-dimensional BiharmonicElement
72  FaceGeometry() : QHermiteElement<DIM-1>() {}
73 
74 };
75 
76 template<> class
77 FaceGeometry<BiharmonicElement<1> > : public virtual PointElement
78 {
79 
80  public:
81 
82  /// \short Constructor: Call the constructor for the
83  /// appropriate lower-dimensional BiharmonicElement
85 
86 };
87 
88 
89 //=============================================================================
90 /// Biharmonic Flux Element
91 //=============================================================================
92 template<unsigned DIM>
93 class BiharmonicFluxElement : public virtual
94 FaceGeometry<BiharmonicElement<2> >,
95  public virtual FaceElement
96 {
97 
98 public :
99 
100  /// definition of flux function pointer, flux must be parametised in terms of
101  /// the macro element coordinate position (s) along the problem edge
102  typedef void (*FluxFctPt)(const double& s, double& flux);
103 
104  ///\short constructor
105  BiharmonicFluxElement(FiniteElement* const &bulk_el_pt,
106  const int& face_index,
107  const unsigned& b);
108 
109 
110  ///\short Broken empty constructor
112  {
113  throw OomphLibError(
114  "Don't call empty constructor for PoissonFluxElement",
115  OOMPH_CURRENT_FUNCTION,
116  OOMPH_EXCEPTION_LOCATION);
117  }
118 
119 
120  /// Broken copy constructor
122  {
123  BrokenCopy::broken_copy("BiharmonicFluxElement<DIM>");
124  }
125 
126 
127  /// Broken assignment operator
129  {
130  BrokenCopy::broken_assign("BiharmonicFluxElement<DIM>");
131  }
132 
133  /// Access function for the flux0 function pointer
134  FluxFctPt& flux0_fct_pt() {return Flux0_fct_pt;}
135 
136  /// Access function for the flux1 function pointer
137  FluxFctPt& flux1_fct_pt() {return Flux1_fct_pt;}
138 
139  /// Add the element's contribution to its residual vector
141  {
142  //Call the generic residuals function
143  fill_in_generic_residual_contribution_biharmonic_flux(residuals);
144  }
145 
146 
147  /// \short Add the element's contribution to its residual vector and its
148  /// Jacobian matrix (note - no contributions are made to the jacobian)
150  DenseMatrix<double> &jacobian)
151  {
152  //Call the generic residuals routine
153  fill_in_generic_residual_contribution_biharmonic_flux(residuals);
154  }
155 
156 
157  /// \short Specify the value of nodal zeta from the face geometry
158  /// The "global" intrinsic coordinate of the element when
159  /// viewed as part of a geometric object should be given by
160  /// the FaceElement representation, by default (needed to break
161  /// indeterminacy if bulk element is SolidElement)
162  double zeta_nodal(const unsigned &n, const unsigned &k,
163  const unsigned &i) const
164  {return FaceElement::zeta_nodal(n,k,i);}
165 
166 
167  /// Output function -- does nothing
168  void output(std::ostream &outfile) {}
169 
170 
171  /// \short Output function -- does nothing
172  void output(std::ostream &outfile, const unsigned &n_plot) {}
173 
174 
175  /// C-style output function -- does nothing
176  void output(FILE* file_pt) {}
177 
178 
179  /// \short C-style output function -- does nothing
180  void output(FILE* file_pt, const unsigned &n_plot) {}
181 
182 
183  /// compute_error -- does nothing
184  void compute_error(std::ostream &outfile,
186  exact_soln_pt, double& error, double& norm) {}
187 
188 
189  virtual void output_fct(std::ostream &outfile,const unsigned &nplot,
191  {}
192 
193 private:
194 
195  /// \short Function to return the prescribed flux at a given macro element
196  /// coordinate position
197  void get_flux0(const double& s, double& flux)
198  {
199  //If the function pointer is zero return zero
200  if(Flux0_fct_pt == 0)
201  {
202  flux=0.0;
203  }
204  //Otherwise call the function
205  else
206  {
207  (*Flux0_fct_pt)(s,flux);
208  }
209  }
210 
211  /// \short Function to return the prescribed flux at a given macro element
212  /// coordinate position
213  void get_flux1(const double& s, double& flux)
214  {
215  //If the function pointer is zero return zero
216  if(Flux1_fct_pt == 0)
217  {
218  flux=0.0;
219  }
220  //Otherwise call the function
221  else
222  {
223  (*Flux1_fct_pt)(s,flux);
224  }
225  }
226 
227  /// \short Calculate the Jacobian of the mapping between local and global
228  /// coordinates at the position s for face elements
229  double J_eulerian(const Vector<double> &s) const;
230 
231  /// \short Add the element's contribution to its residual vector. Flux
232  /// elements only make contribution to the residual vector
233  void fill_in_generic_residual_contribution_biharmonic_flux(
234  Vector<double> &residuals);
235 
236  /// Function pointer to the prescribed flux
237  FluxFctPt Flux0_fct_pt;
238 
239  /// Function pointer to the prescribed flux
240  FluxFctPt Flux1_fct_pt;
241 
242  /// \short the number of nodal degrees of freedom for the face element basis
243  /// functions
244  unsigned Nface_nodal_dof;
245 
246  /// \short
247  unsigned Boundary;
248 
249 };
250 
251 
252 
253 }
254 #endif
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
void output(std::ostream &outfile)
Output function – does nothing.
void get_flux1(const double &s, double &flux)
Function to return the prescribed flux at a given macro element coordinate position.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function – does nothing.
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Add the element&#39;s contribution to its residual vector and its Jacobian matrix (note - no contribution...
cstr elem_len * i
Definition: cfortran.h:607
A general Finite Element class.
Definition: elements.h:1274
FluxFctPt & flux0_fct_pt()
Access function for the flux0 function pointer.
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
FluxFctPt Flux1_fct_pt
Function pointer to the prescribed flux.
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...
unsigned Nface_nodal_dof
the number of nodal degrees of freedom for the face element basis functions
BiharmonicFluxElement()
Broken empty constructor.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional BiharmonicElement.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
Definition: elements.h:1723
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional BiharmonicElement.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
compute_error – does nothing
static char t char * s
Definition: cfortran.h:572
FluxFctPt Flux0_fct_pt
Function pointer to the prescribed flux.
virtual void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output an exact solution over the element.
biharmonic element class
void operator=(const BiharmonicFluxElement &)
Broken assignment operator.
void broken_assign(const std::string &class_name)
Issue error message and terminate execution.
BiharmonicFluxElement(const BiharmonicFluxElement &dummy)
Broken copy constructor.
void output(FILE *file_pt)
C-style output function – does nothing.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element&#39;s contribution to its residual vector.
FluxFctPt & flux1_fct_pt()
Access function for the flux1 function pointer.
void get_flux0(const double &s, double &flux)
Function to return the prescribed flux at a given macro element coordinate position.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function – does nothing.