Reducing equation system by manipulating matrices


I am currently using the following formulation to calculation EM eigenvalues

# Formulate FEM problem
a_tt = ((1/m_r)*ufl.inner(ufl.curl(Et_bf), ufl.curl(Et_tf)) - (k0**2) * e_r * ufl.inner(Et_bf, Et_tf)) * ufl.dx
b_tt = (1/m_r)*ufl.inner(Et_bf, Et_tf) * ufl.dx
b_tz = (1/m_r)*ufl.inner(Et_bf, ufl.grad(Ez_tf)) * ufl.dx
b_zt = ufl.inner(ufl.grad(Ez_bf), Et_tf) * ufl.dx
b_zz = ((1/m_r)*ufl.inner(ufl.grad(Ez_bf), ufl.grad(Ez_tf)) - (k0**2) * e_r * ufl.inner(Ez_bf, Ez_tf)) * ufl.dx

Aform = fem.form(a_tt)
Bform = fem.form(b_tt + b_tz + b_zt + b_zz)

# Add boundary conditions

bc_dofs = fem.locate_dofs_topological(combined_space, msh.topology.dim - 1, facet_metals)
PEC_bc = fem.Function(combined_space)
with PEC_bc.vector.localForm() as loc:
bc = fem.dirichletbc(PEC_bc, bc_dofs)

# Now we can solve the problem with SLEPc. First of all, we need to 
# assemble our and matrices with PETSc in this way:
A = assemble_matrix(Aform, bcs=[bc])
B = assemble_matrix(Bform, bcs=[bc])

This corresponds to the formulation below

However, I would like to transform this formulation to the so-called “reduced eigenvalue problem”, suggested here:

How should I approach this?

  1. Assemble each of the sub-matrices, then perform matrix operations as suggested?
  2. Resolved this in the fem.form(b_tt + b_tz + b_zt + b_zz) part somehow?

Would appreciate any help,


The closest I’ve seen is Parallelisation, petsc4py, slepc4py, and dolfinx , search for setPythonContext which in my opinion is the key point you need to adopt. Note that in the class LHS_Class there is a KSPs[..].solve, that you will need for inverting Bzz.