mimetic_basis_polynomials.py¶
Node, edge, face and volume polynomials in the 3d reference domain .
grid¶
Let A=(a1, a2)
, B=(b1,b2,b3)
, C=(c1,c2)
. Then
grid (A
, B
, C
) refers to a sequence of coordinates,
(a1, b1, c1)
, (a2, b1, c1)
, (a1, b2, c1)
, (a2, b2, c1)
,
(a1, b3, c1)
, (a2, b3, c1)
, (a1, b1, c2)
, …… Namely, we
first do a meshgrid
(A
, B
, C
), then put the coordinates
into a sequence one by one picking along A
direction firstly, B
direction secondly and finally C
direction. Also see grid()
.
⭕ To access the source code, click on the [source] button at the right
side or click on
[mimetic_basis_polynomials.py]
.
Dependence may exist. In case of error, check import and install required
packages or download required scripts. © mathischeap.com
- class mimetic_basis_polynomials.MimeticBasisPolynomials(nodes_xi, nodes_et, nodes_sg)[source]¶
A wrapper of basis node, edge, face and volume polynomials in the 3d reference domain .
- Parameters:
nodes_xi (1d np.array) – The nodes on which the 1D mimetic polynomials are built along the first axis ().
nodes_et (1d np.array) – The nodes on which the 1D mimetic polynomials are built along the second axis ().
nodes_sg (1d np.array) – The nodes on which the 1D mimetic polynomials are built along the third axis ().
- Example:
>>> bf = MimeticBasisPolynomials('Lobatto-3', 'Lobatto-3', 'Lobatto-3') >>> bf.degree # N = N_xi = N_eta = N_sigma = 3 [3, 3, 3] >>> xi = np.linspace(-1, 1, 5) >>> et = np.linspace(-1, 1, 6) >>> sg = np.linspace(-1, 1, 7) >>> NP = bf.node_polynomials(xi, et, sg) >>> NP.shape # 4^3=64 node polynomials evaluated at 5*6*7=210 points (64, 210) >>> EP_xi, EP_et, EP_sg = bf.edge_polynomials(xi, et, sg) >>> EP_xi.shape # 3*4*4=48 edge polynomials (48, 210) >>> FP_xi, FP_et, FP_sg = bf.face_polynomials(xi, et, sg) >>> FP_et.shape # 3*4*3=36 face polynomials (36, 210) >>> VP = bf.volume_polynomials(xi, et, sg) >>> VP.shape # 3^3=27 volume polynomials (27, 210)
- edge_polynomials(xi, et, sg)[source]¶
Evaluate the edge polynomials at
grid(xi, et, sg)
.- Parameters:
- Returns:
A 2d np.array whose 0-dimension refers to the number of node polynomials and 1-dimension refers to the values evaluated at grid (
xi
,eta
,sigma
).
- face_polynomials(xi, et, sg)[source]¶
Evaluate the face polynomials at
grid(xi, et, sg)
.- Parameters:
- Returns:
A 2d np.array whose 0-dimension refers to the number of node polynomials and 1-dimension refers to the values evaluated at grid (
xi
,eta
,sigma
).
- node_polynomials(xi, et, sg)[source]¶
Evaluate the node polynomials at
grid(xi, et, sg)
.- Parameters:
- Returns:
A 2d np.array whose 0-dimension refers to the number of node polynomials and 1-dimension refers to the values evaluated at grid (
xi
,eta
,sigma
).
- mimetic_basis_polynomials.grid(A, B, C)[source]¶
The function to compute the grid of three sets of nodes.
- Parameters:
A (1d data object) – The first (along ) set of nodes.
B (1d data object) – The second (along ) set of nodes.
C (1d data object) – The third (along ) set of nodes.
- Returns:
A tuple of three outputs:
(1d np.array) The grided coordinates.
(1d np.array) The grided coordinates.
(1d np.array) The grided coordinates.
- Example:
>>> A = np.array([1, 2]) >>> B = np.array([3, 4, 5]) >>> C = np.array([6, 7]) >>> x, y, z = grid(A, B, C) >>> D = np.vstack((x,y,z)).T >>> D array([[1, 3, 6], [2, 3, 6], [1, 4, 6], [2, 4, 6], [1, 5, 6], [2, 5, 6], [1, 3, 7], [2, 3, 7], [1, 4, 7], [2, 4, 7], [1, 5, 7], [2, 5, 7]])
↩️ Back to Ph.D. thesis complements (ptc).