Tpml_helmholtz_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_TPML_HELMHOLTZ_ELEMENTS_HEADER
28 #define OOMPH_TPML_HELMHOLTZ_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 "pml_helmholtz_elements.h"
43 
44 namespace oomph
45 {
48  // TPMLHelmholtzElement
51 
52 
53  //======================================================================
58  //======================================================================
59  template<unsigned DIM, unsigned NNODE_1D>
60  class TPMLHelmholtzElement : public TElement<DIM, NNODE_1D>,
61  public PMLHelmholtzEquations<DIM>,
62  public virtual ElementWithZ2ErrorEstimator
63  {
64  public:
68  : TElement<DIM, NNODE_1D>(), PMLHelmholtzEquations<DIM>()
69  {
70  }
71 
72 
75  delete;
76 
78  // Commented out broken assignment operator because this can lead to a
79  // conflict warning when used in the virtual inheritence hierarchy.
80  // Essentially the compiler doesn't realise that two separate
81  // implementations of the broken function are the same and so, quite
82  // rightly, it shouts.
83  /*void operator=(const TPMLHelmholtzElement<DIM,NNODE_1D>&) = delete;*/
84 
87  inline unsigned required_nvalue(const unsigned& n) const
88  {
89  return Initial_Nvalue;
90  }
91 
94  void output(std::ostream& outfile)
95  {
97  }
98 
101  void output(std::ostream& outfile, const unsigned& n_plot)
102  {
103  PMLHelmholtzEquations<DIM>::output(outfile, n_plot);
104  }
105 
106 
109  void output(FILE* file_pt)
110  {
112  }
113 
114 
117  void output(FILE* file_pt, const unsigned& n_plot)
118  {
119  PMLHelmholtzEquations<DIM>::output(file_pt, n_plot);
120  }
121 
122 
125  void output_fct(std::ostream& outfile,
126  const unsigned& n_plot,
128  {
129  PMLHelmholtzEquations<DIM>::output_fct(outfile, n_plot, exact_soln_pt);
130  }
131 
132 
135  void output_fct(std::ostream& outfile,
136  const unsigned& n_plot,
137  const double& time,
139  {
141  outfile, n_plot, time, exact_soln_pt);
142  }
143 
144  protected:
148  Shape& psi,
149  DShape& dpsidx,
150  Shape& test,
151  DShape& dtestdx) const;
152 
153 
157  const unsigned& ipt,
158  Shape& psi,
159  DShape& dpsidx,
160  Shape& test,
161  DShape& dtestdx) const;
162 
163 
166  unsigned nrecovery_order()
167  {
168  return (NNODE_1D - 1);
169  }
170 
172  unsigned num_Z2_flux_terms()
173  {
174  return 2 * DIM;
175  }
176 
180  {
181  Vector<std::complex<double>> complex_flux(DIM);
182  this->get_flux(s, complex_flux);
183  unsigned count = 0;
184  for (unsigned i = 0; i < DIM; i++)
185  {
186  flux[count++] = complex_flux[i].real();
187  flux[count++] = complex_flux[i].imag();
188  }
189  }
190 
192  unsigned nvertex_node() const
193  {
195  }
196 
198  Node* vertex_node_pt(const unsigned& j) const
199  {
201  }
202 
203  private:
205  static const unsigned Initial_Nvalue;
206  };
207 
208 
210  template<unsigned DIM, unsigned NNODE_1D>
212 
213  // Inline functions:
214 
215 
216  //======================================================================
221  //======================================================================
222  template<unsigned DIM, unsigned NNODE_1D>
225  Shape& psi,
226  DShape& dpsidx,
227  Shape& test,
228  DShape& dtestdx) const
229  {
230  unsigned n_node = this->nnode();
231 
232  // Call the geometrical shape functions and derivatives
233  double J = this->dshape_eulerian(s, psi, dpsidx);
234 
235  // Loop over the test functions and derivatives and set them equal to the
236  // shape functions
237  for (unsigned i = 0; i < n_node; i++)
238  {
239  test[i] = psi[i];
240  dtestdx(i, 0) = dpsidx(i, 0);
241  dtestdx(i, 1) = dpsidx(i, 1);
242  }
243 
244  // Return the jacobian
245  return J;
246  }
247 
248 
249  //======================================================================
254  //======================================================================
255  template<unsigned DIM, unsigned NNODE_1D>
258  Shape& psi,
259  DShape& dpsidx,
260  Shape& test,
261  DShape& dtestdx) const
262  {
263  // Call the geometrical shape functions and derivatives
264  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
265 
266  // Set the pointers of the test functions
267  test = psi;
268  dtestdx = dpsidx;
269 
270  // Return the jacobian
271  return J;
272  }
273 
274 
275  //=======================================================================
280  //=======================================================================
281  template<unsigned DIM, unsigned NNODE_1D>
283  : public virtual TElement<DIM - 1, NNODE_1D>
284  {
285  public:
288  FaceGeometry() : TElement<DIM - 1, NNODE_1D>() {}
289  };
290 
291  //=======================================================================
294  //=======================================================================
295  template<unsigned NNODE_1D>
296  class FaceGeometry<TPMLHelmholtzElement<1, NNODE_1D>>
297  : public virtual PointElement
298  {
299  public:
303  };
304 
305 
309 
310  //=======================================================================
313  //=======================================================================
314  template<unsigned NNODE_1D>
316  : public virtual QPMLHelmholtzElement<2, NNODE_1D>
317  {
318  public:
321  PMLLayerElement() : QPMLHelmholtzElement<2, NNODE_1D>() {}
322  };
323 
324  //=======================================================================
329  //=======================================================================
330  template<unsigned DIM, unsigned NNODE_1D>
332  : public virtual QElement<DIM - 1, NNODE_1D>
333  {
334  public:
337  FaceGeometry() : QElement<DIM - 1, NNODE_1D>() {}
338  };
339 
343 
344  //=======================================================================
347  //=======================================================================
348  template<unsigned NNODE_1D>
351  : public virtual QPMLHelmholtzElement<2, NNODE_1D>
352  {
353  public:
356  PMLLayerElement() : QPMLHelmholtzElement<2, NNODE_1D>() {}
357  };
358 
359 } // namespace oomph
360 
361 
362 #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: Tpml_helmholtz_elements.h:302
FaceGeometry()
Definition: Tpml_helmholtz_elements.h:288
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: nodes.h:906
Definition: pml_helmholtz_elements.h:62
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: pml_helmholtz_elements.h:446
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: pml_helmholtz_elements.h:282
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: pml_helmholtz_elements.cc:564
PMLLayerElement()
Definition: Tpml_helmholtz_elements.h:321
Definition: pml_meshes.h:48
Definition: elements.h:3439
PMLHelmholtz upgraded to become projectable.
Definition: pml_helmholtz_elements.h:1015
Definition: Qelements.h:459
Definition: pml_helmholtz_elements.h:754
Definition: shape.h:76
Definition: Telements.h:1208
Definition: Tpml_helmholtz_elements.h:63
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Definition: Tpml_helmholtz_elements.h:135
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Tpml_helmholtz_elements.h:192
void output(FILE *file_pt)
Definition: Tpml_helmholtz_elements.h:109
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
Definition: Tpml_helmholtz_elements.h:205
double dshape_and_dtest_eulerian_at_knot_helmholtz(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tpml_helmholtz_elements.h:257
unsigned nrecovery_order()
Definition: Tpml_helmholtz_elements.h:166
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
Definition: Tpml_helmholtz_elements.h:87
void output(std::ostream &outfile)
Definition: Tpml_helmholtz_elements.h:94
double dshape_and_dtest_eulerian_helmholtz(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tpml_helmholtz_elements.h:224
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: Tpml_helmholtz_elements.h:125
void output(FILE *file_pt, const unsigned &n_plot)
Definition: Tpml_helmholtz_elements.h:117
TPMLHelmholtzElement(const TPMLHelmholtzElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: Tpml_helmholtz_elements.h:101
TPMLHelmholtzElement()
Definition: Tpml_helmholtz_elements.h:67
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Definition: Tpml_helmholtz_elements.h:172
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Tpml_helmholtz_elements.h:198
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Definition: Tpml_helmholtz_elements.h:179
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