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:
Hi,
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()
assemble(a,…
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?
import dolfinx
import dolfinx.io
import ufl
from mpi4py import MPI
from slepc4py import SLEPc
import numpy as np
c0 = 299792458
mesh = dolfinx.RectangleMesh(
MPI.COMM_WORLD,
[np.array([0, 0, 0]), …
or this demo:
https://mikics.github.io/gsoc-jupyterbook/chapter3/demo_half_loaded_waveguide.html
2 Likes