NiHu
2.0
|
The purpose of this tutorial is to explain how you can work with finite elements in NiHu.
Elements are coordinate transforms \( {\bf x}({\bf \xi})\) that map from an intrinsic domain to the physical coordinate space. Therefore, elements are defined by an interpolation shape function set \( L_i(\xi) \) and nodal locations \( {\bf x}_i \).
A two-dimensional four noded quadrilateral volume element type can be defined as
where NiHu::quad_1_shape_set refers to the four noded linear quadrilateral shape functions. The second template argument defines the scalar type of the physical coordinate space.
After the element type has been defined, an element instance can be constructed by providing the nodal locations to the constructor. The nodal locations need to be defined in a matrix of type NiHu::volume_element::coords_t. In our particular case, this is a 2x4 matrix of double elements, where each column stores a nodal coordinate \( {\bf x}_i \). The matrix is filled using Eigen's comma initialiser syntax.
Apparently, our element is a square volume \( 0 \le x,y \le 1 \).
The local intrinsic coordinate type of the element can be accessed as NiHu::volume_element::xi_t.
The element's physical location can be obtained by calling the member NiHu::volume_element::get_x with an argument \( \xi \). In our case, the location is a 2x1 double vector.
The element location gradient can be obtained by calling member NiHu::volume_element::get_dx. In our case, this gradient is a 2x2 matrix, where the first column contains the derivative with respect to the first local coordinate \( {\bf x},_{\xi} \) and the second colum contains \( {\bf x},_{\eta} \). The element Jacobian can be obtained by evaluating the determinant of the gradient matrix.
The second derivative of the coordinate mapping is returned by function NiHu::volume_element::get_ddx. In our case, this is a 2x3 matrix, where the first column contains the second derivative with respect to the fisrt intrinsic coordinate \( {\bf x},_{\xi\xi}\), the second column contains \( {\bf x},_{\xi\eta}\), and the third colum contains \( {\bf x},_{\eta\eta} \).
Surface elements are handled in a similar fashion. The example below defines a quadrilateral surface element in the 3-dimensional physical space. Note that the physical space's dimensionality is automatically deduced from the dimensionality of the intrinsic domain.
For the case of the surface element, the location gradient is a 3x2 matrix. The surface elements provides the function NiHu::surface_element::get_normal to return the normal vector. Note that this normal vector is not the unit normal. In three dimensions, its definition is \( {\bf n} = {\bf x},_{\xi} \times {\bf x},_{\eta}\). The Jacobian can be obtained as the norm of the normal vector.
The second derivative is obtained similarly like for volume elements.