39 namespace Legendre_functions_helper
46 if (l == 0)
return 1.0;
54 double plgndr1(
const unsigned& n,
const double& x)
62 if (std::fabs(x) > 1.0)
64 std::ostringstream error_stream;
65 error_stream <<
"Bad arguments in routine plgndr1: x=" << x
66 <<
" but should be less than 1 in absolute value.\n";
68 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
86 for (
i = 2;
i <= n;
i++)
88 pmm2 = (x * (2 *
i - 1) * pmm1 - (
i - 1) * pmm) /
i;
101 double plgndr2(
const unsigned& l,
const unsigned& m,
const double& x)
104 double fact, pmm, pmmp1, somx2;
109 if (std::fabs(x) > 1.0)
111 std::ostringstream error_stream;
112 error_stream <<
"Bad arguments in routine plgndr2: x=" << x
113 <<
" but should be less than 1 in absolute value.\n";
115 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
129 somx2 = sqrt((1.0 - x) * (1.0 + x));
131 for (
i = 1;
i <= m;
i++)
133 pmm *= -fact * somx2;
137 if (l == m)
return pmm;
142 pmmp1 = x * (2 * m + 1) * pmm;
150 for (ll = m + 2; ll <= l; ll++)
152 pll = (x * (2 * ll - 1) * pmmp1 - (ll + m - 1) * pmm) / (ll - m);
173 template<
unsigned NNODE_1D>
195 const unsigned&
flag)
227 std::complex<double> interpolated_u(0.0, 0.0);
237 for (
unsigned j = 0;
j < 2;
j++)
243 const std::complex<double>
u_value(
252 for (
unsigned j = 0;
j < 2;
j++)
260 std::complex<double> source(0.0, 0.0);
271 std::complex<double>(1.0, 0.0);
286 std::complex<double>
complex_r = std::complex<double>(1.0, 0.0);
297 for (
unsigned k = 0;
k < 2;
k++)
310 for (
unsigned k = 0;
k < 2;
k++)
337 for (
unsigned k = 0;
k < 2;
k++)
364 for (
unsigned k = 0;
k < 2;
k++)
379 for (
unsigned k = 0;
k < 2;
k++)
401 for (
unsigned k = 0;
k < 2;
k++)
427 for (
unsigned k = 0;
k < 2;
k++)
442 for (
unsigned k = 0;
k < 2;
k++)
490 const unsigned&
nplot)
504 std::complex<double> u(
506 for (
unsigned i = 0;
i < 2;
i++)
510 outfile << u.real() <<
" " << u.imag() << std::endl;
544 std::complex<double> u(
546 for (
unsigned i = 0;
i < 2;
i++)
566 const unsigned&
nplot)
580 std::complex<double> u(
583 for (
unsigned i = 0;
i < 2;
i++)
588 for (
unsigned i = 0;
i < 2;
i++)
611 const unsigned&
nplot,
640 for (
unsigned i = 0;
i < 2;
i++)
666 const unsigned&
nplot,
695 for (
unsigned i = 0;
i < 2;
i++)
740 outfile <<
"ZONE" << std::endl;
749 for (
unsigned i = 0;
i < 2;
i++)
767 std::complex<double>
u_fe =
774 for (
unsigned i = 0;
i < 2;
i++)
818 for (
unsigned i = 0;
i < 2;
i++)
833 std::complex<double>
u_fe =
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node.
unsigned nnode() const
Return the number of nodes.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction")
double raw_nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n but do NOT take hanging nodes into account.
double raw_nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. Do not use the hanging node representation....
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
virtual unsigned self_test()
Self-test: Check inversion of element & do self-test for GeneralisedElement. Return 0 if OK.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
int pml_fourier_wavenumber()
Get the Fourier wavenumber.
virtual void fill_in_generic_residual_contribution_pml_fourier_decomposed_helmholtz(Vector< double > &residuals, DenseMatrix< double > &jacobian, const unsigned &flag)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
void compute_error(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, double &error, double &norm)
Get error against and norm of exact solution.
void output_real(std::ostream &outfile, const double &phi, const unsigned &n_plot)
Output function for real part of full time-dependent solution u = Re( (u_r +i u_i) exp(-i omega t) at...
void output(std::ostream &outfile)
Output with default number of plot points.
void compute_complex_r(const unsigned &ipt, const Vector< double > &x, std::complex< double > &complex_r)
Compute complex variable r at position x[0] and integration point ipt.
static double Default_Physical_Constant_Value
Static default value for the physical constants (initialised to zero)
std::complex< double > interpolated_u_pml_fourier_decomposed_helmholtz(const Vector< double > &s) const
Return FE representation of function value u(s) at local coordinate s.
unsigned self_test()
Self-test: Return 0 for OK.
virtual std::complex< unsigned > u_index_pml_fourier_decomposed_helmholtz() const
Broken assignment operator.
double k_squared()
Get k squared.
virtual void get_source_pml_fourier_decomposed_helmholtz(const unsigned &ipt, const Vector< double > &x, std::complex< double > &source) const
Get source term at (Eulerian) position x. This function is virtual to allow overloading in multi-phys...
void compute_norm(double &norm)
Compute norm of fe solution.
void output_fct(std::ostream &outfile, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact soln: r,z,u_re_exact,u_im_exact at n_plot^2 plot points.
void compute_pml_coefficients(const unsigned &ipt, const Vector< double > &x, Vector< std::complex< double > > &pml_laplace_factor, std::complex< double > &pml_k_squared_factor)
Compute pml coefficients at position x and integration point ipt. pml_laplace_factor is used in the r...
void output_real_fct(std::ostream &outfile, const double &phi, const unsigned &n_plot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output function for real part of full time-dependent fct u = Re( (u_r +i u_i) exp(-i omega t) at phas...
virtual double dshape_and_dtest_eulerian_at_knot_pml_fourier_decomposed_helmholtz(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Shape/test functions and derivs w.r.t. to global coords at integration point ipt; return Jacobian of ...
static BermudezPMLMappingAndTransformedCoordinate Default_pml_mapping_and_transformed_coordinate
Static so that the class doesn't need to instantiate a new default everytime it uses it.
static const unsigned Initial_Nvalue
Static int that holds the number of variables at nodes: always the same.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
double factorial(const unsigned &l)
Factorial.
double plgndr1(const unsigned &n, const double &x)
Legendre polynomials depending on one parameter.
double plgndr2(const unsigned &l, const unsigned &m, const double &x)
Legendre polynomials depending on two parameters.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).