cherab.imas.math.functions.fourier_bezier.py_bezier_basisΒΆ

cherab.imas.math.functions.fourier_bezier.py_bezier_basis(s: float, t: float) ndarrayΒΆ

Calculate the bezier bases for each node and degree of freedom.

Note

This is the python wrapper for the Cython function bezier_basis(). If you are using this function in a loop, consider using the Cython function directly.

JOREK uses two-thirds order Bernstein polynomial \(B_{i, j}^{(3)}(s, t)\) defined as:

\[ \begin{align}\begin{aligned}B_{i, j}^{(3)}(s, t) \equiv B_i^{(3)}(s) B_j^{(3)}(t)\\\begin{split}B_i^{(3)}(x) \equiv \begin{pmatrix} 3\\i \end{pmatrix} x^i (1 - x)^{3 - i}\end{split}\end{aligned}\end{align} \]

where \(1 \leq i, j \leq 4\) and \(0 \leq s, t \leq 1\).

The bezier basis (or cubic Hermite finite element) \(H_{i, j}(s, t)\) is constructed as linear combinations of the above Bernstein polynomials, written as a product of 1D basis functions:

\[H_{i, j}(s, t) \equiv H_i(s) H_j(t),\]

which satisfy the following boundary conditions:

\[ \begin{align}\begin{aligned}H_1(0) = 1, H_1'(0) = 0, H_1(1) = 0, H_1'(1) = 0\\H_2(0) = 0, H_2'(0) = 1, H_2(1) = 0, H_2'(1) = 1\\H_3(0) = 0, H_3'(0) = 0, H_3(1) = 1, H_3'(1) = 0\\H_4(0) = 0, H_4'(0) = 0, H_4(1) = 0, H_4'(1) = 1\end{aligned}\end{align} \]
Parameters:
s : floatΒΆ

First parameter in the range [0, 1].

t : floatΒΆ

Second parameter in the range [0, 1].

Returns:

(4, 4) ndarray – Bezier bases \(H_{i, j}(s, t)\) for each node \(i\) and degree of freedom \(j\). Axis 0: Node index. Axis 1: Degree of freedom index.

Examples

>>> py_bezier_basis(0.5, 0.5)
array([[0.25    , 0.1875  , 0.1875  , 0.140625],
       [0.25    , 0.1875  , 0.1875  , 0.421875],
       [0.25    , 0.1875  , 0.1875  , 0.140625],
       [0.25    , 0.1875  , 0.1875  , 0.140625]])