Shape Function Generation#

[7]:
import numpy as np
[8]:
from polymesh.cells import H8

pcoords = H8.lcoords()
shpf = H8.shape_function_values
shpmf = H8.shape_function_matrix
dshpf = H8.shape_function_derivatives
[9]:
shpf(pcoords).shape, shpf(pcoords[:2]).shape
[9]:
((8, 8), (2, 8))
[10]:
shpmf(pcoords).shape, shpmf(pcoords[:2]).shape
[10]:
((8, 3, 24), (2, 3, 24))
[11]:
dshpf(pcoords).shape, dshpf(pcoords[:2]).shape
[11]:
((8, 8, 3), (2, 8, 3))
[12]:
pcoords = H8.lcoords()
*_, shpfH8, shpmfH8, dshpfH8 = H8.generate_class_functions()
[13]:
np.all(np.isclose(shpfH8(pcoords), shpf(pcoords)))
[13]:
True
[14]:
np.all(np.isclose(dshpfH8(pcoords), dshpf(pcoords)))
[14]:
True
[15]:
np.all(np.isclose(shpmfH8(pcoords), shpmf(pcoords)))
[15]:
True
[16]:
from polymesh.cells import TET10

pcoords = TET10.lcoords()
shp, dshp, shpf, shpmf, dshpf = TET10.generate_class_functions()
[17]:
shpf(pcoords).shape, shpf(pcoords[:2]).shape
[17]:
((10, 10), (2, 10))
[18]:
shpmf(pcoords).shape, shpmf(pcoords[:2]).shape
[18]:
((10, 3, 30), (2, 3, 30))
[19]:
dshpf(pcoords).shape, dshpf(pcoords[:2]).shape
[19]:
((10, 10, 3), (2, 10, 3))
[20]:
shpf(pcoords).shape
[20]:
(10, 10)