mimetic_basis_polynomials_2d.py

Node, edge and face polynomials in the 2d reference domain \Pi_{\mathrm{ref}}=[-1,1]^2.

grid2d

Let A=(a1, a2), B=(b1,b2,b3). Then grid2d (A, B) refers to a sequence of coordinates, (a1, b1), (a2, b1), (a1, b2), (a2, b2), (a1, b3), (a2, b3). Namely, we first do a meshgrid (A, B), then put the coordinates into a sequence one by one picking along A direction firstly, B direction secondly and finally C direction. Also see grid2d().

⭕ To access the source code, click on the [source] button at the right side or click on [mimetic_basis_polynomials_2d.py]. Dependence may exist. In case of error, check import and install required packages or download required scripts. © mathischeap.com

class mimetic_basis_polynomials_2d.MimeticBasisPolynomials2D(nodes_rho, nodes_tau)[source]

A wrapper of basis node, edge, face polynomials in the 2d reference domain \Pi_{\mathrm{ref}}=[-1,1]^2.

Parameters:
  • nodes_rho (1d np.array) – The nodes on which the 1D mimetic polynomials are built along the first axis (\varrho).

  • nodes_tau (1d np.array) – The nodes on which the 1D mimetic polynomials are built along the second axis (\tau).

Example:

>>> bf = MimeticBasisPolynomials2D('Lobatto-3', 'Lobatto-3')
>>> bf.degree # N = nodes_rho = nodes_tau = 3
[3, 3]
>>> rho = np.linspace(-1, 1, 5)
>>> tau = np.linspace(-1, 1, 6)
>>> NP = bf.node_polynomials(rho, tau)
>>> NP.shape # 4^2=16 node polynomials evaluated at 5*6=30 points
(16, 30)
>>> EP_rho, EP_tau = bf.edge_polynomials(rho, tau)
>>> EP_rho.shape # 3*4=12 edge polynomials
(12, 30)
>>> FP = bf.face_polynomials(rho, tau)
>>> FP.shape # 3*3=9 face polynomials
(9, 30)
edge_polynomials(rho, tau)[source]

Evaluate the edge polynomials at grid2d(rho, tau).

Parameters:
  • rho (1d np.array) – grid2d (rho, tau) is the grid to evaluate the polynomials.

  • tau (1d np.array) – grid2d (rho, tau)is the grid to evaluate the polynomials.

face_polynomials(rho, tau)[source]

Evaluate the face polynomials at grid2d(rho, tau).

Parameters:
  • rho (1d np.array) – grid2d (rho, tau) is the grid to evaluate the polynomials.

  • tau (1d np.array) – grid2d (rho, tau)is the grid to evaluate the polynomials.

node_polynomials(rho, tau)[source]

Evaluate the node polynomials at grid2d(rho, tau).

Parameters:
  • rho (1d np.array) – grid2d (rho, tau) is the grid to evaluate the polynomials.

  • tau (1d np.array) – grid2d (rho, tau)is the grid to evaluate the polynomials.

mimetic_basis_polynomials_2d.grid2d(A, B)[source]

The function to compute the grid of two sets of nodes.

Parameters:
  • A (1d data object) – The first (along \varrho) set of nodes.

  • B (1d data object) – The second (along \tau) set of nodes.

Returns:

A tuple of three outputs:

  1. (1d np.array) The grided \varrho coordinates.

  2. (1d np.array) The grided \tau coordinates.

Example:

>>> A = np.array([1, 2])
>>> B = np.array([3, 4, 5])
>>> x, y = grid2d(A, B)
>>> D = np.vstack((x,y)).T
>>> D
array([[1, 3],
       [2, 3],
       [1, 4],
       [2, 4],
       [1, 5],
       [2, 5]])

↩️ Back to Ph.D. thesis complements (ptc).