in dolfinx is there a function or library able to find the eigenvalues and eigenfunction of linear operator?
I was thinking of solving the eigenvalue problem for the discretised version of the operator, coming from the weak formulation.
Do you have any clues?
Thanks in advance, regards
You need to define your weak form in DOLFINx as usual, then you need to assemble your matrices with PETSc, and then you can finally find the solutions of your problem with SLEPc (slepc4py).
For more information you can check these posts:
I am trying to write a simple eigenvalue solver code in dolfin-x, but I have a problem in how to define a matrix as a PETScMatrix() and assembling the form into it. There is a proposed code in dolfin which I am trying to write it in dolfin-x:
from dolfin import *
mesh = …….
V = FunctionSpace(mesh, "Lagrange", 1)
u = TrialFunction(V)
v = TestFunction(V)
a = dot(grad(u), grad(v))*dx
# Assemble stiffness form
A = PETScMatrix()
I’m trying to implement this
Dolfin waveguide example in DolfinX.
The implementation below calculates only one eigenpair. If I set solver to SLEPc.EPS.Type.LAPACK, it calculats about a 2500 eigenpairs.
What settings should I use to get a number of eigenpairs requested by eps.setDimensions?
from mpi4py import MPI
from slepc4py import SLEPc
import numpy as np
c0 = 299792458
mesh = dolfinx.RectangleMesh(
[np.array([0, 0, 0]), …
or this demo:
Thank you very much
@CastriMik for the answer, the demo you sent has been very useful.