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