Shape Function Types (Elements)
The Lagrange Element
The preceding examples are special cases of the Lagrange element. Consider a positive integer k, the order of the Lagrange element. For simplex mesh elements, the functions u in this finite element space are piecewise polynomials of degree k; that is, on each mesh element u is a polynomial of degree k. Also, in the following table, l, m, and n are nonnegative integers. In general, for a mesh element of type T, u belongs to the Lagrange shape function space Lagk(T), which is spanned by the following monomials (or rational functions, in the case of pyramid elements):
To describe such a function it suffices to give its values in the Lagrange points of order k. These are the points whose local (element) coordinates are integer multiples of 1/k. For example, for a triangular mesh in 2D with k = 2, this means that you have node points at the corners and side midpoints of all mesh triangles. For each of these node points pi, there exists a degree of freedom Ui = u(pi) and a basis function . The restriction of the basis function to a mesh element is a function in Lagk(T) such that at node i, and at all other nodes. The basis functions are continuous and you have
The Lagrange element of order 1 is called the linear element. The Lagrange element of order 2 is called the quadratic element.
The Lagrange elements are available with all types of mesh elements, and it is the most common element type in the COMSOL physics interfaces. The order k can be arbitrary, but the available numerical integration formulas usually limits its usefulness to k ≤ 5(k ≤ 4 for tetrahedral meshes).
Figure 5-1: Examples of Lagrange elements: Second-order (27-node) hexahedral element (left) and third-order (64-node) hexahedral element (right).
Examples
For convenience we provide explicit formulas for Lagrange shape functions for the most common element types and lowest orders.
Edge mesh elements
For order k = 1, the Lagrange shape space has dimension 2 and has the following basis:
For order k = 2 the Lagrange shape space has dimension 3 and has the following basis:
Triangular mesh elements
For order k = 1, the Lagrange shape space has dimension 3 and has the following basis:
For order k = 2, the Lagrange shape space has dimension 6 and has the following basis:
Quadrilateral mesh elements
For order k = 1, the Lagrange shape space has dimension 4 and has the following basis:
For order k = 2, the Lagrange shape space has dimension 9 and has the following basis:
Tetrahedral mesh elements
For order k = 1, the Lagrange shape space has dimension 4 and has the following basis:
For order k = 2, the Lagrange shape space has dimension 10 and has the following basis:
Hexahedral mesh elements
For order k = 1, the Lagrange shape space has dimension 8 and has the following basis:
Syntax for the Lagrange Element (shlag)
Specify Lagrange elements in the model.shape field of the model object. The constructor of the Lagrange shape function is shlag. The following properties are allowed:
It is not possible to abbreviate the property names, and you must write them in lowercase letters enclosed in quotation marks. For example:
model.shape().create("shu","f");
model.shape("shu").create("f1","shlag");
model.shape("shu").feature("f1").set("order",2);
model.shape("shu").feature("f1").set("basename","u");
The Lagrange element defines the following variables. Denote basename with u, and let x and y denote (not necessarily distinct) spatial coordinates. The variables are (sdim = space dimension and edim = mesh element dimension):
ux, meaning the derivative of u with respect to x, defined on edim = sdim
uxy, meaning a second derivative, defined on edim = sdim
uTx, the tangential derivative variable, meaning the x-component of the tangential projection of the gradient, defined on edim < sdim
uTxy, meaning xy-component of the tangential projection of the second derivative, defined when edim < sdim
When calculating the derivatives, the global spatial coordinates are expressed as polynomials of degree (at most) sorder in the local coordinates.
The use of isoparametric elements means that u is not a polynomial in the global coordinates (if 1), only in the local coordinates.
The Nodal Serendipity Element
On each mesh element, the functions in the nodal serendipity finite element space is a subset of those of the Lagrange element. For simplex mesh elements, the functions u in this finite element space are piecewise polynomials of degree k, where k = 2, 3, or 4; that is, on each mesh element u is a polynomial of degree k. In the following table, l, m, and n are nonnegative integers. Also, define a function sl(i) (for the superlinear order) such that sl(i) is equal to i, if i > 1; else sl(i) = 0. In general, for a mesh element of type T, u belongs to the nodal serendipity shape function space Serk(T), which is spanned by the following monomials (or rational functions, in the case of pyramid elements):
To describe such a function it suffices to give its values in the serendipity points of order k, where k is 2, 3, or 4. These points are a subset of the Lagrange points (see The Lagrange Element). For each of these node points pi, there exists a degree of freedom Ui = u(pi) and a basis function . The restriction of the basis function to a mesh element is a function in Lagk(T) such that at node i, and at all other nodes. The basis functions are continuous and you have
Figure 5-2: Examples of serendipity elements: Second-order (20-node) hexahedral element (left) and third-order (32-node) hexahedral element (right).
Syntax for the Nodal Serendipity Element (shnserp)
Specify serendipity shape functions in the model.shape field of the model object. The constructor of the serendipity shape function is shnserp. The following properties are allowed:
The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks.
model.shape().create("shu","f");
model.shape("shu").create("f1","shnserp");
model.shape("shu").feature("f1").set("order",3);
model.shape("shu").feature("f1").set("basename","u");
The nodal serendipity element defines the following field variables. Denote basename with u, and let x and y denote (not necessarily distinct) spatial coordinates. The variables are (sdim = space dimension and edim = mesh element dimension):
ux, meaning the derivative of u with respect to x, defined when edim = sdim or edim=0
uxy, meaning a second derivative, defined when edim = sdim
uTx, the tangential derivative variable, meaning the x-component of the tangential projection of the gradient, defined when 0 < edim < sdim
uTxy, meaning xy-component of the tangential projection of the second derivative, defined when edim < sdim
When calculating the derivatives, the global spatial coordinates are expressed as polynomials of degree (at most) sorder in the local coordinates.
The Argyris Element
For a function represented with Lagrange elements, the first derivatives between mesh elements can be discontinuous. In certain equations (for example, the biharmonic equation) this can be a problem. The Argyris element has basis functions with continuous derivatives between mesh triangles (it is defined in 2D only). The second order derivative is continuous in the triangle corners. On each triangle, a function u in the Argyris finite element space is a polynomial of degree 5 in the local coordinates.
The Argyris element is available with triangular meshes only.
When setting Dirichlet boundary conditions on a variable that has Argyris shape functions, a locking effect can occur if the boundary is curved and constraint order (cporder) 5 is used. Use cporder=4 if the boundary is curved and cporder=5 for straight boundaries.
Syntax for the Argyris Element (sharg_2_5)
Specify Argyris shape functions in the model.shape field of the model object. The constructor of the Argyris shape function is sharg_2_5. The following properties are allowed:
The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks.
model.shape().create("shu","f");
model.shape("shu").create("f1","sharg_2_5");
model.shape("shu").feature("f1").set("basename","u");
The Argyris element defines the following degrees of freedom (where u is the base name and x and y are the spatial coordinate names):
u at corners
ux and uy at corners, meaning derivatives of u
uxx, uxy, and uyy at corners, meaning second derivatives
un at side midpoints, meaning a normal derivative. The direction of the normal is to the right if moving along an edge from a corner with lower mesh vertex number to a corner with higher number
The Argyris element defines the following field variables (where sdim = space dimension = 2 and edim = mesh element dimension):
ux, meaning the derivative of u with respect to x
uxy, meaning a second derivative, defined for edim = sdim and edim = 0
uxTy, the tangential derivative variable, meaning the y-component of the tangential projection of the gradient of ux, defined for 0 < edim < sdim
When calculating the derivatives, the global spatial coordinates are always expressed with shape order 1 in the Argyris element.
The Hermite Element
On each mesh element, the functions in the Hermite finite element space are the same as for the Lagrange element, namely, all polynomials of degree (at most) k in the local coordinates. The difference lies in which DOFs are used. For the Hermite element, a DOF u exists at each Lagrange point of order k, except at those points adjacent to a corner of the mesh element. These DOFs are the values of the function. In addition, other DOFs exist for the first derivatives of the function (with respect to the global coordinates) at the corners (ux and uy in 2D). Together, these DOFs determine the polynomials completely. The functions in the Hermite finite element space have continuous derivatives between mesh elements at the mesh vertices. However, at other common points for two mesh elements, these derivatives are not continuous. You can think of the Hermite element as lying between the Lagrange and Argyris elements.
The Hermite element is available with all types of mesh elements except pyramids. The order k 3 can be arbitrary, but the available numerical integration formulas usually limits its usefulness to k ≤ 5 (k ≤ 4 for tetrahedral meshes).
When setting Dirichlet boundary conditions on a variable that has Hermite shape functions, a locking effect can occur if the boundary is curved and the constraint order cporder is the same as the order of the Hermite element. This means that the derivative becomes over constrained at mesh vertices at the boundary, due to the implementation of the boundary conditions. To prevent this locking, you can specify cporder to be the element order minus 1.
Syntax for the Hermite Element (shherm)
Specify Hermite shape functions in the model.shape field of the model object. The constructor of the Hermite shape function is shherm. The following properties are allowed:
The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks.
model.shape().create("shu","f");
model.shape("shu").create("f1","shherm");
model.shape("shu").feature("f1").set("order",3);
model.shape("shu").feature("f1").set("basename","u");
The Hermite element defines the following degrees of freedom:
The value of the variable basename at each Lagrange node point that is not adjacent to a corner of the mesh element.
The values of the first derivatives of basename with respect to the global spatial coordinates at each corner of the mesh element. The names of these derivatives are formed by appending the spatial coordinate names to basename.
The Hermite element defines the following field variables. Denote basename with u, and let x and y denote (not necessarily distinct) spatial coordinates. The variables are (sdim = space dimension and edim = mesh element dimension):
ux, meaning the derivative of u with respect to x, defined when edim = sdim or edim=0
uxy, meaning a second derivative, defined when edim = sdim
uTx, the tangential derivative variable, meaning the x-component of the tangential projection of the gradient, defined when 0 < edim < sdim
uTxy, meaning xy-component of the tangential projection of the second derivative, defined when edim < sdim
When calculating the derivatives, the global spatial coordinates are expressed as polynomials of degree (at most) sorder in the local coordinates.
Bubble Elements
Bubble elements have shape functions that are zero on the boundaries of the mesh element and have a maximum in the middle of the mesh element. The shape function (there is only one for each mesh element) is defined by a lowest-order polynomial that is zero on the boundary of the element.
The bubble element are available with all types of mesh elements.
Syntax for Bubble Elements (shbub)
Specify bubble shape functions in the model.shape field of the model object. The constructor of a bubble shape function is shbub. The following properties are allowed:
The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks.
model.shape().create("shu","f");
model.shape("shu").create("f1","shbub");
model.shape("shu").feature("f1").set("mdim",2);
model.shape("shu").feature("f1").set("basename","u");
The bubble element has a single degree of freedom, basename, at the midpoint of the mesh element.
The bubble element defines the following field variables. Denote basename with u, and let x and y denote (not necessarily distinct) spatial coordinates. The variables are (sdim = space dimension and edim = mesh element dimension):
u, defined when edim ≤ mdim, u = 0 if edim < mdim.
ux, meaning the derivative of u with respect to x, defined when edim = mdim = sdim.
uTx, the tangential derivative variable, meaning the x-component of the tangential projection of the gradient, defined when mdim < sdim and edim ≤ mdim. uTx = 0 if edim < mdim.
uTxy, meaning the xy-component of the tangential projection of the second derivative, defined when mdim < sdim and edim ≤ mdim. uTxy = 0 if edim < mdim.
The Curl Element
In electromagnetics, curl elements (also called vector elements or Nédélec’s edge elements) are widely used. Each mesh element has DOFs corresponding only to tangential components of the field. For example, in a tetrahedral mesh in 3D each of the three edges in a triangle face element has degrees of freedom that are tangential components of the vector field in the direction of the corresponding edges, and in the interior of the triangle there are degrees of freedom that correspond to vectors tangential to the triangle itself (if the element order is high enough). Finally, in the interior of the mesh tetrahedron there are degrees of freedom in all coordinate directions (if the element order is high enough). This implies that tangential components of the vector field are continuous across element boundaries, but the normal component is not necessarily continuous. This also implies that the curl of the vector field is an integrable function, so these elements are suitable for equations using the curl of the vector field.
The curl elements are available for all types of mesh elements. The polynomial order of the curl element can be at most three in 3D and at most four in 2D and 1D.
Detailed description of the Curl Element
The precise relation between the vector field (actually a one-form) and the DOFs of the curl element is rather complicated. We start by introducing for every mesh element T of dimension d the local vector shape function space Curlk(T) consisting of vector fields satisfying the following condition:
where Lagk(T) is the Lagrange shape function space defined in the section on Lagrange shape functions. There is one exception; for pyramid mesh elements the definition needs to be modified as follows:
Next we introduce a transformation between local and global coordinates for a vector field in a mesh element T of dimension d embedded in space of dimension D. For a vector field in global coordinates , the corresponding vector field in local coordinates is with components defined by
For mesh elements of full dimension d = D, this relation can be inverted to give
In particular, if T has full dimension, is a face or edge of T, and is a vector field on T in local coordinates, then a vector field can be computed, and from its restriction to a vector field in local coordinates on .
Only the components of the global coordinate vector field can be directly evaluated as variables.
The relation between DOFs and vector fields is defined by specifying in each mesh element a number of pairs (pv), where p is a point in the mesh element (given in local coordinates) and v is a vector. The DOFs are then defined as
If the number of pairs in each mesh element of type T is chosen to be equal to the dimension of Curlk(T), the values of these DOFs uniquely define the vector field . Typically, some of the pairs (pv) have p in the interior of T, while others have p on some face or edge . It is convenient to think of the DOFs corresponding to the latter points as inherited from .
Since there might be more than one DOF in the same point p, DOF names have a suffix consisting of two integers, to distinguish different DOFs at the same point.
The choice of pairs (pv) must take into account the orientation of each mesh element. Failing to do this would result in a vector field whose tangential component changes direction at the boundary between mesh elements. This is done by means of a global numbering of all mesh vertices. These indices can be accessed by the API method model.mesh(<tag>).getElem(<type>).
Edge mesh elements
Each edge mesh element has k DOFs. Let P0P1 be the local coordinates of the endpoints of the edge, written in order of increasing mesh vertex indices (so P0P1 is some permutation of the points 0 and 1 on the real line). Let v1 be the 1-dimensional vector . In local coordinates, the DOFs on the edge element are defined by the following pairs (pv):
Triangular mesh elements
Each triangular mesh element has k DOFs on each edge (inherited from the corresponding edge elements), and k ≥ 2k(k − 1) DOFs in the interior. Let P0P1P2 be the local coordinates of the triangle vertices, in order of increasing mesh vertex indices (so P0P1P2 is some permutation of the points (0, 0), (1, 0), (0, 1)). Let and . Then the interior DOFs in this triangle are defined by the following pairs (pv):
Quadrilateral mesh elements
Each quadrilateral mesh element has k DOFs on each edge (inherited from the corresponding edge elements), and 2k(k − 1) DOFs in the interior. Let P0 be the local coordinate of the vertex with lowest global index, P1 the other vertex on the same horizontal edge as P0, and P2 the other vertex on the same vertical edge as P0 (so P0P1P2 is some subset of the points (0, 0), (1, 0), (0, 1), (1, 1)). Let and . Then the interior DOFs in this quadrilateral are defined by the following pairs (pv):
Tetrahedral mesh elements
Each tetrahedral mesh element has k DOFs on each edge, k(k − 1) DOFs on each face, and k(k − 1)(k − 2)/2 DOFs in the interior. Let P0P1P2P3 be the local coordinates of the tetrahedron vertices, in order of increasing mesh vertex indices (so P0P1P2P3 is some permutation of the points (0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1)). Let
, , and
Then the interior DOFs in this tetrahedron are defined by the following pairs (pv):
Hexahedral mesh elements
Each hexahedral mesh element has k DOFs on each edge, 2k(k − 1) DOFs on each face, and 3k(k − 1)2 DOFs in the interior. Let P0 be the local coordinate of the vertex with lowest global index, and let P1P2P3 be the other vertices that differ from P0 only in the ξ1, ξ2, ξ3 coordinates respectively. Let
, ,
Then the interior DOFs in this hexahedron are defined by the following pairs (pv):
Prism mesh elements
Each prism mesh element has k DOFs on each edge, k(k − 1) DOFs on each triangular face, 2k(k − 1) DOFs on each quadrilateral face, and k(k − 1)(3k − 4)/2 DOFs in the interior. Let P0 be the local coordinate of the vertex with lowest global index, let P1P2 be the other two vertices on the same triangular face as P0, numbered so that P1 has lower index than P2, and let P3 be the third point connected to P0 by an edge. Let
, ,
Then the interior DOFs in this prism are defined by the following pairs (pv):
Pyramid mesh elements
Each pyramid mesh element has k DOFs on each edge, k(k − 1) DOFs on each triangular face, 2k(k − 1) DOFs on the quadrilateral face, and k(k − 1)(2k − 1)/2 DOFs in the interior. Let v1 = (100), v2 = (010), and v3 = (001). Then the interior DOFs in this pyramid are defined by the following pairs (pv):
Examples
For convenience we provide here explicit formulas for the Curl shape functions for the lowest orders and most common mesh elements. For each element type, the shape function corresponding to each DOF is written out in local coordinates, for a particular ordering of the mesh element vertices. For other numbers, the difference is that the vector v changes direction for some of the DOFs. For DOFs with suffix 10 this simply means that the corresponding shape functions change sign. Other shape functions might be replaced by a linear combination of the shape functions corresponding to DOFs at the same node point.
Triangular mesh elements
The following formulas assume that the vertices of the triangle, in order of increasing mesh vertex index, have local coordinates (0, 0), (1, 0), (0, 1).
For order k = 1, the Curl shape space has dimension 3, and has the following basis:
For order k = 2, the Curl shape space has dimension 8, and has the following basis:
Quadrilateral mesh elements
The following formulas assume that the vertices of the quadrilateral, in order of increasing mesh vertex index, have local coordinates (0, 0), (1, 0), (0, 1), (1, 1).
For order k = 1 the Curl shape space has dimension 4, and has the following basis:
For order k = 2 the Curl shape space has dimension 12, and has the following basis:
Tetrahedral mesh elements
The following formulas assume that the vertices of the tetrahedron, in order of increasing mesh vertex index, have local coordinates (0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1).
For order k = 1 the Curl shape space has dimension 6, and has the following basis:
Hexahedral mesh elements
The following formulas assume that the vertices of the hexahedron, in order of increasing mesh vertex index, have local coordinates (0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), (0, 0, 1), (1, 0, 1), (0, 1, 1), (1, 1, 1).
For order k = 1 the Curl shape space has dimension 12, and has the following basis:
Syntax for the Curl Element (shcurl)
Specify curl shape functions in the model.shape field of the model object. The constructor of the curl shape function is shcurl. The following properties are allowed:
The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks.
model.shape().create("shu","f");
model.shape("shu").create("f1","shcurl");
model.shape("shu").feature("f1").set("fieldname","E");
model.shape("shu").feature("f1").set("order",2);
model.shape("shu").feature("f1").set("compnames",new String[]{"Ex","Ey"});
model.shape("shu").feature("f1").set("dofbasename","tE");
The default for compnames is fieldname concatenated with the spatial coordinate names. The default for dofbasename is tallcomponents, where allcomponents is the concatenation of the names in compnames.
The property dcompnames lists the names of the component of the antisymmetric matrix
,
where Ai are the vector field components and xi are the spatial coordinates. The components are listed in row order. If a name is the empty string, the field variable corresponding to that component is not defined. If you have provided compnames, the default for the entries in dcompnames is compnames(j) sdimnames(i) compnames(i) sdimnames(j) for off-diagonal elements. If only fieldname has been given, the default for the entries are dfieldname sdimnames(i)sdimnames(j). Diagonal elements are not defined per defaults. For example, shcurl('order',3,'fieldname','A','dcompnames', {'','','curlAy','curlAz','','','','curlAx',''}).
The curl element defines the following degrees of freedom: dofbasename d c, where d  =  1 for DOFs in the interior of an edge, d  = 2 for DOFs in the interior of a surface, and so forth, and c is a number between 0 and d  − 1.
The curl element defines the following field variables (where comp is a component name from compnames, and dcomp is a component from dcompnames, sdim = space dimension and edim = mesh element dimension):
comp, meaning a component of the vector, defined when edim = sdim.
tcomp, meaning one component of the tangential projection of the vector onto the mesh element, defined when edim < sdim.
compx, meaning the derivative of a component of the vector with respect to global spatial coordinate x, defined when edim = sdim.
tcompTx, the tangential derivative variable, meaning the x component of the projection of the gradient of tcomp onto the mesh element, defined when edim < sdim. Here, x is the name of a spatial coordinate.
dcomp, meaning a component of the anti-symmetrized gradient, defined when edim = sdim.
tdcomp, meaning one component of the tangential projection of the anti-symmetrized gradient onto the mesh element, defined when edim < sdim.
For performance reasons, use dcomp in expressions involving the curl rather than writing it as the difference of two gradient components.
For the computation of components, the global spatial coordinates are expressed as polynomials of degree (at most) sorder in the local coordinates.
Discontinuous Elements
The functions in the discontinuous elements space are the same as for the Lagrange element, with the difference that the basis functions are discontinuous between the mesh elements.
Syntax for the Discontinuous Elements (shdisc and shhwdisc)
Specify discontinuous shape functions in the model.shape field of the model object. The constructor of the discontinuous shape functions is either shdisc or shhwdisc. The difference between these two is that the latter has optimal placement of degrees of freedom on triangle and tetrahedral meshes with respect to certain interpolation error estimates, whereas the former are available on all types of mesh elements with arbitrary polynomial order k. However, the available numerical integration formulas usually limits the usefulness to k ≤ 5 (k ≤ 4 for tetrahedral meshes). The following properties are allowed:
The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks.
model.shape().create("sh1","frame1");
model.shape("sh1").create("f1","shdisc");
model.shape("sh1").feature("f1").set("order",2);
model.shape("sh1").feature("f1").set("basename","u");
The discontinuous element defines the following field variables. Denote basename with u, and let x denote the spatial coordinates. The variables are (edim is the mesh element dimension):
u, defined when edim = mdim.
ux, meaning the derivative of u with respect to x, defined when edim = mdim = sdim.
uTx, the tangential derivative variable, meaning the derivative of u with respect to x, defined when edim = mdim < sdim.
Density Elements
The functions in the density elements space are the same as for the discontinuous element if the mesh element is not curved. If the element is curved, the functions define a density of the given order in local coordinates, and the value in global coordinates depends on the transformation between local and global coordinates. The DOF values are proportional to the volume of the mesh elements.
The discontinuous elements are available with all types of mesh elements. The order k can be arbitrary, but the available numerical integration formulas usually limits its usefulness to k ≤ 5 (k ≤ 4 for tetrahedral meshes).
Syntax for the Density Element (shdens)
Specify density shape functions in the model.shape field of the model object. The constructor of the density shape function is shdens. The following properties are allowed:
The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks.
model.shape().create("shu","f");
model.shape("shu").create("f1","shdens");
model.shape("shu").feature("f1").set("order",2);
model.shape("shu").feature("f1").set("basename","u");
The density element defines the following field variables. Denote basename with u, and let x denote the spatial coordinates. The variables are (edim is the mesh element dimension):
u, defined when edim = sdim.
ux, meaning the derivative of u with respect to x, defined when edim = sdim.
Gauss Point Data Elements
The Gauss point data elements are not shape functions in the usual sense. Instead, they define discrete degrees of freedom associated with the Gauss points used in an integration rule of a given order. To make these degrees of freedom available for evaluation and use in equations, a field variable with the same name as the degree of freedom is also defined. This field can be evaluated at any point inside the element but simply evaluates to the degree of freedom value at the closest Gauss point.
Use the Gauss point data elements to, for example, store historical values at the integration points in models with hysteresis, or to solve an implicit equation for a material property at each point. Make sure to use elements of the same order as the integration rule used for assembly of the main PDE, typically twice the discretization order of the main dependent variables. This ensures that the Gauss point data really behaves as a truly local quantity without any spatial correlation.
Syntax for the Gauss Point Data Elements (shgp)
Specify Gauss point data shape functions in the model.shape field of the model object. The constructor of the density shape function is shgp. The following properties are allowed:
Value type in case of using split representation of complex variables1

1
The value type is ignored when split representation of complex variables is not used.

The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks. The following code creates a Gauss point data shape function declaring the degree of freedom u at integration points of order 4 in three-dimensional mesh elements.
model.shape().create("shu","f");
model.shape("shu").create("f1","shgp");
model.shape("shu").feature("f1").set("order",4);
model.shape("shu").feature("f1").set("basename","u");
model.shape("shu").feature("f1").set("mdim","3");
The Gauss point data element defines the following field variables. Denote basename with u and let edim be the evaluation dimension:
u, defined when edim <= mdim.
Divergence Elements
For modeling the B (magnetic flux density) and D (electric displacement) fields in electromagnetics, the divergence elements are useful. The DOFs on the boundary of a mesh element correspond to normal components of the field. In addition, there are DOFs corresponding to all vector field components in the interior of the mesh element of dimension sdim (if the order is high enough). This implies that the normal component of the vector field is continuous across element boundaries, but the tangential components are not necessarily continuous. This also implies that the divergence of the vector field is an integrable function, so these elements are suitable for equations using the divergence of the vector field.
The divergence element are available with all types of mesh elements except pyramids. The polynomial order of the divergence element can be at most three in 3D, and at most four in 2D and 1D.
Syntax for Divergence Elements (shdiv)
Specify divergence shape functions in the model.shape field of the model object. The constructor of the divergence shape function is shdiv. The following properties are allowed:
The property names cannot be abbreviated and must be written in lowercase letters enclosed in quotation marks.
model.shape().create("shu","f");
model.shape("shu").create("f1","shdiv");
model.shape("shu").feature("f1").set("order",2);
model.shape("shu").feature("f1").set("compnames",new String[]{"Bx","By"});
model.shape("shu").feature("f1").set("dofbasename","nB");
The default for compnames is fieldname concatenated with the spatial coordinate names. The default for dofbasename is nallcomponents, where allcomponents is the concatenation of the names in compnames.
The vector element defines the following degrees of freedom: dofbasename on element boundaries, and dofbasename sdim c, c = 0, …, sdim − 1 for DOFs in the interior.
The divergence element defines the following field variables (where comp is a component name from compnames, divname is the divname, sdim = space dimension and edim = mesh element dimension):
comp, meaning a component of the vector, defined when edim = sdim.
ncomp, meaning one component of the projection of the vector onto the normal of mesh element, defined when edim = sdim – 1.
compx, meaning the derivative of a component of the vector with respect to global spatial coordinate x, defined when edim = sdim.
ncompTx, the tangential derivative variable, meaning the x component of the projection of the gradient of ncomp onto the mesh element, defined when edim < sdim. Here, x is the name of a spatial coordinate. ncompTx = 0.
divname, means the divergence of the vector field.
For performance reasons, prefer using divname in expressions involving the divergence rather than writing it as the sum of sdim gradient components.
For the computation of components, the global spatial coordinates are expressed as polynomials of degree (at most) sorder in the local coordinates.