MOAB: Mesh Oriented datABase  (version 5.3.1)
MBMesquite::LinearPyramid Class Reference

Linear mapping function for a pyramid element. More...

#include <LinearPyramid.hpp>

Inheritance diagram for MBMesquite::LinearPyramid:
Collaboration diagram for MBMesquite::LinearPyramid:

## Public Member Functions

virtual EntityTopology element_topology () const
Get MBMesquite::EntityTopology handled by this mapping function.
virtual int num_nodes () const
Get number of nodes in the element type.
virtual NodeSet sample_points (NodeSet higher_order_nodes) const
Get sample points at which to evaluate mapping function.
virtual void coefficients (Sample location, NodeSet nodeset, double *coeff_out, size_t *indices_out, size_t &num_coeff_out, MsqError &err) const
Mapping Function Coefficients.
virtual void derivatives (Sample location, NodeSet nodeset, size_t *vertex_indices_out, MsqVector< 3 > *d_coeff_d_xi_out, size_t &num_vtx, MsqError &err) const
Mapping Function Derivatives.
virtual void ideal (Sample location, MsqMatrix< 3, 3 > &J, MsqError &err) const
Get ideal Jacobian matrix.

## Detailed Description

Linear mapping function for a pyramid element.

$$\vec{x}(\vec{\xi})=\sum_{i=0}^5 N_i(\vec{\xi})\vec{x_i}$$

• $$N_0(\vec{\xi})=(1-\xi)(1-\eta)(1-\zeta)$$
• $$N_1(\vec{\xi})= \xi (1-\eta)(1-\zeta)$$
• $$N_2(\vec{\xi})= \xi \eta (1-\zeta)$$
• $$N_3(\vec{\xi})=(1-\xi) \eta (1-\zeta)$$
• $$N_4(\vec{\xi})=\zeta$$

Where the mid-edge coordinates are:

• $$\vec{\xi}_{e0}=( \frac{1}{2}, 0, 0)$$
• $$\vec{\xi}_{e1}=( 1, \frac{1}{2}, 0)$$
• $$\vec{\xi}_{e2}=( \frac{1}{2}, 1, 0)$$
• $$\vec{\xi}_{e3}=( 0, \frac{1}{2}, 0)$$
• $$\vec{\xi}_{e4}=( 0, 0, \frac{1}{2})$$
• $$\vec{\xi}_{e5}=( 1, 0, \frac{1}{2})$$
• $$\vec{\xi}_{e6}=( 1, 1, \frac{1}{2})$$
• $$\vec{\xi}_{e7}=( 0, 1, \frac{1}{2})$$

and mid-face the coordinates are:

• $$\vec{\xi}_{f0}=( \frac{1}{2}, 0, \frac{1}{2})$$
• $$\vec{\xi}_{f1}=( 1, \frac{1}{2}, \frac{1}{2})$$
• $$\vec{\xi}_{f2}=( \frac{1}{2}, 1, \frac{1}{2})$$
• $$\vec{\xi}_{f3}=( 0, \frac{1}{2}, \frac{1}{2})$$
• $$\vec{\xi}_{f4}=( \frac{1}{2}, \frac{1}{2}, 0)$$

and the mid-element coorindates are

• $$\vec{\xi}_m=( \frac{1}{2}, \frac{1}{2}, \frac{1}{2})$$

Definition at line 70 of file LinearPyramid.hpp.

## Member Function Documentation

 void MBMesquite::LinearPyramid::coefficients ( Sample location, NodeSet nodeset, double * coeff_out, size_t * indices_out, size_t & num_coeff_out, MsqError & err ) const [virtual]

Mapping Function Coefficients.

This function returns the list of scalar values ( $$N_i$$'s) resulting from the evaluation of the mapping function coefficient terms $$N_1(\vec{\xi}), N_2(\vec{\xi}), \ldots, N_n(\vec{\xi})$$ for a given $$\vec{\xi}$$.

Parameters:
 location Where within the element at which to evaluate the coefficients. nodeset List of which nodes are present in the element. coefficients_out The coefficients ( $$N_i(\vec{\xi})$$) for each vertex in the element. indices_out The index ($i$ in $N_i$) for each term in 'coeffs_out'. The assumption is that mapping function implementations will not return zero coefficients. This is not required, but for element types with large numbers of nodes it may have a significant impact on performance.

Implements MBMesquite::MappingFunction.

Definition at line 228 of file LinearPyramid.cpp.

{
if( nodeset.have_any_mid_node() )
{
MSQ_SETERR( err )( nonlinear_error, MsqError::UNSUPPORTED_ELEMENT );
return;
}

switch( loc.dimension )
{
case 0:
coefficients_at_corner( loc.number, coeff_out, indices_out, num_coeff );
break;
case 1:
coefficients_at_mid_edge( loc.number, coeff_out, indices_out, num_coeff );
break;
case 2:
coefficients_at_mid_face( loc.number, coeff_out, indices_out, num_coeff );
break;
case 3:
coefficients_at_mid_elem( coeff_out, indices_out, num_coeff );
break;
default:
MSQ_SETERR( err )( "Invalid/unsupported logical dimension", MsqError::INVALID_ARG );
}
}

 void MBMesquite::LinearPyramid::derivatives ( Sample location, NodeSet nodeset, size_t * vertex_indices_out, MsqVector< 3 > * d_coeff_d_xi_out, size_t & num_vtx, MsqError & err ) const [virtual]

Mapping Function Derivatives.

This group of methods return the partial derivatives of the mapping function coefficient terms $$\nabla N_1(\vec{\xi}), \nabla N_2(\vec{\xi}), \ldots, \nabla N_n(\vec{\xi})$$ evaluated for a given $$\vec{\xi}$$, where $$\vec{x_i}$$ is a point in $$\mathbf{R}^3$$ (i.e. $$x_i,y_i,z_i$$). $$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \end{array}\right\}$$ for surface elements and $$\vec{\xi_i} = \left\{\begin{array}{c}\xi_i\\ \eta_i\\ \zeta_i\\ \end{array}\right\}$$ for volume elements.

The list of returned partial derivatives may be considered list of elements of a matrix $$\mathbf{D}$$ in row major order. For surface elements, $$\mathbf{D}$$ is a $$n\times 2$$ matrix and for volume elements it is a $$n \times 3$$ matrix. Each row of $$\mathbf{D}$$ corresponds to one of the coefficient functions $$N_i(\vec{\xi})$$ and each column corresponds to one of the components of $$\vec{\xi}$$ that the corresponding coefficient function is differentiated with respect to.

$$\mathbf{D} = \left[ \begin{array}{ccc} \frac{\delta N_1}{\delta \xi} & \frac{\delta N_1}{\delta \eta} & \ldots \\ \frac{\delta N_2}{\delta \xi} & \frac{\delta N_2}{\delta \eta} & \ldots \\ \vdots & \vdots & \ddots \end{array} \right]$$

The Jacobian matrix ( $$\mathbf{J}$$) of the mapping function can be calculated as follows. Define a matrix $$\mathbf{X}$$ such that each column contains the coordinates of the element nodes.

$$\mathbf{X} = \left[ \begin{array}{ccc} x_1 & x_2 & \ldots \\ y_1 & y_2 & \ldots \\ z_1 & z_2 & \ldots \end{array}\right]$$

The Jacobian matrix is then:

$$\mathbf{J} = \mathbf{X} \times \mathbf{D}$$

$$\mathbf{X}$$ is always $$3\times n$$, so $$\mathbf{J}$$ is either $$3\times 2$$ (surface elements) or $$3\times 3$$ (volume elements) depending on the dimensions of $$\mathbf{D}$$.

If the Jacobian matrix of the mapping function is considered as a function of the element vertex coordinates $$\mathbf{J}(\vec{x_1},\vec{x_2},\ldots)$$ with $$\vec{\xi}$$ constant, then the gradient of that Jacobian matrix function (with respect to the vertex coordinates) can be obtained from the same output list of partial deravitves.

$$\frac{\delta \mathbf{J}}{\delta x_i} = \left[ \begin{array}{ccc} \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots \\ 0 & 0 & \ldots \\ 0 & 0 & \ldots \end{array} \right]$$ $$\frac{\delta \mathbf{J}}{\delta y_i} = \left[ \begin{array}{ccc} 0 & 0 & \ldots \\ \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots \\ 0 & 0 & \ldots \end{array} \right]$$ $$\frac{\delta \mathbf{J}}{\delta z_i} = \left[ \begin{array}{ccc} 0 & 0 & \ldots \\ 0 & 0 & \ldots \\ \frac{\delta N_i}{\delta \xi} & \frac{\delta N_i}{\delta \eta} & \ldots \end{array} \right]$$

Parameters:
 location Where within the element at which to evaluate the derivatives. nodeset List of which nodes are present in the element. vertices_out The list of vertices for which the corresponding coefficient in the mapping function is non-zero. The vertices are specified by their index in the canonical ordering for an element with all mid-nodes present (i.e. first all the corner nodes, then the mid-edge nodes, ...). d_coeff_d_xi_out The mapping function is composed of a series of coefficient functions $$N_i(\vec{\xi})$$, one correspoding to the position $$\vec{x_i}$$ of each node in the element such that the mapping function is of the form: $$\vec{x}(\vec{\xi})=\sum_{i=1}^n N_i(\vec{\xi})\vec{x_i}$$. For each vertex indicated in vertex_indices_out, this list contains the partial derivatives of the cooresponding coefficient function $$N_i$$ with respect to each component of $$\vec{\xi}$$ in the same order as the corresponding nodes in vertex_indices_out. num_vtx Output: The number of vertex indices and derivitive tuples returned in vertices_out and d_coeff_d_xi_out, respectively.

Implements MBMesquite::MappingFunction3D.

Definition at line 256 of file LinearPyramid.cpp.

{
if( nodeset.have_any_mid_node() )
{
MSQ_SETERR( err )( nonlinear_error, MsqError::UNSUPPORTED_ELEMENT );
return;
}

switch( loc.dimension )
{
case 0:
if( loc.number == 4 ) { set_equal_derivatives( 0.0, vertex_indices_out, d_coeff_d_xi_out, num_vtx ); }
else
{
set_corner_derivatives( loc.number, 1.0, vertex_indices_out, d_coeff_d_xi_out, num_vtx );
}
break;
case 1:
if( loc.number < 4 )
{
set_edge_derivatives( loc.number, 0.50, vertex_indices_out, d_coeff_d_xi_out, num_vtx );
}
else
{
set_corner_derivatives( loc.number - 4, 0.50, vertex_indices_out, d_coeff_d_xi_out, num_vtx );
}
break;
case 2:
if( loc.number == 4 ) { set_equal_derivatives( 0.5, vertex_indices_out, d_coeff_d_xi_out, num_vtx ); }
else
{
set_edge_derivatives( loc.number, 0.25, vertex_indices_out, d_coeff_d_xi_out, num_vtx );
}
break;
case 3:
set_equal_derivatives( 0.25, vertex_indices_out, d_coeff_d_xi_out, num_vtx );
break;
default:
MSQ_SETERR( err )( "Invalid/unsupported logical dimension", MsqError::INVALID_ARG );
}
}

 EntityTopology MBMesquite::LinearPyramid::element_topology ( ) const [virtual]

Get MBMesquite::EntityTopology handled by this mapping function.

Implements MBMesquite::MappingFunction.

Definition at line 144 of file LinearPyramid.cpp.

References MBMesquite::PYRAMID.

{
return PYRAMID;
}

 void MBMesquite::LinearPyramid::ideal ( Sample location, MsqMatrix< 3, 3 > & jacobian_out, MsqError & err ) const [virtual]

Get ideal Jacobian matrix.

Returns the Jacobian matrix of an ideal element. The orientation of element or corresponding matrix is arbitrary. The "ideal" element should be scaled such the Jacobian (determinant of the Jacobian matrix) is 1.0.

Parameters:
 location Where within the element at which to evaluate the Jacobian. Typically doesn't matter except for degenerate elements (e.g. pyramid as degenerate hex.) jacobian_out The Jacobian of the mapping function at the specified logical location.

Reimplemented from MBMesquite::MappingFunction3D.

Definition at line 299 of file LinearPyramid.cpp.

References MBMesquite::Sample::dimension, and MBMesquite::Sample::number.

{
// For an ideal element with unit edge length at the base and unit
// height, the Jacobian matrix is:
// | 1-zeta    0      1/2 - xi  |
// |  0       1-zeta  1/2 - eta |
// |  0        0       1        |
//
// The coefficient to produce a unit determinant
// is therefore (1-zeta)^(-2/3).
//
// Thus the unit-determinate ideal element Jacobian
// is, given alpha = (1-zeta)^(-1/3):
//
// | 1/alpha  0      alpha^2 (1/2 - xi) |
// | 0       1/alpha alpha^2 (1/2 - eta)|
// | 0        0      alpha^2            |
//
// There are only three zeta values of interest:
//  zeta = 1 : the degenerate case
//  zeta = 0 : both 1/alpha and alpha^2 are 1.0
//  zeta = 1/2 : 1/alpha = 1/cbrt(2.0) and alpha^2 = 2*(1/alpha)

// special case for apex
if( location.dimension == 0 && location.number == 4 )
{
J = MsqMatrix< 3, 3 >( 0.0 );
return;
}

// These are always zero
J( 0, 1 ) = J( 1, 0 ) = J( 2, 0 ) = J( 2, 1 ) = 0.0;

// Set diagonal terms and magnitude of terms in 3rd column based on zeta

// All of the zeta=0 locations
double f;
if( location.dimension == 0 || ( location.dimension == 1 && location.number < 4 ) ||
( location.dimension == 2 && location.number == 4 ) )
{
J( 0, 0 ) = J( 1, 1 ) = J( 2, 2 ) = 1.0;
f                                 = 0.5;
}
// all of the zeta=1/2 locations
else
{
f = J( 0, 0 ) = J( 1, 1 ) = 0.79370052598409979;
J( 2, 2 )                 = 2.0 * f;
}

// Set terms in 3rd column based on xi,eta

// The xi = eta = 0.5 locations (mid-element in xi and eta)
if( location.dimension == 3 || ( location.dimension == 2 && location.number == 4 ) )
{
J( 0, 2 ) = J( 1, 2 ) = 0.0;
}
// The corner locations
else if( location.dimension == 0 || ( location.dimension == 1 && location.number >= 4 ) )
{
switch( location.number % 4 )
{
case 0:
J( 0, 2 ) = f;
J( 1, 2 ) = f;
break;
case 1:
J( 0, 2 ) = -f;
J( 1, 2 ) = f;
break;
case 2:
J( 0, 2 ) = -f;
J( 1, 2 ) = -f;
break;
case 3:
J( 0, 2 ) = f;
J( 1, 2 ) = -f;
break;
}
}
// The mid-edge locations
else
{
switch( location.number )
{
case 0:
J( 0, 2 ) = 0;
J( 1, 2 ) = f;
break;
case 1:
J( 0, 2 ) = -f;
J( 1, 2 ) = 0;
break;
case 2:
J( 0, 2 ) = 0;
J( 1, 2 ) = -f;
break;
case 3:
J( 0, 2 ) = f;
J( 1, 2 ) = 0;
break;
}
}
}

 int MBMesquite::LinearPyramid::num_nodes ( ) const [virtual]

Get number of nodes in the element type.

Get the number of nodes in the element type that the mapping function implements. It is assumed that the result of this function, in combination with the element topology, is sufficient to determine the element type.

Implements MBMesquite::MappingFunction.

Definition at line 149 of file LinearPyramid.cpp.

{
return 5;
}

 NodeSet MBMesquite::LinearPyramid::sample_points ( NodeSet higher_order_nodes ) const [virtual]

Get sample points at which to evaluate mapping function.

Get the points within the element at which TMP quality metrics that are a function of the mapping function Jacobian should be evaluated. The default (which may be overridden by individual mapping functions) is to evaluate at all nodes.

Reimplemented from MBMesquite::MappingFunction.

Definition at line 154 of file LinearPyramid.cpp.

{
NodeSet result;
result.set_all_corner_nodes( PYRAMID );
result.clear_corner_node( 4 );
return result;
}


List of all members.

The documentation for this class was generated from the following files: