Library Usage¶
Using PyHOPE as a Python Library
PyHOPE can be included in other Python libraries. PyHOPE exposes its functionally via runtime contexts defined by Context Managers. The following Python code loads a HOPR HDF5 mesh and derived quantities.
from pyhope import Basis, Mesh
with Mesh('1-01-cartbox_mesh.h5') as m:
elems = m.elems
lobatto_nodes = Basis.legendre_gauss_lobatto_nodes(order=m.nGeo)
Currently implemented functions¶
Library functionally of PyHOPE is geared towards usage in post-processing tools which require mesh information to reconstruct meaningful quantities, for example, solution gradients for Schlieren visualization. Functions currently exposed through the Python interface are the following.
- Basis
- legendre_gauss_nodes
- legendre_gauss_lobatto_nodes
- barycentric_weights
- polynomial_derivative_matrix
- lagrange_interpolation_polys
- calc_vandermonde
- change_basis_3D
change_basis_3D(Vdm: np.ndarray, x3D_In: np.ndarray) -> np.ndarray: """ Interpolate a 3D tensor product Lagrange basis defined by (N_in+1) 1D interpolation point positions xi_In(0:N_In) to another 3D tensor product node positions (number of nodes N_out+1) defined by (N_out+1) interpolation point positions xi_Out(0:N_Out) xi is defined in the 1D reference element xi=[-1,1] """
- change_basis_2D
change_basis_2D(Vdm: np.ndarray, x2D_In: np.ndarray) -> np.ndarray: """ Interpolate a 2D tensor product Lagrange basis defined by (N_in+1) 1D interpolation point positions xi_In(0:N_In) to another 2D tensor product node positions (number of nodes N_out+1) defined by (N_out+1) interpolation point positions xi_Out(0:N_Out) xi is defined in the 1D reference element xi=[-1,1] """
- evaluate_jacobian
- Mesh
- Context manager to generate a mesh from a given file
Mesh(*args: str, stdout: bool = False, stderr: bool = True): """ Mesh context manager to generate a mesh from a given file Args: *args: The mesh file path(s) to be processed stdout (bool): If False, standard output is suppressed stderr (bool): If False, standard error is suppressed Yields: Mesh: An object containing the generated mesh and its properties """
- Context manager to generate a mesh from a given file