27 #ifndef OOMPH_FOURIER_DECOMPOSED_HELMHOLTZ_ELEMENTS_HEADER
28 #define OOMPH_FOURIER_DECOMPOSED_HELMHOLTZ_ELEMENTS_HEADER
33 #include <oomph-lib-config.h>
41 #include "../generic/projection.h"
42 #include "../generic/nodes.h"
43 #include "../generic/Qelements.h"
44 #include "../generic/oomph_utilities.h"
51 namespace Legendre_functions_helper
54 extern double factorial(
const unsigned& l);
57 extern double plgndr1(
const unsigned&
n,
const double&
x);
60 extern double plgndr2(
const unsigned& l,
117 return std::complex<unsigned>(0, 1);
162 const unsigned n_plot = 5;
168 void output(std::ostream& outfile,
const unsigned& n_plot);
177 const unsigned& n_plot);
182 const unsigned n_plot = 5;
188 void output(FILE* file_pt,
const unsigned& n_plot);
193 const unsigned& n_plot,
199 std::ostream& outfile,
200 const unsigned& n_plot,
204 throw OomphLibError(
"There is no time-dependent output_fct() for "
205 "FourierDecomposedHelmholtz elements ",
218 const unsigned& n_plot,
236 throw OomphLibError(
"There is no time-dependent compute_error() for "
237 "FourierDecomposedHelmholtz elements",
264 std::complex<double>&
source)
const
269 source = std::complex<double>(0.0, 0.0);
284 const unsigned n_node =
nnode();
294 const std::complex<double>
zero(0.0, 0.0);
295 for (
unsigned j = 0;
j < 2;
j++)
301 for (
unsigned l = 0; l < n_node; l++)
304 const std::complex<double> u_value(
309 for (
unsigned j = 0;
j < 2;
j++)
311 flux[
j] += u_value * dpsidx(l,
j);
334 residuals, jacobian, 1);
344 const unsigned n_node =
nnode();
353 std::complex<double> interpolated_u(0.0, 0.0);
356 const unsigned u_nodal_index_real =
358 const unsigned u_nodal_index_imag =
362 for (
unsigned l = 0; l < n_node; l++)
365 const std::complex<double> u_value(
369 interpolated_u += u_value * psi[l];
371 return interpolated_u;
387 DShape& dtestdx)
const = 0;
397 DShape& dtestdx)
const = 0;
404 const unsigned& flag);
427 template<
unsigned NNODE_1D>
429 :
public virtual QElement<2, NNODE_1D>,
469 void output(std::ostream& outfile,
const unsigned& n_plot)
481 const unsigned& n_plot)
494 void output(FILE* file_pt,
const unsigned& n_plot)
502 const unsigned& n_plot,
506 outfile, n_plot, exact_soln_pt);
516 const unsigned& n_plot,
520 outfile, phi, n_plot, exact_soln_pt);
528 const unsigned& n_plot,
533 outfile, n_plot, time, exact_soln_pt);
567 template<
unsigned NNODE_1D>
577 const double J = this->dshape_eulerian(
s, psi, dpsidx);
594 template<
unsigned NNODE_1D>
604 const double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
625 template<
unsigned NNODE_1D>
627 :
public virtual QElement<1, NNODE_1D>
644 template<
class FOURIER_DECOMPOSED_HELMHOLTZ_ELEMENT>
661 std::stringstream error_stream;
662 error_stream <<
"Fourier decomposed Helmholtz elements only store 2 "
664 << fld <<
" is illegal \n";
671 unsigned nnod = this->
nnode();
675 for (
unsigned j = 0;
j < nnod;
j++)
678 data_values[
j] = std::make_pair(this->
node_pt(
j), fld);
698 std::stringstream error_stream;
699 error_stream <<
"Helmholtz elements only store two fields so fld = "
700 << fld <<
" is illegal\n";
724 std::stringstream error_stream;
725 error_stream <<
"Helmholtz elements only store two fields so fld = "
726 << fld <<
" is illegal.\n";
731 unsigned n_dim = this->
dim();
732 unsigned n_node = this->
nnode();
734 DShape dpsidx(n_node, n_dim), dtestdx(n_node, n_dim);
735 double J = this->dshape_and_dtest_eulerian_fourier_decomposed_helmholtz(
736 s, psi, dpsidx,
test, dtestdx);
750 std::stringstream error_stream;
751 error_stream <<
"Helmholtz elements only store two fields so fld = "
752 << fld <<
" is illegal\n";
758 std::complex<unsigned> complex_u_nodal_index =
759 this->u_index_fourier_decomposed_helmholtz();
760 unsigned u_nodal_index = 0;
763 u_nodal_index = complex_u_nodal_index.real();
767 u_nodal_index = complex_u_nodal_index.imag();
772 unsigned n_node = this->
nnode();
779 double interpolated_u = 0.0;
782 for (
unsigned l = 0; l < n_node; l++)
784 interpolated_u += this->
nodal_value(t, l, u_nodal_index) * psi[l];
786 return interpolated_u;
796 std::stringstream error_stream;
797 error_stream <<
"Helmholtz elements only store two fields so fld = "
798 << fld <<
" is illegal\n";
803 return this->
nnode();
813 std::stringstream error_stream;
814 error_stream <<
"Helmholtz elements only store two fields so fld = "
815 << fld <<
" is illegal\n";
820 std::complex<unsigned> complex_u_nodal_index =
821 this->u_index_fourier_decomposed_helmholtz();
822 unsigned u_nodal_index = 0;
825 u_nodal_index = complex_u_nodal_index.real();
829 u_nodal_index = complex_u_nodal_index.imag();
837 void output(std::ostream& outfile,
const unsigned& nplot)
848 template<
class ELEMENT>
861 template<
class ELEMENT>
AnnoyingScalar imag(const AnnoyingScalar &)
Definition: AnnoyingScalar.h:132
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
unsigned ntstorage() const
Definition: nodes.cc:879
FaceGeometry()
Definition: fourier_decomposed_helmholtz_elements.h:867
FaceGeometry()
Definition: fourier_decomposed_helmholtz_elements.h:853
FaceGeometry()
Definition: fourier_decomposed_helmholtz_elements.h:632
Definition: elements.h:4998
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
double nodal_value(const unsigned &n, const unsigned &i) const
Definition: elements.h:2593
virtual void shape(const Vector< double > &s, Shape &psi) const =0
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Definition: elements.h:1432
unsigned dim() const
Definition: elements.h:2611
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Definition: elements.h:1759
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Definition: elements.h:1765
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Definition: elements.cc:3298
Definition: fourier_decomposed_helmholtz_elements.h:84
FourierDecomposedHelmholtzSourceFctPt Source_fct_pt
Pointer to source function:
Definition: fourier_decomposed_helmholtz_elements.h:407
void output_real_fct(std::ostream &outfile, const double &phi, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: fourier_decomposed_helmholtz_elements.cc:574
virtual void fill_in_generic_residual_contribution_fourier_decomposed_helmholtz(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Definition: fourier_decomposed_helmholtz_elements.cc:183
int * N_fourier_pt
Pointer to Fourier wave number.
Definition: fourier_decomposed_helmholtz_elements.h:413
virtual void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Definition: fourier_decomposed_helmholtz_elements.h:198
double * K_squared_pt
Pointer to square of wavenumber.
Definition: fourier_decomposed_helmholtz_elements.h:410
unsigned self_test()
Self-test: Return 0 for OK.
Definition: fourier_decomposed_helmholtz_elements.cc:373
int *& fourier_wavenumber_pt()
Get pointer to Fourier wavenumber.
Definition: fourier_decomposed_helmholtz_elements.h:141
void(* FourierDecomposedHelmholtzSourceFctPt)(const Vector< double > &x, std::complex< double > &f)
Definition: fourier_decomposed_helmholtz_elements.h:88
void output_real(std::ostream &outfile, const double &phi, const unsigned &n_plot)
Definition: fourier_decomposed_helmholtz_elements.cc:441
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 fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: fourier_decomposed_helmholtz_elements.h:329
void compute_norm(double &norm)
Compute norm of fe solution.
Definition: fourier_decomposed_helmholtz_elements.cc:706
double k_squared()
Get the square of wavenumber.
Definition: fourier_decomposed_helmholtz_elements.h:128
double *& k_squared_pt()
Get pointer to square of wavenumber.
Definition: fourier_decomposed_helmholtz_elements.h:122
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: fourier_decomposed_helmholtz_elements.cc:520
virtual double dshape_and_dtest_eulerian_fourier_decomposed_helmholtz(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
virtual double dshape_and_dtest_eulerian_at_knot_fourier_decomposed_helmholtz(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
FourierDecomposedHelmholtzSourceFctPt source_fct_pt() const
Access function: Pointer to source function. Const version.
Definition: fourier_decomposed_helmholtz_elements.h:252
FourierDecomposedHelmholtzSourceFctPt & source_fct_pt()
Access function: Pointer to source function.
Definition: fourier_decomposed_helmholtz_elements.h:246
FourierDecomposedHelmholtzEquations(const FourierDecomposedHelmholtzEquations &dummy)=delete
Broken copy constructor.
void output(std::ostream &outfile)
Output with default number of plot points.
Definition: fourier_decomposed_helmholtz_elements.h:160
FourierDecomposedHelmholtzEquations()
Constructor.
Definition: fourier_decomposed_helmholtz_elements.h:93
std::complex< double > interpolated_u_fourier_decomposed_helmholtz(const Vector< double > &s) const
Definition: fourier_decomposed_helmholtz_elements.h:340
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
Definition: fourier_decomposed_helmholtz_elements.cc:626
virtual std::complex< unsigned > u_index_fourier_decomposed_helmholtz() const
Broken assignment operator.
Definition: fourier_decomposed_helmholtz_elements.h:114
virtual void get_source_fourier_decomposed_helmholtz(const unsigned &ipt, const Vector< double > &x, std::complex< double > &source) const
Definition: fourier_decomposed_helmholtz_elements.h:261
void output(FILE *file_pt)
C_style output with default number of plot points.
Definition: fourier_decomposed_helmholtz_elements.h:180
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
Definition: fourier_decomposed_helmholtz_elements.h:318
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Dummy, time dependent error checker.
Definition: fourier_decomposed_helmholtz_elements.h:230
int fourier_wavenumber()
Get the Fourier wavenumber.
Definition: fourier_decomposed_helmholtz_elements.h:147
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
Definition: nodes.h:1022
Definition: oomph_definitions.h:222
Definition: projection.h:183
Fourier decomposed Helmholtz upgraded to become projectable.
Definition: fourier_decomposed_helmholtz_elements.h:647
double get_field(const unsigned &t, const unsigned &fld, const Vector< double > &s)
Definition: fourier_decomposed_helmholtz_elements.h:743
unsigned nfields_for_projection()
Number of fields to be projected: 2 (real and imag part)
Definition: fourier_decomposed_helmholtz_elements.h:686
ProjectableFourierDecomposedHelmholtzElement()
Definition: fourier_decomposed_helmholtz_elements.h:651
double jacobian_and_shape_of_field(const unsigned &fld, const Vector< double > &s, Shape &psi)
Definition: fourier_decomposed_helmholtz_elements.h:717
Vector< std::pair< Data *, unsigned > > data_values_of_field(const unsigned &fld)
Definition: fourier_decomposed_helmholtz_elements.h:656
int local_equation(const unsigned &fld, const unsigned &j)
Return local equation number of value j in field fld.
Definition: fourier_decomposed_helmholtz_elements.h:808
unsigned nhistory_values_for_coordinate_projection()
Definition: fourier_decomposed_helmholtz_elements.h:710
unsigned nvalue_of_field(const unsigned &fld)
Return number of values in field fld: One per node.
Definition: fourier_decomposed_helmholtz_elements.h:791
void output(std::ostream &outfile, const unsigned &nplot)
Definition: fourier_decomposed_helmholtz_elements.h:837
unsigned nhistory_values_for_projection(const unsigned &fld)
Definition: fourier_decomposed_helmholtz_elements.h:693
Definition: Qelements.h:459
Definition: fourier_decomposed_helmholtz_elements.h:431
void output_real(std::ostream &outfile, const double &phi, const unsigned &n_plot)
Definition: fourier_decomposed_helmholtz_elements.h:479
void output_fct(std::ostream &outfile, const unsigned &n_plot, const double &time, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt)
Definition: fourier_decomposed_helmholtz_elements.h:527
void output(FILE *file_pt)
C-style output function: r,z,u.
Definition: fourier_decomposed_helmholtz_elements.h:487
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: fourier_decomposed_helmholtz_elements.h:501
void output(std::ostream &outfile)
Output function: r,z,u.
Definition: fourier_decomposed_helmholtz_elements.h:462
void output_real_fct(std::ostream &outfile, const double &phi, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: fourier_decomposed_helmholtz_elements.h:514
static const unsigned Initial_Nvalue
Definition: fourier_decomposed_helmholtz_elements.h:435
QFourierDecomposedHelmholtzElement()
Definition: fourier_decomposed_helmholtz_elements.h:440
void output(FILE *file_pt, const unsigned &n_plot)
Definition: fourier_decomposed_helmholtz_elements.h:494
double dshape_and_dtest_eulerian_at_knot_fourier_decomposed_helmholtz(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: fourier_decomposed_helmholtz_elements.h:596
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
Definition: fourier_decomposed_helmholtz_elements.h:456
void output(std::ostream &outfile, const unsigned &n_plot)
Definition: fourier_decomposed_helmholtz_elements.h:469
double dshape_and_dtest_eulerian_fourier_decomposed_helmholtz(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: fourier_decomposed_helmholtz_elements.h:569
QFourierDecomposedHelmholtzElement(const QFourierDecomposedHelmholtzElement< NNODE_1D > &dummy)=delete
Broken copy constructor.
unsigned ntstorage() const
Definition: timesteppers.h:601
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237
float real
Definition: datatypes.h:10
RealScalar s
Definition: level1_cplx_impl.h:130
int * m
Definition: level2_cplx_impl.h:294
squared absolute sa ArrayBase::abs2 DOXCOMMA MatrixBase::cwiseAbs2 sa Eigen::abs2 DOXCOMMA Eigen::pow DOXCOMMA ArrayBase::square nearest sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round nearest integer not less than the given sa Eigen::floor DOXCOMMA ArrayBase::ceil not a number test
Definition: GlobalFunctions.h:109
void flux(const double &time, const Vector< double > &x, double &flux)
Get flux applied along boundary x=0.
Definition: pretend_melt.cc:59
void source(const Vector< double > &x, Vector< double > &f)
Source function.
Definition: unstructured_two_d_circle.cc:46
int error
Definition: calibrate.py:297
double factorial(const unsigned &l)
Factorial.
Definition: fourier_decomposed_helmholtz_elements.cc:40
double plgndr1(const unsigned &n, const double &x)
Legendre polynomials depending on one parameter.
Definition: fourier_decomposed_helmholtz_elements.cc:50
double plgndr2(const unsigned &l, const unsigned &m, const double &x)
Legendre polynomials depending on two parameters.
Definition: fourier_decomposed_helmholtz_elements.cc:97
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28
t
Definition: plotPSD.py:36
Definition: indexed_view.cpp:20
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
void output(std::ostream &outfile, const unsigned &nplot)
Overload output function.
Definition: overloaded_element_body.h:490
EIGEN_DONT_INLINE Scalar zero()
Definition: svd_common.h:232
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2