Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | List of all members
Nektar::LibUtilities::NodalUtilHex Class Reference

Specialisation of the NodalUtil class to support nodal hex elements. More...

#include <NodalUtil.h>

Inheritance diagram for Nektar::LibUtilities::NodalUtilHex:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LibUtilities::NodalUtilHex:
Collaboration graph
[legend]

Public Member Functions

 NodalUtilHex (int degree, Array< OneD, NekDouble > r, Array< OneD, NekDouble > s, Array< OneD, NekDouble > t)
 Construct the nodal utility class for a hexahedron. More...
 
virtual ~NodalUtilHex ()
 
- Public Member Functions inherited from Nektar::LibUtilities::NodalUtil
NekVector< NekDoubleGetWeights ()
 Obtain the integration weights for the given nodal distribution. More...
 
SharedMatrix GetVandermonde ()
 Return the Vandermonde matrix for the nodal distribution. More...
 
SharedMatrix GetVandermondeForDeriv (int dir)
 Return the Vandermonde matrix of the derivative of the basis functions for the nodal distribution. More...
 
SharedMatrix GetDerivMatrix (int dir)
 Return the derivative matrix for the nodal distribution. More...
 
SharedMatrix GetInterpolationMatrix (Array< OneD, Array< OneD, NekDouble > > &xi)
 Construct the interpolation matrix used to evaluate the basis at the points xi inside the element. More...
 

Protected Member Functions

virtual NekVector< NekDoublev_OrthoBasis (const int mode)
 Return the value of the modal functions for the hex element at the nodal points m_xi for a given mode. More...
 
virtual NekVector< NekDoublev_OrthoBasisDeriv (const int dir, const int mode)
 Return the values of the derivative of the orthogonal basis at the nodal points for a given mode. More...
 
virtual boost::shared_ptr
< NodalUtil
v_CreateUtil (Array< OneD, Array< OneD, NekDouble > > &xi)
 Construct a NodalUtil object of the appropriate element type for a given set of points. More...
 
virtual NekDouble v_ModeZeroIntegral ()
 Return the value of the integral of the zero-th mode for this element. More...
 
virtual int v_NumModes ()
 Calculate the number of degrees of freedom for this element. More...
 
- Protected Member Functions inherited from Nektar::LibUtilities::NodalUtil
 NodalUtil (int degree, int dim)
 Set up the NodalUtil object. More...
 

Protected Attributes

std::vector< Modem_ordering
 Mapping from the $ (i,j,k) $ indexing of the basis to a continuous ordering. More...
 
- Protected Attributes inherited from Nektar::LibUtilities::NodalUtil
int m_dim
 Dimension of the nodal element. More...
 
int m_degree
 Degree of the nodal element. More...
 
int m_numPoints
 Total number of nodal points. More...
 
Array< OneD, Array< OneD,
NekDouble > > 
m_xi
 Coordinates of the nodal points defining the basis. More...
 

Private Types

typedef boost::tuple< int, int,
int > 
Mode
 

Detailed Description

Specialisation of the NodalUtil class to support nodal hex elements.

Definition at line 353 of file NodalUtil.h.

Member Typedef Documentation

typedef boost::tuple<int, int, int> Nektar::LibUtilities::NodalUtilHex::Mode
private

Definition at line 355 of file NodalUtil.h.

Constructor & Destructor Documentation

Nektar::LibUtilities::NodalUtilHex::NodalUtilHex ( int  degree,
Array< OneD, NekDouble r,
Array< OneD, NekDouble s,
Array< OneD, NekDouble t 
)

Construct the nodal utility class for a hexahedron.

The constructor of this class sets up the m_ordering member variable used in the evaluation of the orthogonal basis.

Parameters
degreePolynomial order of this nodal hexahedron.
r$ \xi_1 $-coordinates of nodal points in the standard element.
s$ \xi_2 $-coordinates of nodal points in the standard element.

Definition at line 956 of file NodalUtil.cpp.

References Nektar::LibUtilities::NodalUtil::m_degree, Nektar::LibUtilities::NodalUtil::m_numPoints, m_ordering, and Nektar::LibUtilities::NodalUtil::m_xi.

960  : NodalUtil(degree, 3)
961 {
962  // Set up parent variables.
963  m_numPoints = r.num_elements();
964  m_xi[0] = r;
965  m_xi[1] = s;
966  m_xi[2] = t;
967 
968  // Construct a mapping (i,j,k) -> m from the tensor product space (i,j,k) to
969  // a single ordering m.
970  for (int k = 0; k <= m_degree; ++k)
971  {
972  for (int j = 0; j <= m_degree; ++j)
973  {
974  for (int i = 0; i <= m_degree; ++i)
975  {
976  m_ordering.push_back(Mode(i, j, k));
977  }
978  }
979  }
980 }
boost::tuple< int, int, int > Mode
Definition: NodalUtil.h:355
int m_degree
Degree of the nodal element.
Definition: NodalUtil.h:108
std::vector< Mode > m_ordering
Mapping from the indexing of the basis to a continuous ordering.
Definition: NodalUtil.h:370
NodalUtil(int degree, int dim)
Set up the NodalUtil object.
Definition: NodalUtil.h:101
Array< OneD, Array< OneD, NekDouble > > m_xi
Coordinates of the nodal points defining the basis.
Definition: NodalUtil.h:112
int m_numPoints
Total number of nodal points.
Definition: NodalUtil.h:110
virtual Nektar::LibUtilities::NodalUtilHex::~NodalUtilHex ( )
inlinevirtual

Definition at line 363 of file NodalUtil.h.

364  {
365  }

Member Function Documentation

virtual boost::shared_ptr<NodalUtil> Nektar::LibUtilities::NodalUtilHex::v_CreateUtil ( Array< OneD, Array< OneD, NekDouble > > &  xi)
inlineprotectedvirtual

Construct a NodalUtil object of the appropriate element type for a given set of points.

This function is used inside NodalUtil::GetInterpolationMatrix so that the (potentially non-square) Vandermonde matrix can be constructed to create the interpolation matrix at an arbitrary set of points in the domain.

Parameters
xiDistribution of nodal points to create utility with.

Implements Nektar::LibUtilities::NodalUtil.

Definition at line 376 of file NodalUtil.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and Nektar::LibUtilities::NodalUtil::m_degree.

378  {
380  m_degree, xi[0], xi[1], xi[2]);
381  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
int m_degree
Degree of the nodal element.
Definition: NodalUtil.h:108
virtual NekDouble Nektar::LibUtilities::NodalUtilHex::v_ModeZeroIntegral ( )
inlineprotectedvirtual

Return the value of the integral of the zero-th mode for this element.

Note that for the orthogonal basis under consideration, all modes integrate to zero asides from the zero-th mode. This function is used in NodalUtil::GetWeights to determine integration weights.

Implements Nektar::LibUtilities::NodalUtil.

Definition at line 383 of file NodalUtil.h.

384  {
385  return 8.0;
386  }
virtual int Nektar::LibUtilities::NodalUtilHex::v_NumModes ( )
inlineprotectedvirtual

Calculate the number of degrees of freedom for this element.

Implements Nektar::LibUtilities::NodalUtil.

Definition at line 388 of file NodalUtil.h.

References Nektar::LibUtilities::NodalUtil::m_degree.

389  {
390  return (m_degree + 1) * (m_degree + 1) * (m_degree + 1);
391  }
int m_degree
Degree of the nodal element.
Definition: NodalUtil.h:108
NekVector< NekDouble > Nektar::LibUtilities::NodalUtilHex::v_OrthoBasis ( const int  mode)
protectedvirtual

Return the value of the modal functions for the hex element at the nodal points m_xi for a given mode.

In a quad, we use the orthogonal basis

\[ \psi_{m(ijk)} = P^{(0,0)}_i(\xi_1) P_j^{(0,0)}(\xi_2) P_k^{(0,0)}(\xi_3) \]

Parameters
modeThe mode of the orthogonal basis to evaluate.

Implements Nektar::LibUtilities::NodalUtil.

Definition at line 994 of file NodalUtil.cpp.

References Polylib::jacobfd(), Nektar::LibUtilities::NodalUtil::m_numPoints, m_ordering, Nektar::LibUtilities::NodalUtil::m_xi, and CG_Iterations::modes.

995 {
996  std::vector<NekDouble> jacobi_i(m_numPoints), jacobi_j(m_numPoints);
997  std::vector<NekDouble> jacobi_k(m_numPoints);
998  Mode modes = m_ordering[mode];
999 
1000  const int I = modes.get<0>(), J = modes.get<1>(), K = modes.get<2>();
1001 
1002  // Calculate Jacobi polynomials
1004  m_numPoints, &m_xi[0][0], &jacobi_i[0], NULL, I, 0.0, 0.0);
1006  m_numPoints, &m_xi[1][0], &jacobi_j[0], NULL, J, 0.0, 0.0);
1008  m_numPoints, &m_xi[2][0], &jacobi_k[0], NULL, K, 0.0, 0.0);
1009 
1010  NekVector<NekDouble> ret(m_numPoints);
1011 
1012  for (int i = 0; i < m_numPoints; ++i)
1013  {
1014  ret[i] = jacobi_i[i] * jacobi_j[i] * jacobi_k[i];
1015  }
1016 
1017  return ret;
1018 }
boost::tuple< int, int, int > Mode
Definition: NodalUtil.h:355
std::vector< Mode > m_ordering
Mapping from the indexing of the basis to a continuous ordering.
Definition: NodalUtil.h:370
Array< OneD, Array< OneD, NekDouble > > m_xi
Coordinates of the nodal points defining the basis.
Definition: NodalUtil.h:112
int m_numPoints
Total number of nodal points.
Definition: NodalUtil.h:110
void jacobfd(const int np, const double *z, double *poly_in, double *polyd, const int n, const double alpha, const double beta)
Routine to calculate Jacobi polynomials, , and their first derivative, .
Definition: Polylib.cpp:1920
NekVector< NekDouble > Nektar::LibUtilities::NodalUtilHex::v_OrthoBasisDeriv ( const int  dir,
const int  mode 
)
protectedvirtual

Return the values of the derivative of the orthogonal basis at the nodal points for a given mode.

Parameters
dirCoordinate direction of derivative.
modeMode number, which is between 0 and NodalUtil::v_NumModes()
  • 1.

Implements Nektar::LibUtilities::NodalUtil.

Definition at line 1020 of file NodalUtil.cpp.

References Polylib::jacobd(), Polylib::jacobfd(), Nektar::LibUtilities::NodalUtil::m_numPoints, m_ordering, Nektar::LibUtilities::NodalUtil::m_xi, and CG_Iterations::modes.

1022 {
1023  std::vector<NekDouble> jacobi_i(m_numPoints), jacobi_j(m_numPoints);
1024  std::vector<NekDouble> jacobi_k(m_numPoints);
1025  std::vector<NekDouble> jacobi_di(m_numPoints), jacobi_dj(m_numPoints);
1026  std::vector<NekDouble> jacobi_dk(m_numPoints);
1027  Mode modes = m_ordering[mode];
1028 
1029  const int I = modes.get<0>(), J = modes.get<1>(), K = modes.get<2>();
1030 
1031  // Calculate Jacobi polynomials and their derivatives. Note that we use both
1032  // jacobfd and jacobd since jacobfd is only valid for derivatives in the
1033  // open interval (-1,1).
1035  m_numPoints, &m_xi[0][0], &jacobi_i[0], NULL, I, 0.0, 0.0);
1037  m_numPoints, &m_xi[1][0], &jacobi_j[0], NULL, J, 0.0, 0.0);
1039  m_numPoints, &m_xi[2][0], &jacobi_k[0], NULL, K, 0.0, 0.0);
1041  m_numPoints, &m_xi[0][0], &jacobi_di[0], I, 0.0, 0.0);
1043  m_numPoints, &m_xi[1][0], &jacobi_dj[0], J, 0.0, 0.0);
1045  m_numPoints, &m_xi[2][0], &jacobi_dk[0], K, 0.0, 0.0);
1046 
1047  NekVector<NekDouble> ret(m_numPoints);
1048 
1049  if (dir == 0)
1050  {
1051  for (int i = 0; i < m_numPoints; ++i)
1052  {
1053  ret[i] = jacobi_di[i] * jacobi_j[i] * jacobi_k[i];
1054  }
1055  }
1056  else if (dir == 1)
1057  {
1058  for (int i = 0; i < m_numPoints; ++i)
1059  {
1060  ret[i] = jacobi_dj[i] * jacobi_i[i] * jacobi_k[i];
1061  }
1062  }
1063  else
1064  {
1065  for (int i = 0; i < m_numPoints; ++i)
1066  {
1067  ret[i] = jacobi_i[i] * jacobi_j[i] * jacobi_dk[i];
1068  }
1069  }
1070 
1071  return ret;
1072 }
boost::tuple< int, int, int > Mode
Definition: NodalUtil.h:355
void jacobd(const int np, const double *z, double *polyd, const int n, const double alpha, const double beta)
Calculate the derivative of Jacobi polynomials.
Definition: Polylib.cpp:2120
std::vector< Mode > m_ordering
Mapping from the indexing of the basis to a continuous ordering.
Definition: NodalUtil.h:370
Array< OneD, Array< OneD, NekDouble > > m_xi
Coordinates of the nodal points defining the basis.
Definition: NodalUtil.h:112
int m_numPoints
Total number of nodal points.
Definition: NodalUtil.h:110
void jacobfd(const int np, const double *z, double *poly_in, double *polyd, const int n, const double alpha, const double beta)
Routine to calculate Jacobi polynomials, , and their first derivative, .
Definition: Polylib.cpp:1920

Member Data Documentation

std::vector<Mode> Nektar::LibUtilities::NodalUtilHex::m_ordering
protected

Mapping from the $ (i,j,k) $ indexing of the basis to a continuous ordering.

Definition at line 370 of file NodalUtil.h.

Referenced by NodalUtilHex(), v_OrthoBasis(), and v_OrthoBasisDeriv().