Source code for struphy.geometry.domains.powered_elliptic_cylinder.powered_elliptic_cylinder_kernels

"""Pyccel kernels for the mapping and Jacobian matrix of :class:`struphy.geometry.domains.PoweredEllipticCylinder`."""

from numpy import cos, pi, sin
from pyccel.decorators import pure


[docs] @pure def powered_ellipse( eta1: float, eta2: float, eta3: float, rx: float, ry: float, lz: float, s: float, f_out: "float[:]", ): r""" Point-wise evaluation of .. math:: F_x &= r_x\,\eta_1^s\cos(2\pi\,\eta_2)\,, F_y &= r_y\,\eta_1^s\sin(2\pi\,\eta_2)\,, F_z &= L_z\,\eta_3\,. Parameters ---------- eta1, eta2, eta3 : float Logical coordinate in [0, 1]. rx, ry : float Axes lengths. lz : float Length in third direction. s : float Power of eta1 f_out : array[float] Output: (x, y, z) = F(eta1, eta2, eta3). """ f_out[0] = (eta1**s) * rx * cos(2 * pi * eta2) f_out[1] = (eta1**s) * ry * sin(2 * pi * eta2) f_out[2] = eta3 * lz
[docs] @pure def powered_ellipse_df( eta1: float, eta2: float, eta3: float, rx: float, ry: float, lz: float, s: float, df_out: "float[:,:]", ): """Jacobian matrix for :meth:`struphy.geometry.domains.powered_elliptic_cylinder.powered_elliptic_cylinder_kernels.powered_ellipse`.""" df_out[0, 0] = s * (eta1 ** (s - 1)) * rx * cos(2 * pi * eta2) df_out[0, 1] = -2 * pi * (eta1**s) * rx * sin(2 * pi * eta2) df_out[0, 2] = 0.0 df_out[1, 0] = s * (eta1 ** (s - 1)) * ry * sin(2 * pi * eta2) df_out[1, 1] = 2 * pi * (eta1**s) * ry * cos(2 * pi * eta2) df_out[1, 2] = 0.0 df_out[2, 0] = 0.0 df_out[2, 1] = 0.0 df_out[2, 2] = lz