Where can I find the math behind assemble_matrix() and assemble()?

Hello everyone,

I am currently trying to understand what the assemble_matrix() and assemble() functions do. I know they convert a bilinear form into a matrix but I cannot find any info on how they perform such transformation mathematically or its implementation. Does anyone know where I could find this ?

Thanks for reading me and have a nice day !

1 Like

There is quite alot going on under the hood of assembly (even if it follows standard finite element techniques).
One way to get deeper into DOLFINx is by reading: FEniCS23-tutorial — FEniCS Tutorial @ Sorbonne as it goes through in detail how a form is split into a discrete matrix: A complete variational form — FEniCS Tutorial @ Sorbonne, how local kernels are generated: Code generation — FEniCS Tutorial @ Sorbonne
and how bcs are applied: Application of Dirichlet boundary conditions — FEniCS Tutorial @ Sorbonne

Thanks for you help @dokken !

In the section “A complete variationnal form”, when you define each of the functions as the linear combinations of the basis functions, what are these basis functions for FenicsX ? Also I don’t understand what the M_K matrix is and its purpose, is it the same a taking the values of the bilinear forms applied to the functions of the basis ?

Thanks for reading me again and have a nice day !

You select these basis functions with the choice of finite element, i.e.

el = ufl.FiniteElement("Discontinuous Lagrange", domain.ufl_cell(), 2)
V = ufl.FunctionSpace(domain, el)

sets the basis functions for any function, testfunction or trialfunction defined with V.

M_k is not a matrix, but a mapping from the reference element to the physical element.