Skip to content

Matrices in two dimensions - #6

Merged
mrhardman merged 13 commits into
mainfrom
matrices-in-two-dimensions
Feb 25, 2026
Merged

Matrices in two dimensions#6
mrhardman merged 13 commits into
mainfrom
matrices-in-two-dimensions

Conversation

@mrhardman

@mrhardman mrhardman commented Feb 25, 2026

Copy link
Copy Markdown
Collaborator

This PR contributes two related features.

  • The ability to calculate matrices for weak forms where two-dimensional integrals do not separate into a product of one-dimensional integrals. This occurs where the kernel $\rho(x_1,x_2)$ is not a separable function. Noting that $P_i(x_1)$, $R_i(x_2)$, $Q_i(x_1)$, $S_i(x_2)$ are from the set of Lagrange polynomials basis
    functions (and their first derivatives) in $x_1$ and $x_2$, an example of a non-separable matrix is
$$K_{ikjn} = \int^{x_{2u}}_{x_{2l}}\int^{x_{1u}}_{x_{1l}} P_i(x_1) R_k(x_2) Q_j(x_1) S_n(x_2)\rho(x_1,x_2) d x_1 d x_2.$$
  • The syntax to create is a particular choice of $K_{ikjn}$=K[i,k,j,n] (noting the order of the indices) is
l_i = lagrange_x
l_j = lagrange_x
l_k = d_lagrange_dx
l_n = d_lagrange_dx
K_2D = finite_element_matrix(l_i,l_j,coordinate_x1,
                            l_k,l_n,coordinate_x2;
                            kernel_function=((x1,x2)->rho(x1,x2)),
                            max_iterations=10, quadrature_increment=10,
                            atol=1.0e-13, rtol=1.0e-13)
  • A simple implementation of p-adaptive Gaussian quadrature using repeated calls to an 'internal' function _finite_element_matrix(), which calls FastGaussQuadrature to create the quadrature rule for a given number of quadrature points. This feature is necessary to make the caculation of $K_{ikjn}$ reliable for arbitrary $\rho(x_1,x_2)$.
  • Additional tests.
  • Updates to the README.md.

@mrhardman
mrhardman merged commit fb0014b into main Feb 25, 2026
2 checks passed
@mrhardman
mrhardman deleted the matrices-in-two-dimensions branch February 25, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant