Tfourier_decomposed_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 TFourierDecomposedHelmholtz elements
27 #ifndef OOMPH_TFOURIER_DECOMPOSED_HELMHOLTZ_ELEMENTS_HEADER
28 #define OOMPH_TFOURIER_DECOMPOSED_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"
43 
44 namespace oomph
45 {
48  // TFourierDecomposedHelmholtzElement
51 
52 
53  //======================================================================
59  //======================================================================
60  template<unsigned NNODE_1D>
62  : public TElement<2, NNODE_1D>,
64  public virtual ElementWithZ2ErrorEstimator
65  {
66  public:
71  {
72  }
73 
74 
77  const TFourierDecomposedHelmholtzElement<NNODE_1D>& dummy) = delete;
78 
80  // Commented out broken assignment operator because this can lead to a
81  // conflict warning when used in the virtual inheritence hierarchy.
82  // Essentially the compiler doesn't realise that two separate
83  // implementations of the broken function are the same and so, quite
84  // rightly, it shouts.
85  /*void operator=(const TFourierDecomposedHelmholtzElement<NNODE_1D>&) =
86  * delete;*/
87 
90  inline unsigned required_nvalue(const unsigned& n) const
91  {
92  return Initial_Nvalue;
93  }
94 
97  void output(std::ostream& outfile)
98  {
100  }
101 
104  void output(std::ostream& outfile, const unsigned& n_plot)
105  {
107  }
108 
109 
112  void output(FILE* file_pt)
113  {
115  }
116 
117 
120  void output(FILE* file_pt, const unsigned& n_plot)
121  {
123  }
124 
125 
128  void output_fct(std::ostream& outfile,
129  const unsigned& n_plot,
131  {
133  outfile, n_plot, exact_soln_pt);
134  }
135 
136 
139  void output_fct(std::ostream& outfile,
140  const unsigned& n_plot,
141  const double& time,
143  {
145  outfile, n_plot, time, exact_soln_pt);
146  }
147 
148  protected:
152  const Vector<double>& s,
153  Shape& psi,
154  DShape& dpsidx,
155  Shape& test,
156  DShape& dtestdx) const;
157 
158 
162  const unsigned& ipt,
163  Shape& psi,
164  DShape& dpsidx,
165  Shape& test,
166  DShape& dtestdx) const;
167 
168 
171  unsigned nrecovery_order()
172  {
173  return (NNODE_1D - 1);
174  }
175 
177  unsigned num_Z2_flux_terms()
178  {
179  return 2 * 2;
180  }
181 
185  {
186  Vector<std::complex<double>> complex_flux(2);
187  this->get_flux(s, complex_flux);
188  unsigned count = 0;
189  for (unsigned i = 0; i < 2; i++)
190  {
191  flux[count++] = complex_flux[i].real();
192  flux[count++] = complex_flux[i].imag();
193  }
194  }
195 
197  unsigned nvertex_node() const
198  {
200  }
201 
203  Node* vertex_node_pt(const unsigned& j) const
204  {
206  }
207 
208  private:
210  static const unsigned Initial_Nvalue;
211  };
212 
213 
214  // Inline functions:
215 
216 
217  //======================================================================
222  //======================================================================
223  template<unsigned NNODE_1D>
226  const Vector<double>& s,
227  Shape& psi,
228  DShape& dpsidx,
229  Shape& test,
230  DShape& dtestdx) const
231  {
232  unsigned n_node = this->nnode();
233 
234  // Call the geometrical shape functions and derivatives
235  double J = this->dshape_eulerian(s, psi, dpsidx);
236 
237  // Loop over the test functions and derivatives and set them equal to the
238  // shape functions
239  for (unsigned i = 0; i < n_node; i++)
240  {
241  test[i] = psi[i];
242  dtestdx(i, 0) = dpsidx(i, 0);
243  dtestdx(i, 1) = dpsidx(i, 1);
244  }
245 
246  // Return the jacobian
247  return J;
248  }
249 
250 
251  //======================================================================
256  //======================================================================
257  template<unsigned NNODE_1D>
260  const unsigned& ipt,
261  Shape& psi,
262  DShape& dpsidx,
263  Shape& test,
264  DShape& dtestdx) const
265  {
266  // Call the geometrical shape functions and derivatives
267  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
268 
269  // Set the pointers of the test functions
270  test = psi;
271  dtestdx = dpsidx;
272 
273  // Return the jacobian
274  return J;
275  }
276 
277 
278  //=======================================================================
283  //=======================================================================
284  template<unsigned NNODE_1D>
286  : public virtual TElement<1, NNODE_1D>
287  {
288  public:
291  FaceGeometry() : TElement<1, NNODE_1D>() {}
292  };
293 
294 
295 } // namespace oomph
296 
297 #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: Tfourier_decomposed_helmholtz_elements.h:291
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: fourier_decomposed_helmholtz_elements.h:84
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: fourier_decomposed_helmholtz_elements.h:280
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: fourier_decomposed_helmholtz_elements.cc:520
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: fourier_decomposed_helmholtz_elements.h:160
Definition: nodes.h:906
Definition: shape.h:76
Definition: Telements.h:1208
Definition: Tfourier_decomposed_helmholtz_elements.h:65
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Definition: Tfourier_decomposed_helmholtz_elements.h:139
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: Tfourier_decomposed_helmholtz_elements.h:104
unsigned nvertex_node() const
Number of vertex nodes in the element.
Definition: Tfourier_decomposed_helmholtz_elements.h:197
TFourierDecomposedHelmholtzElement(const TFourierDecomposedHelmholtzElement< NNODE_1D > &dummy)=delete
Broken copy constructor.
double dshape_and_dtest_eulerian_at_knot_fourier_decomposed_helmholtz(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tfourier_decomposed_helmholtz_elements.h:259
void output(FILE *file_pt)
Definition: Tfourier_decomposed_helmholtz_elements.h:112
unsigned nrecovery_order()
Definition: Tfourier_decomposed_helmholtz_elements.h:171
void output(FILE *file_pt, const unsigned &n_plot)
Definition: Tfourier_decomposed_helmholtz_elements.h:120
static const unsigned Initial_Nvalue
Static unsigned that holds the (same) number of variables at every node.
Definition: Tfourier_decomposed_helmholtz_elements.h:210
TFourierDecomposedHelmholtzElement()
Definition: Tfourier_decomposed_helmholtz_elements.h:69
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Definition: Tfourier_decomposed_helmholtz_elements.h:184
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
Definition: Tfourier_decomposed_helmholtz_elements.h:177
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: Tfourier_decomposed_helmholtz_elements.h:128
void output(std::ostream &outfile)
Definition: Tfourier_decomposed_helmholtz_elements.h:97
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
Definition: Tfourier_decomposed_helmholtz_elements.h:90
double dshape_and_dtest_eulerian_fourier_decomposed_helmholtz(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: Tfourier_decomposed_helmholtz_elements.h:225
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
Definition: Tfourier_decomposed_helmholtz_elements.h:203
RealScalar s
Definition: level1_cplx_impl.h:130
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