Shape functions and derivatives of one element type and order at the points of a cubature.
Create with the constructor, s = shapefunc(q, 2), or in place with
call s%set(q, 2), where q is a cubature. Optional arguments
flag infinite directions (infin), choose serendipity elements
(family) and set the node ordering (nodes).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | elm | = | 0 |
Element type, |
|
| integer, | public | :: | dim | = | 0 |
Spatial dimension |
|
| integer, | public | :: | order | = | 0 |
Polynomial order |
|
| integer, | public | :: | family | = | SHP_LAGRANGE |
|
|
| integer, | public | :: | nnodes | = | 0 |
Number of nodes |
|
| integer, | public | :: | npoints | = | 0 |
Number of cubature points |
|
| integer, | public | :: | infin(3) | = | SHP_FIN |
Infinitude per direction, |
|
| integer, | public, | allocatable | :: | lattice(:,:) |
Lattice indices, shape |
||
| real(kind=rk), | public, | allocatable | :: | coords(:,:) |
Nodal coordinates, shape |
||
| real(kind=rk), | public, | allocatable | :: | func(:,:) |
Values , shape |
||
| real(kind=rk), | public, | allocatable | :: | derv(:,:,:) |
First derivatives , shape |
||
| real(kind=rk), | public, | allocatable | :: | curv(:,:,:,:) |
Second derivatives ,
shape |
Construct shape functions, e.g. shapefunc(q, 2),
shapefunc(q, 1, [SHP_FIN, SHP_INF]) or
shapefunc(q, 2, family=SHP_SERENDIPITY, nodes=perm)
Construct shape functions of order order at the points of q; see set
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(cubature), | intent(in) | :: | q |
Cubature on the reference element |
||
| integer, | intent(in) | :: | order |
Polynomial order |
||
| integer, | intent(in), | optional | :: | infin(:) |
Infinitude, |
|
| integer, | intent(in), | optional | :: | family |
|
|
| integer, | intent(in), | optional | :: | nodes(:) |
Node ordering: |
Build the shape functions in place
Build shape functions of order order at the points of q.
infin has size 1 (same in every direction) or q%dim, and defaults to
SHP_FIN. SHP_INF and SHP_CHP are allowed along the
directions of lines, quadrilaterals and hexahedra, and along the axial
direction 3 of wedges, with order .
family SHP_SERENDIPITY selects the serendipity quadrilaterals and
hexahedra of orders 1 to 3 (4, 8, 12 and 8, 20, 32 nodes), which must be
finite.
nodes is a permutation of 1:nnodes: the caller's node k is node
nodes(k) of the default numbering. All outputs then follow the
caller's numbering.
Stops on invalid input.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shapefunc), | intent(inout) | :: | self | |||
| type(cubature), | intent(in) | :: | q |
Cubature on the reference element |
||
| integer, | intent(in) | :: | order |
Polynomial order |
||
| integer, | intent(in), | optional | :: | infin(:) |
Infinitude, |
|
| integer, | intent(in), | optional | :: | family |
|
|
| integer, | intent(in), | optional | :: | nodes(:) |
Node ordering: |
Evaluate at any point of the reference element
Evaluate the shape functions and their derivatives at any point xi
of the reference element. The element must be set. Infinite
directions are singular at .
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shapefunc), | intent(in) | :: | self | |||
| real(kind=rk), | intent(in) | :: | xi(:) |
Point, size |
||
| real(kind=rk), | intent(out) | :: | func(self%nnodes) |
Values |
||
| real(kind=rk), | intent(out) | :: | derv(self%dim,self%nnodes) |
|
||
| real(kind=rk), | intent(out) | :: | curv(self%dim,self%dim,self%nnodes) |
|
True if set and consistent
True if the shape functions are set and their arrays are consistent
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shapefunc), | intent(in) | :: | self |
Write element, order, family, infinitude, nodes, points
Write element type, dimension, order, infinitude and numbers of nodes and points
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shapefunc), | intent(in) | :: | self | |||
| integer, | intent(in), | optional | :: | unit |
Output unit, default |
Write the summary, values and first derivatives
Write the summary, then for every point and node the value and first derivatives, and per point the sums over the nodes
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shapefunc), | intent(in) | :: | self | |||
| integer, | intent(in), | optional | :: | unit |
Output unit, default |
Write the summary and the nodal coordinates
Write the node numbers and nodal coordinates
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shapefunc), | intent(in) | :: | self | |||
| integer, | intent(in), | optional | :: | unit |
Output unit, default |
Deallocate and reset
Deallocate and reset to the unset state
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(shapefunc), | intent(inout) | :: | self |
type :: shapefunc !! Shape functions and derivatives of one element type and order at !! the points of a cubature. !! !! Create with the constructor, `s = shapefunc(q, 2)`, or in place with !! `call s%set(q, 2)`, where `q` is a `cubature`. Optional arguments !! flag infinite directions (`infin`), choose serendipity elements !! (`family`) and set the node ordering (`nodes`). integer :: elm = 0 !! Element type, `CUB_*` integer :: dim = 0 !! Spatial dimension integer :: order = 0 !! Polynomial order integer :: family = SHP_LAGRANGE !! `SHP_LAGRANGE` or `SHP_SERENDIPITY` integer :: nnodes = 0 !! Number of nodes integer :: npoints = 0 !! Number of cubature points integer :: infin(3) = SHP_FIN !! Infinitude per direction, `SHP_*` integer, allocatable :: lattice(:,:) !! Lattice indices, shape `[nfactors, nnodes]`, see module documentation real(rk), allocatable :: coords(:,:) !! Nodal coordinates, shape `[dim, nnodes]` real(rk), allocatable :: func(:,:) !! Values \(N_i\), shape `[nnodes, npoints]` real(rk), allocatable :: derv(:,:,:) !! First derivatives \(\partial N_i/\partial\xi_j\), shape `[dim, nnodes, npoints]` real(rk), allocatable :: curv(:,:,:,:) !! Second derivatives \(\partial^2 N_i/\partial\xi_j\partial\xi_k\), !! shape `[dim, dim, nnodes, npoints]` integer, private :: nfactors = 0 ! Number of factor coordinates integer, private :: kinds(4) = 0 ! 1D function family per factor, `SHP_*` or `SIMPLEX` real(rk), private :: s0(4) = 0 ! Factor coordinates at \(\xi = 0\) real(rk), private :: dsdxi(4,3) = 0 ! Constant \(\partial s_k/\partial\xi_j\) integer, allocatable, private :: basis(:,:) ! Lattice of the product functions evaluated by `eval` real(rk), allocatable, private :: trans(:,:) ! Serendipity functions from product functions, `[nnodes, size(basis,2)]` contains procedure :: set !! Build the shape functions in place procedure :: eval !! Evaluate at any point of the reference element procedure :: is_valid !! True if set and consistent procedure :: summary !! Write element, order, family, infinitude, nodes, points procedure :: show !! Write the summary, values and first derivatives procedure :: numbering !! Write the summary and the nodal coordinates procedure :: destroy !! Deallocate and reset end type shapefunc