Thelmholtz_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 THelmholtz elements
27 #ifndef OOMPH_THELMHOLTZ_ELEMENTS_HEADER
28 #define OOMPH_THELMHOLTZ_ELEMENTS_HEADER
29 
30 
31 // Config header generated by autoconfig
32 #ifdef HAVE_CONFIG_H
33 #include <oomph-lib-config.h>
34 #endif
35 
36 
37 // OOMPH-LIB headers
38 #include "../generic/nodes.h"
39 #include "../generic/oomph_utilities.h"
40 #include "../generic/Telements.h"
41 #include "../generic/error_estimator.h"
42 #include "helmholtz_elements.h"
43 
44 namespace oomph
45 {
48  // THelmholtzElement
51 
52 
53  //======================================================================
57  //======================================================================
58  template<unsigned DIM, unsigned NNODE_1D>
59  class THelmholtzElement : public TElement<DIM, NNODE_1D>,
60  public HelmholtzEquations<DIM>,
61  public virtual ElementWithZ2ErrorEstimator
62  {
63  public:
67  {
68  }
69 
70 
73 
75  // Commented out broken assignment operator because this can lead to a
76  // conflict warning when used in the virtual inheritence hierarchy.
77  // Essentially the compiler doesn't realise that two separate
78  // implementations of the broken function are the same and so, quite
79  // rightly, it shouts.
80  /*void operator=(const THelmholtzElement<DIM,NNODE_1D>&) = delete;*/
81 
84  inline unsigned required_nvalue(const unsigned& n) const
85  {
86  return Initial_Nvalue;
87  }
88 
91  void output(std::ostream& outfile)
92  {
94  }
95 
98  void output(std::ostream& outfile, const unsigned& n_plot)
99  {
100  HelmholtzEquations<DIM>::output(outfile, n_plot);
101  }
102 
103 
106  void output(FILE* file_pt)
107  {
109  }
110 
111 
114  void output(FILE* file_pt, const unsigned& n_plot)
115  {
116  HelmholtzEquations<DIM>::output(file_pt, n_plot);
117  }
118 
119 
122  void output_fct(std::ostream& outfile,
123  const unsigned& n_plot,
125  {
126  HelmholtzEquations<DIM>::output_fct(outfile, n_plot, exact_soln_pt);
127  }
128 
129 
132  void output_fct(std::ostream& outfile,
133  const unsigned& n_plot,
134  const double& time,
136  {
137  HelmholtzEquations<DIM>::output_fct(outfile, n_plot, time, exact_soln_pt);
138  }
139 
140  protected:
144  Shape& psi,
145  DShape& dpsidx,
146  Shape& test,
147  DShape& dtestdx) const;
148 
149 
153  const unsigned& ipt,
154  Shape& psi,
155  DShape& dpsidx,
156  Shape& test,
157  DShape& dtestdx) const;
158 
159 
162  unsigned nrecovery_order()
163  {
164  return (NNODE_1D - 1);
165  }
166 
168  unsigned num_Z2_flux_terms()
169  {
170  return 2 * DIM;
171  }
172 
176  {
177  Vector<std::complex<double>> complex_flux(DIM);
178  this->get_flux(s, complex_flux);
179  unsigned count = 0;
180  for (unsigned i = 0; i < DIM; i++)
181  {
182  flux[count++] = complex_flux[i].real();
183  flux[count++] = complex_flux[i].imag();
184  }
185  }
186 
188  unsigned nvertex_node() const
189  {
191  }
192 
194  Node* vertex_node_pt(const unsigned& j) const
195  {
197  }
198 
199  private:
201  static const unsigned Initial_Nvalue;
202  };
203 
204 
205  // Inline functions:
206 
207 
208  //======================================================================
213  //======================================================================
214  template<unsigned DIM, unsigned NNODE_1D>
216  const Vector<double>& s,
217  Shape& psi,
218  DShape& dpsidx,
219  Shape& test,
220  DShape& dtestdx) const
221  {
222  unsigned n_node = this->nnode();
223 
224  // Call the geometrical shape functions and derivatives
225  double J = this->dshape_eulerian(s, psi, dpsidx);
226 
227  // Loop over the test functions and derivatives and set them equal to the
228  // shape functions
229  for (unsigned i = 0; i < n_node; i++)
230  {
231  test[i] = psi[i];
232  dtestdx(i, 0) = dpsidx(i, 0);
233  dtestdx(i, 1) = dpsidx(i, 1);
234  }
235 
236  // Return the jacobian
237  return J;
238  }
239 
240 
241  //======================================================================
246  //======================================================================
247  template<unsigned DIM, unsigned NNODE_1D>
250  Shape& psi,
251  DShape& dpsidx,
252  Shape& test,
253  DShape& dtestdx) const
254  {
255  // Call the geometrical shape functions and derivatives
256  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
257 
258  // Set the pointers of the test functions
259  test = psi;
260  dtestdx = dpsidx;
261 
262  // Return the jacobian
263  return J;
264  }
265 
266 
267  //=======================================================================
272  //=======================================================================
273  template<unsigned DIM, unsigned NNODE_1D>
275  : public virtual TElement<DIM - 1, NNODE_1D>
276  {
277  public:
280  FaceGeometry() : TElement<DIM - 1, NNODE_1D>() {}
281  };
282 
283  //=======================================================================
285  //=======================================================================
286  template<unsigned NNODE_1D>
287  class FaceGeometry<THelmholtzElement<1, NNODE_1D>>
288  : public virtual PointElement
289  {
290  public:
294  };
295 
296 
297 } // namespace oomph
298 
299 #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: shape.h:278
Definition: error_estimator.h:79
FaceGeometry()
Definition: Thelmholtz_elements.h:293
FaceGeometry()
Definition: Thelmholtz_elements.h:280
Definition: elements.h:4998
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Definition: elements.h:1759
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Definition: elements.h:1765
Definition: helmholtz_elements.h:56
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: helmholtz_elements.cc:374
void get_flux(const Vector< double > &s, Vector< std::complex< double >> &flux) const
Get flux: flux[i] = du/dx_i for real and imag part.
Definition: helmholtz_elements.h:310
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: helmholtz_elements.h:193
Definition: nodes.h:906
Definition: elements.h:3439
Definition: shape.h:76
Definition: Telements.h:1208
Definition: Thelmholtz_elements.h:62
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Definition: Thelmholtz_elements.h:132
void output(FILE *file_pt, const unsigned &n_plot)
Definition: Thelmholtz_elements.h:114
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Thelmholtz_elements.h:194
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
Definition: Thelmholtz_elements.h:201
THelmholtzElement(const THelmholtzElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: Thelmholtz_elements.h:122
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Definition: Thelmholtz_elements.h:175
void output(FILE *file_pt)
Definition: Thelmholtz_elements.h:106
void output(std::ostream &outfile)
Definition: Thelmholtz_elements.h:91
double dshape_and_dtest_eulerian_helmholtz(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Thelmholtz_elements.h:215
unsigned nrecovery_order()
Definition: Thelmholtz_elements.h:162
double dshape_and_dtest_eulerian_at_knot_helmholtz(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Thelmholtz_elements.h:249
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
Definition: Thelmholtz_elements.h:84
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: Thelmholtz_elements.h:98
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Definition: Thelmholtz_elements.h:168
THelmholtzElement()
Definition: Thelmholtz_elements.h:66
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Thelmholtz_elements.h:188
RealScalar s
Definition: level1_cplx_impl.h:130
#define DIM
Definition: linearised_navier_stokes_elements.h:44
void flux(const double &time, const Vector< double > &x, double &flux)
Get flux applied along boundary x=0.
Definition: pretend_melt.cc:59
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
Definition: indexed_view.cpp:20
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2