Eigensolver with Mass matrix

Hi everyone!
I have to solve the next eigenvalue’s problem:
\begin{equation} \sigma M u=Ju \end{equation}
where M is the matrix mass and J is the Jacobian of Navier-Stokes equations.

from dolfin import *

P2 = VectorElement("P", mesh.ufl_cell(), 2)
P1 = FiniteElement("P", mesh.ufl_cell(), 1)
TH = MixedElement([P2, P1])
W = FunctionSpace(mesh, TH)

w = Function(W)
u,p= split(w) 
v, q=TestFunctions(W)
#Dummy problem
a=dot(u,v)*dx
#Jacobian, bcs are boundary conditions
J = derivative(a,w)
JM = PETScMatrix()

#mass matrix

vm = TestFunction(W)
um = TrialFunction(W)

mass_form = dot(vm,um)*dx
mass_action_form = action(mass_form, Constant((1.0,1.0,1.0)))
Mass= PETScMatrix()


dummy = inner(Constant((1.0, 1.0)), v) * dx
assemble_system(J, dummy, bcs, A_tensor = JM)
assemble_system(mass_form, dummy, bcs, A_tensor = Mass)

eigensolver = SLEPcEigenSolver(JM,Mass)

This works but I don’t know if it is correct.
My question is: is it necessary to add the boundary conditions to the mass matrix or other conditions?

Thanks!

1 Like