29#ifndef OOMPH_QSPECTRAL_ELEMENT_HEADER
30#define OOMPH_QSPECTRAL_ELEMENT_HEADER
34#include <oomph-lib-config.h>
48 static std::map<unsigned, Vector<double>>
z;
54 if (
z.find(order) ==
z.end())
70 using namespace Orthpoly;
72 unsigned p = order - 1;
74 for (
unsigned i = 0;
i < order;
i++)
85 (1.0 -
s *
s) * dlegendre(
p,
s) /
86 (
p * (
p + 1) * legendre(
p,
z[order][
i]) * (
z[order][
i] -
s));
100 unsigned p = order - 1;
104 for (
unsigned i = 0;
i < order;
i++)
107 for (
unsigned j = 0;
j < order;
j++)
120 (*this)[
i] = -(1.0 +
p) *
p / 4.0;
124 (*this)[
i] = (1.0 +
p) *
p / 4.0;
361 template<
unsigned DIM,
unsigned NNODE_1D>
370 template<
unsigned NNODE_1D>
389 Nodal_spectral_order.resize(1,
NNODE_1D);
391 this->set_dimension(1);
393 this->set_integration_scheme(&integral);
425 nod_pt = this->node_pt(0);
431 std::ostringstream error_message;
432 error_message <<
"Vertex node number is " <<
j
433 <<
" but must be from 0 to 1\n";
510 void output(std::ostream&
outfile);
519 const unsigned&
nplot,
544 std::ostringstream
header;
555 for (
unsigned i = 0;
i <
DIM;
i++)
567 void build_face_element(
const int& face_index,
575 template<
unsigned NNODE_1D>
594 template<
unsigned NNODE_1D>
618 template<
unsigned NNODE_1D>
624 std::ostringstream error_message;
626 <<
"\nd2shpe_local currently not implemented for this element\n";
648 template<
unsigned NNODE_1D>
667 Nodal_spectral_order.resize(2,
NNODE_1D);
669 this->set_dimension(2);
671 this->set_integration_scheme(&integral);
703 nod_pt = this->node_pt(0);
715 std::ostringstream error_message;
716 error_message <<
"Vertex node number is " <<
j
717 <<
" but must be from 0 to 3\n";
801 void output(std::ostream&
outfile);
810 const unsigned&
nplot,
842 std::ostringstream
header;
853 for (
unsigned i = 0;
i <
DIM;
i++)
867 void build_face_element(
const int& face_index,
875 template<
unsigned NNODE_1D>
897 template<
unsigned NNODE_1D>
933 template<
unsigned NNODE_1D>
939 std::ostringstream error_message;
941 <<
"\nd2shpe_local currently not implemented for this element\n";
963 template<
unsigned NNODE_1D>
982 Nodal_spectral_order.resize(3,
NNODE_1D);
984 this->set_dimension(3);
986 this->set_integration_scheme(&integral);
1018 nod_pt = this->node_pt(0);
1043 std::ostringstream error_message;
1044 error_message <<
"Vertex node number is " <<
j
1045 <<
" but must be from 0 to 7\n";
1135 void output(std::ostream&
outfile);
1138 void output(std::ostream&
outfile,
const unsigned&
nplot);
1144 const unsigned&
nplot,
1181 std::ostringstream
header;
1193 for (
unsigned i = 0;
i <
DIM;
i++)
1209 void build_face_element(
const int& face_index,
1217 template<
unsigned NNODE_1D>
1244 template<
unsigned NNODE_1D>
1291 template<
unsigned NNODE_1D>
1297 std::ostringstream error_message;
1299 <<
"\nd2shpe_local currently not implemented for this element\n";
1321 template<
unsigned DIM>
Base class for all brick elements.
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
A class that represents a collection of data; each Data object may contain many different individual ...
static long Is_pinned
Static "Magic number" used in place of the equation number to indicate that the value is pinned.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
static long Is_unclassified
Static "Magic number" used in place of the equation number to denote a value that hasn't been classif...
void resize(const unsigned long &n)
Resize to a square nxn matrix; any values already present will be transfered.
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
A general Finite Element class.
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
double size() const
Calculate the size of the element (length, area, volume,...) in Eulerian computational coordinates....
virtual void assign_all_generic_local_eqn_numbers(const bool &store_local_dof_pt)
Overloaded version of the calculation of the local equation numbers. If the boolean argument is true ...
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.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
virtual void describe_local_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the local dofs of the element[s]. The ostream specifies the output stream to whi...
int get_node_number(Node *const &node_pt) const
Return the number of the node *node_pt if this node is in the element, else return -1;.
unsigned ndof() const
Return the number of equations/dofs in the element.
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
int local_eqn_number(const unsigned long &ieqn_global) const
Return the local equation number corresponding to the ieqn_global-th global equation number....
void add_global_eqn_numbers(std::deque< unsigned long > const &global_eqn_numbers, std::deque< double * > const &global_dof_pt)
Add the contents of the queue global_eqn_numbers to the local storage for the local-to-global transla...
static std::deque< double * > Dof_pt_deque
Static storage for deque used to add_global_equation_numbers when pointers to the dofs in each elemen...
void describe_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the dofs of the element. The ostream specifies the output stream to which the de...
Base class for all line elements.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
OneDLegendreDShapeParam(const unsigned &order, const double &s)
Class that returns the shape functions associated with legendre.
static void calculate_nodal_positions(const unsigned &order)
Static function used to populate the stored positions.
static std::map< unsigned, Vector< double > > z
static double nodal_position(const unsigned &order, const unsigned &n)
OneDLegendreShapeParam(const unsigned &order, const double &s)
Constructor.
static double nodal_position(const unsigned &n)
static void calculate_nodal_positions()
Static function used to populate the stored positions.
An OomphLibError object which should be thrown when an run-time error is encountered....
double invert_jacobian_mapping(const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Overload the template-free interface for the calculation of inverse jacobian matrix....
static GaussLobattoLegendre< 1, NNODE_1D > integral
Default integration rule: Gaussian integration of same 'order' as the element.
std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction)
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
double s_min() const
Min. value of local coordinate.
double local_one_d_fraction_of_node(const unsigned &n1d, const unsigned &i)
The local one-d fraction is the same.
unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction)
QSpectralElement()
Constructor.
void local_coordinate_of_node(const unsigned &n, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size.
void output(FILE *file_pt)
C-style output.
unsigned nnode_1d() const
Number of nodes along each element edge.
void local_fraction_of_node(const unsigned &n, Vector< double > &s_fraction)
Get the local fractino of node j in the element.
void output(FILE *file_pt, const unsigned &n_plot)
C_style output at n_plot points.
double s_max() const
Max. value of local coordinate.
void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &use_equally_spaced_interior_sample_points=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
unsigned nvertex_node() const
Number of vertex nodes in the element.
void output(FILE *file_pt)
C-style output.
void output(FILE *file_pt, const unsigned &n_plot)
C_style output at n_plot points.
void local_coordinate_of_node(const unsigned &n, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size.
std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction)
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
double invert_jacobian_mapping(const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Overload the template-free interface for the calculation of inverse jacobian matrix....
void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &use_equally_spaced_interior_sample_points=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
QSpectralElement()
Constructor.
void local_fraction_of_node(const unsigned &n, Vector< double > &s_fraction)
Get the local fractino of node j in the element.
unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction)
unsigned nnode_1d() const
Number of nodes along each element edge.
unsigned nvertex_node() const
Number of vertex nodes in the element.
double s_max() const
Max. value of local coordinate.
double s_min() const
Min. value of local coordinate.
static GaussLobattoLegendre< 2, NNODE_1D > integral
Default integration rule: Gaussian integration of same 'order' as the element.
double local_one_d_fraction_of_node(const unsigned &n1d, const unsigned &i)
The local one-d fraction is the same.
void output(FILE *file_pt, const unsigned &n_plot)
C_style output at n_plot points.
QSpectralElement()
Constructor.
void output(FILE *file_pt)
C-style output.
void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &use_equally_spaced_interior_sample_points=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
static GaussLobattoLegendre< 3, NNODE_1D > integral
Default integration rule: Gaussian integration of same 'order' as the element.
void local_fraction_of_node(const unsigned &n, Vector< double > &s_fraction)
Get the local fractino of node j in the element.
void local_coordinate_of_node(const unsigned &n, Vector< double > &s) const
Get local coordinates of node j in the element; vector sets its own size.
double s_min() const
Min. value of local coordinate.
double local_one_d_fraction_of_node(const unsigned &n1d, const unsigned &i)
The local one-d fraction is the same.
double invert_jacobian_mapping(const DenseMatrix< double > &jacobian, DenseMatrix< double > &inverse_jacobian) const
Overload the template-free interface for the calculation of inverse jacobian matrix....
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
double s_max() const
Max. value of local coordinate.
unsigned nvertex_node() const
Number of vertex nodes in the element.
unsigned nnode_1d() const
Number of nodes along each element edge.
std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction)
unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction)
General QLegendreElement class.
Base class for all quad elements.
A class that is used to template the refineable Q spectral elements by dimension. It's really nothing...
RefineableQSpectralElement()
Empty constuctor.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
Vector< Data * > * Spectral_data_pt
Additional Storage for shared spectral data.
DenseMatrix< int > Spectral_local_eqn
Local equation numbers for the spectral degrees of freedom.
virtual void assign_all_generic_local_eqn_numbers(const bool &store_local_dof_pt)
Assign the local equation numbers. If the boolean argument is true then store degrees of freedom at D...
virtual void describe_local_dofs(std::ostream &out, const std::string ¤t_string) const
Function to describe the local dofs of the element. The ostream specifies the output stream to which ...
unsigned nspectral() const
virtual ~SpectralElement()
Vector< unsigned > Nodal_spectral_order
Vector that represents the nodal spectral order.
Data * spectral_data_pt(const unsigned &i) const
Return the i-th data object associated with the polynomials of order p. Note that i <= p.
Vector< unsigned > Spectral_order
Vector that represents the spectral order in each dimension.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
double dlegendre(const unsigned &p, const double &x)
Calculates first derivative of Legendre polynomial of degree p at x using three term recursive formul...
double ddlegendre(const unsigned &p, const double &x)
Calculates second derivative of Legendre polynomial of degree p at x using three term recursive formu...
double legendre(const unsigned &p, const double &x)
Calculates Legendre polynomial of degree p at x using the three term recurrence relation .
void gll_nodes(const unsigned &Nnode, Vector< double > &x)
Calculates the Gauss Lobatto Legendre abscissas for degree p = NNode-1.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).