### Custom / Composite Matrix Assembly

Posted:

**07 Jan 2022, 14:24**Hi!

I'm a bit stuck on a programming task. I would like to solve a system Ax=b using Elmer, where A = B+C*D, where B and C can be assembled as finite element matrices, but D is a dense matrix.

It is not really a problem to write routines to assemble each of the individual matrices, but I am stuck on fitting it into the existing Elmer structure. My main questions are:

I'm a bit stuck on a programming task. I would like to solve a system Ax=b using Elmer, where A = B+C*D, where B and C can be assembled as finite element matrices, but D is a dense matrix.

It is not really a problem to write routines to assemble each of the individual matrices, but I am stuck on fitting it into the existing Elmer structure. My main questions are:

- Is something like this possible with the usual Elmer linear solvers? My concern is the matrix A would be dense and possibly have a bad condition number.
- How could I allocate and access additional FE matrices (i.e. B and C) to assemble them with FE routines?
- How could I do the final step of accessing all three assembled matrices to compute the total matrix A?