Numerical utilities

These are some numerical utilities to compute the modes for the von Kármán plate and to process the modes.

The modes for different boundary conditions are computed using the magpie-python package.

The processing of the modes is done using a port of the vkplate Matlab code.


second_derivative_mixed

 second_derivative_mixed (Nx, Ny, h)

second_derivative

 second_derivative (Nx, Ny, h, direction='x')

Construct a higher-order second derivative operator matching the MATLAB implementation of vkplate.

Type Default Details
Nx int Number of intervals in the x-direction.
Ny int Number of intervals in the y-direction.
h float Grid spacing.
direction str x Direction of the second derivative operator. Can be ‘x’ or ‘y’.
Returns scipy.sparse.spmatrix The \((Nx+1)(Ny+1) \times (Nx+1)(Ny+1)\) second derivative operator.

The bilinear von Kármán operator is defined as

\[ L(f, g)=f_{, x x} g_{, y y}+f_{, y y} g_{, x x}-2 f_{, x y} g_{, x y} \]


vkoperator

 vkoperator (phi1:numpy.ndarray, phi2:numpy.ndarray,
             Dxx:scipy.sparse._matrix.spmatrix,
             Dyy:scipy.sparse._matrix.spmatrix,
             Dxy:scipy.sparse._matrix.spmatrix)

*Compute the numerical approximation of the von Kármán operator \([\phi_1,\phi_2]\).

The operator is defined as:

\[ [\phi_1,\phi_2] = \frac{\partial^2\phi_1}{\partial x^2}\frac{\partial^2\phi_2}{\partial y^2} + \frac{\partial^2\phi_1}{\partial y^2}\frac{\partial^2\phi_2}{\partial x^2} - 2\frac{\partial^2\phi_1}{\partial x\partial y}\frac{\partial^2\phi_2}{\partial x\partial y} \]*

Type Details
phi1 ndarray First function discretized on grid
phi2 ndarray Second function discretized on grid
Dxx spmatrix Second derivative operator in x direction
Dyy spmatrix Second derivative operator in y direction
Dxy spmatrix Mixed derivative operator
Returns ndarray Discretized von Kármán operator evaluated at grid points

double_trapezoid_flat

 double_trapezoid_flat (f:numpy.ndarray, dx:float, dy:float, Ny:int,
                        Nx:int)

Compute double trapezoid integration on flattened array.

Type Details
f ndarray Flattened array to integrate
dx float Grid spacing in x direction
dy float Grid spacing in y direction
Ny int Number of points in y direction
Nx int Number of points in x direction
Returns float Result of double integration

double_trapezoid

 double_trapezoid (f, dx, dy=None)

compute_coupling_matrix_numerical

 compute_coupling_matrix_numerical (psi:numpy.ndarray, phi:numpy.ndarray,
                                    h:float, nx:int, ny:int)

*Compute the coupling matrix for the given in-plane and out-of-plane modes.

The modal coupling matrix is computed as

\[ H_{p, q}^k = \frac{\int_S \Psi_k L\left(\Phi_p, \Phi_q\right) \mathrm{d} S}{\left\|\Psi_k\right\|\left\|\Phi_p\right\|\left\|\Phi_q\right\|} \]

Here however we compute

\[ H_{p, q}^k= \int_S \Psi_k L\left(\Phi_p, \Phi_q\right) \mathrm{d} S \]

since the \(\Psi\) and \(\Phi\) functions are normalised elsewhere.*

Type Details
psi ndarray The normalised in-plane modes with shape (ny+1 * nx+1, n_modes.
These are stored in a flattened array column-wise.
phi ndarray The normalised out-of-plane modes with shape (ny+1 * nx+1, n_modes).
These are stored in a flattened array column-wise.
h float The grid spacing.
nx int The number of intervals in the x-direction.
ny int The number of intervals in the y-direction.
Returns np.ndarray The coupling matrix with shape (n_modes, n_modes, n_modes).

Biharmonic decomposition

Computes the eigenvalue decomposition of the biharmonic operator for the plate:

\[ \Delta \Delta \Phi_p(x, y)=\frac{\rho h}{D} \lambda_p^2 \Phi_p(x, y) . \]

\(\rho\), \(h\) and \(D\) are density, tickness and bending stiffness of the plate, respectively.


biharmonic_eigendecomposition

 biharmonic_eigendecomposition (params:jaxdiffmodal.ftm.PlateParameters,
                                n_modes:int, bcs:numpy.ndarray, nx:int,
                                ny:int, h:float,
                                normalise_eigenvectors=True)

*Computes the eigenvalue decomposition of the biharmonic operator for a plate with the given parameters and boundary conditions.

Additionally it sorts the eigenvalues and eigenvectors in ascending order, and normalises the eigenvectors if requested.*

Type Default Details
params PlateParameters The parameters of the plate.
n_modes int The number of modes to compute.
bcs ndarray The boundary conditions of the plate.
nx int The number of points in the x direction.
ny int The number of points in the y direction.
h float The spacing between points.
normalise_eigenvectors bool True Whether to normalise the eigenvectors.
Returns Tuple[np.ndarray, np.ndarray, np.ndarray] The eigenvalues, eigenvectors and norms of the eigenvectors.

multiresolution_eigendecomposition

 multiresolution_eigendecomposition
                                     (params:jaxdiffmodal.ftm.PlateParamet
                                     ers, n_modes:int, bcs:numpy.ndarray,
                                     h:float, nx:int, ny:int,
                                     levels:int=2)

Runs the biharmonic eigendecomposition and eigenvector alignment on multiple grid resolutions.

Type Default Details
params PlateParameters
n_modes int Number of eigenmodes to compute.
bcs ndarray Boundary conditions.
h float Initial grid spacing.
nx int Number of grid points in the x-direction.
ny int Number of grid points in the y-direction.
levels int 2 Total number of resolutions to run (default 2).
The first level is the coarse grid, and each subsequent level
uses h/2 and double the grid points to cover the same domain.
Returns swapped_eigenvectors, swapped_eigenvalues from the last refinement.